getLat();
$_SESSION['lon'] = $userPos->getLon();
$_SESSION['location'] = htmlspecialchars($_GET['location']);
}
}
if (isset($_SESSION['lat'], $_SESSION['lon'])) {
$userPos = new Location();
$userPos->setPosition($_SESSION['lat'], $_SESSION['lon']);
}
include('header.php');
echo '
Événements à '. EVENT_RADIUS .' km autour de '. $_SESSION['location'] . '
';
$feedUrl = sprintf(CALENDAR_1_LOCAL_FEED, EVENT_RADIUS, $_SESSION['lat'], $_SESSION['lon']);
$content = @file_get_contents($feedUrl);
if (!empty($content)) {
$x = new SimpleXmlElement($content);
echo '
Événements importés automatiquement depuis
l\'Agenda du libre
:
';
echo '';
}
echo '
Événements importés automatiquement depuis
forum.monnaie-libre.fr
:
';
$content = @file_get_contents(CALENDAR_2_FEED);
$x = json_decode($content);
echo '';
$i = 0;
$limit = 20;
$todayIso = new DateTime();
foreach($x->topic_list->topics as $entry) {
$eventLoc = NULL;
$eventDate = new DateTime($entry->event->start);
if ($eventDate >= $todayIso) {
if (isset($entry->location->geo_location->lat, $entry->location->geo_location->lon)) {
$eventLoc = new Location();
$eventLoc->setPosition($entry->location->geo_location->lat, $entry->location->geo_location->lon);
} else {
$searchTerms = [];
if (isset($entry->location->geo_location->country)) {
$searchTerms[] = $entry->location->geo_location->country;
}
if (isset($entry->location->geo_location->state)) {
$searchTerms[] = $entry->location->geo_location->state;
}
if (isset($entry->location->geo_location->postalcode)) {
$searchTerms[] = $entry->location->geo_location->postalcode;
}
if (isset($entry->location->geo_location->city)) {
$searchTerms[] = $entry->location->geo_location->city;
}
if (isset($entry->location->geo_location->address)) {
$searchTerms[] = $entry->location->geo_location->address;
}
if (!empty($searchTerms)) {
$eventLoc = Location::createFromAddress($searchTerms);
}
}
if (isset($eventLoc) and $eventLoc and (($dist = Location::geoDist($eventLoc->getPosition(), $userPos->getPosition())) <= EVENT_RADIUS)) {
echo '
- [à ' . round($dist) . ' km] ';
if (isset($eventDate)) {
echo '
, le '. $eventDate->format('j ') . moisFr($eventDate->format('n')) . $eventDate->format(' Y');
}
echo ' :
'. $entry->title . '
';
if (isset($entry->location->geo_location->city)) {
echo '
, à '. $entry->location->geo_location->city;
}
echo '
';
++$i;
if ($i == $limit) {
break;
}
}
}
}
echo '
';
echo 'Contacter d\'autres junistes près de '. $_SESSION['location'] . '
';
echo '
Consulter la doc de OpenStreetMap API pour voir comment récupérer les descriptions des pins des groupes locaux de la Framacarte.
';
echo '
Groupe de discussion par mail du groupe de Vannes
';
$offers = $gchange->getNearbyOffers($_SESSION['lat'], $_SESSION['lon'], RADIUS);
echo 'Annonces à '. RADIUS . ' km autour de '. $_SESSION['location'] .'
';
echo '';
foreach ($offers as $offer) {
$description = isset($offer->_source->description) ? ' title="'. substr($offer->_source->description, 0, 30) . '"' : '';
echo '
-
' . $offer->_source->title . '
('. $offer->_source->city . ')
';
}
echo '
';
$users = $cesiumPlus->getNearbyUsers($_SESSION['lat'], $_SESSION['lon'], RADIUS);
echo 'Nouveaux utilisateurs à '. RADIUS . ' km autour de '. $_SESSION['location'] .'
';
echo '';
foreach ($users as $user) {
$date = new DateTime();
$date->setTimestamp($user->_source->time);
echo '
'. $date->format('j') . ' ' . moisFr($date->format('n')) . ' ' . $date->format('Y') . ' |
' . $user->_source->title . '
|
';
}
echo '
';
include('footer.php');