2020-12-10 15:49:47 +01:00
< ? php
2020-12-12 00:40:15 +01:00
require_once ( 'config.php' );
2020-12-11 23:30:55 +01:00
require_once ( 'lib/Gchange.class.php' );
2020-12-10 15:49:47 +01:00
include ( 'header.php' );
if ( ! isset ( $_POST [ 'city' ])) {
echo '
2020-12-11 23:30:55 +01:00
< h2 > Ça se passe près de chez vous & #8239;!</h2>
2020-12-10 15:49:47 +01:00
2020-12-11 23:30:55 +01:00
< form method = " get " action = " mytown.php " >
2020-12-10 15:49:47 +01:00
< p >
2020-12-11 23:30:55 +01:00
< label > Ville ou code postal & nbsp ; :
< input type = " text " name = " location " />
2020-12-10 15:49:47 +01:00
</ label >
</ p >
< p >
2020-12-11 23:30:55 +01:00
< input type = " submit " value = " Voir les annonces près de chez moi " />
2020-12-10 15:49:47 +01:00
</ p >
</ form > ' ;
}
2020-12-11 23:30:55 +01:00
$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>' ;
2020-12-12 00:40:15 +01:00
2020-12-11 23:30:55 +01:00
echo '
< p >
2020-12-12 00:40:15 +01:00
Événements importés automatiquement depuis
< a href = " '. htmlspecialchars(CALENDAR_1_URL) .' " >
2020-12-11 23:30:55 +01:00
l\ ' Agenda du libre
2020-12-12 00:40:15 +01:00
</ a >& nbsp ; :
2020-12-11 23:30:55 +01:00
</ p > ' ;
2020-12-12 00:40:15 +01:00
$content = @ file_get_contents ( CALENDAR_1_FEED );
2020-12-11 23:30:55 +01:00
2020-12-12 15:21:40 +01:00
if ( ! empty ( $content )) {
2020-12-11 23:30:55 +01:00
2020-12-12 15:21:40 +01:00
$x = new SimpleXmlElement ( $content );
2020-12-12 01:19:55 +01:00
2020-12-12 15:21:40 +01:00
echo '<ul>' ;
2020-12-11 23:30:55 +01:00
2020-12-12 15:21:40 +01:00
$events = [];
2020-12-12 01:19:55 +01:00
2020-12-12 15:21:40 +01:00
foreach ( $x -> item as $entry ) {
2020-12-12 01:19:55 +01:00
2020-12-12 15:21:40 +01:00
$events [] = $entry ;
}
2020-12-12 01:19:55 +01:00
2020-12-12 15:21:40 +01:00
$events = array_reverse ( $events );
2020-12-11 23:30:55 +01:00
2020-12-12 15:21:40 +01:00
foreach ( $events as $entry ) {
2020-12-11 23:30:55 +01:00
2020-12-12 15:21:40 +01:00
echo '
< li >
< a href = " '. $entry->link .' "
title = " '. substr(strip_tags( $entry->description ), 0, 60) . ' " >
'. $entry->title . '
</ a >
</ li > ' ;
}
2020-12-12 00:40:15 +01:00
2020-12-12 15:21:40 +01:00
echo '</ul>' ;
}
2020-12-12 00:40:15 +01:00
echo '
< p >
Événements importés automatiquement depuis
< a href = " '. CALENDAR_2_URL .' " >
forum . monnaie - libre . fr
</ a >& nbsp ; :
</ 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 . ' & nbsp ; : ' ;
}
echo '
< a href = " '. sprintf(CALENDAR_2_EVENT_URL, $entry->id ) .' "
title = " '. substr(strip_tags( $entry->excerpt ), 0, 60) . ' " >
'. $entry->title . '
</ a >
</ li > ' ;
}
echo '</ul>' ;
2020-12-10 15:49:47 +01:00
include ( 'footer.php' );