187 lines
3.2 KiB
PHP
187 lines
3.2 KiB
PHP
<?php
|
|
|
|
require_once('config.php');
|
|
require_once('lib/Gchange.class.php');
|
|
|
|
|
|
include('header.php');
|
|
|
|
if (!isset($_POST['city'])) {
|
|
|
|
echo '
|
|
<h2>Ça se passe près de chez vous !</h2>
|
|
|
|
<form method="get" action="mytown.php">
|
|
<p>
|
|
<label>Ville ou code postal :
|
|
<input type="text" name="location" />
|
|
</label>
|
|
</p>
|
|
<p>
|
|
<input type="submit" value="Voir les annonces près de chez moi" />
|
|
</p>
|
|
</form>';
|
|
}
|
|
|
|
|
|
|
|
$gchange = new Gchange();
|
|
|
|
$offers = $gchange->getShippable();
|
|
|
|
echo '<h2>Livré à votre domicile</h2>';
|
|
|
|
echo '<p>Retrouvez ici toutes les annonces pour lesquelles le vendeur a mentionné "envoi possible" dans son annonce.</p>';
|
|
|
|
echo '<ol>';
|
|
foreach ($offers as $offer) {
|
|
|
|
$description = isset($offer->_source->description) ? ' title="'. substr($offer->_source->description, 0, 30) . '"' : '';
|
|
|
|
echo '
|
|
|
|
<li>
|
|
<a href="https://www.gchange.fr/#/app/market/view/'. $offer->_id . '/"'. $description .'>
|
|
' . $offer->_source->title . '
|
|
</a>
|
|
</li>
|
|
|
|
';
|
|
}
|
|
echo '</ol>';
|
|
|
|
|
|
|
|
$offers = $gchange->getImmaterialOffers();
|
|
|
|
echo '<h2>Productions immatérielles</h2>';
|
|
|
|
echo '<p>Retrouvez ici formations à distance, coaching, cours, prestations... bref, tout ce qui ressemble plus à de l\'information qu\'à de la matière.</p>';
|
|
|
|
echo '<ol>';
|
|
foreach ($offers as $offer) {
|
|
|
|
$description = isset($offer->_source->description) ? ' title="'. substr($offer->_source->description, 0, 30) . '"' : '';
|
|
|
|
echo '
|
|
|
|
<li>
|
|
<a href="https://www.gchange.fr/#/app/market/view/'. $offer->_id . '/"'. $description .'>
|
|
' . $offer->_source->title . '
|
|
</a>
|
|
</li>
|
|
|
|
';
|
|
}
|
|
echo '</ol>';
|
|
|
|
|
|
|
|
echo '<h2>Prochains événements monnaie libre</h2>';
|
|
|
|
|
|
echo '
|
|
<p>
|
|
Événements importés automatiquement depuis
|
|
<a href="'. htmlspecialchars(CALENDAR_1_URL) .'">
|
|
l\'Agenda du libre
|
|
</a> :
|
|
</p>';
|
|
|
|
$content = @file_get_contents(CALENDAR_1_FEED);
|
|
$x = new SimpleXmlElement($content);
|
|
|
|
echo '<ul>';
|
|
|
|
$events = [];
|
|
|
|
foreach($x->item as $entry) {
|
|
|
|
$events[] = $entry;
|
|
}
|
|
|
|
$events = array_reverse($events);
|
|
|
|
foreach ($events as $entry) {
|
|
|
|
echo '
|
|
|
|
<li>
|
|
<a href="'. $entry->link .'"
|
|
title="'. substr(strip_tags($entry->description), 0, 60) . '">
|
|
|
|
'. $entry->title . '
|
|
|
|
</a>
|
|
</li>';
|
|
}
|
|
|
|
echo '</ul>';
|
|
|
|
|
|
|
|
|
|
echo '
|
|
<p>
|
|
Événements importés automatiquement depuis
|
|
<a href="'. CALENDAR_2_URL .'">
|
|
forum.monnaie-libre.fr
|
|
</a> :
|
|
</p>';
|
|
|
|
$content = @file_get_contents(CALENDAR_2_FEED);
|
|
$x = json_decode($content);
|
|
|
|
echo '<ul>';
|
|
|
|
$i = 0;
|
|
$limit = 20;
|
|
$todayIso = new DateTime();
|
|
foreach($x->topic_list->topics as $entry) {
|
|
|
|
$eventDate = new DateTime($entry->event->start);
|
|
|
|
if ($eventDate < $todayIso) {
|
|
|
|
continue;
|
|
}
|
|
|
|
++$i;
|
|
if ($i > $limit) {
|
|
|
|
break;
|
|
}
|
|
|
|
echo '
|
|
|
|
<li>';
|
|
if (isset($eventDate)) {
|
|
|
|
echo '
|
|
le '. $eventDate->format('j ') . moisFr($eventDate->format('n')) . $eventDate->format(' Y') . ', ';
|
|
}
|
|
|
|
if (isset($entry->location->geo_location->city)) {
|
|
|
|
echo '
|
|
à '. $entry->location->geo_location->city . ' : ';
|
|
}
|
|
|
|
echo '
|
|
|
|
<a href="'. sprintf(CALENDAR_2_EVENT_URL, $entry->id) .'"
|
|
title="'. substr(strip_tags($entry->excerpt), 0, 60) . '">
|
|
|
|
'. $entry->title . '
|
|
|
|
</a>
|
|
</li>';
|
|
}
|
|
|
|
echo '</ul>';
|
|
|
|
|
|
include('footer.php');
|
|
|
|
|