158 lines
3.2 KiB
PHP
158 lines
3.2 KiB
PHP
|
<?php
|
||
|
|
||
|
|
||
|
require_once('config.php');
|
||
|
|
||
|
|
||
|
require_once('lib/Gchange.class.php');
|
||
|
require_once('lib/CesiumPlus.class.php');
|
||
|
|
||
|
$gchange = new Gchange();
|
||
|
$cesiumPlus = new CesiumPlus();
|
||
|
|
||
|
|
||
|
if (isset($_POST['city'])) {
|
||
|
|
||
|
$_SESSION['city'] = $_POST['city'];
|
||
|
|
||
|
$streamContext = stream_context_create(
|
||
|
array(
|
||
|
"http" => array(
|
||
|
"header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
|
||
|
)
|
||
|
)
|
||
|
);
|
||
|
|
||
|
|
||
|
$url = 'http://nominatim.openstreetmap.org/search?q='. urlencode($_POST['city']) . '&format=json';
|
||
|
|
||
|
$citiesJson = file_get_contents($url, false, $streamContext);
|
||
|
$cities = json_decode($citiesJson);
|
||
|
|
||
|
$_SESSION['lat'] = $cities[0]->lat;
|
||
|
$_SESSION['lon'] = $cities[0]->lon;
|
||
|
$_SESSION['city'] = htmlspecialchars($_POST['city']);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
include('header.php');
|
||
|
|
||
|
|
||
|
echo '<h2>Événements à venir près de '. $_SESSION['city'] . '</h2>';
|
||
|
|
||
|
echo '<p>Pas d\'événement prévu en ce moment.</p>';
|
||
|
|
||
|
|
||
|
|
||
|
echo '<h2>Contacter d\'autres junistes près de '. $_SESSION['city'] . '</h2>';
|
||
|
|
||
|
echo '
|
||
|
<p>
|
||
|
<a href="'. BB_URL . '">
|
||
|
Groupe de discussion par mail du groupe de '. $_SESSION['city']. '
|
||
|
</a>
|
||
|
</p>';
|
||
|
|
||
|
|
||
|
$users = $cesiumPlus->getNearbyUsers($_SESSION['lat'], $_SESSION['lon'], RADIUS);
|
||
|
|
||
|
echo '<h2>Nouveaux utilisateurs à '. RADIUS . ' autour de '. $_SESSION['city'] .'</h2>';
|
||
|
|
||
|
echo '<table>';
|
||
|
foreach ($users as $user) {
|
||
|
|
||
|
$date = new DateTime();
|
||
|
$date->setTimestamp($user->_source->time);
|
||
|
|
||
|
echo '
|
||
|
|
||
|
<tr>
|
||
|
<td class="date">'. $date->format('j') . ' ' . moisFr($date->format('n')) . ' ' . $date->format('Y') . '</td>
|
||
|
<td>
|
||
|
<a href="https://demo.cesium.app/#/app/wot/'. $user->_source->issuer . '/">
|
||
|
' . $user->_source->title . '
|
||
|
</a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
';
|
||
|
}
|
||
|
echo '</table>';
|
||
|
|
||
|
|
||
|
$offers = $gchange->getNearbyOffers($_SESSION['lat'], $_SESSION['lon'], RADIUS);
|
||
|
|
||
|
echo '<h2>Annonces à '. RADIUS . ' autour de '. $_SESSION['city'] .'</h2>';
|
||
|
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>
|
||
|
('. $offer->_source->city . ')
|
||
|
</li>
|
||
|
|
||
|
';
|
||
|
}
|
||
|
echo '</ol>';
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$offers = $gchange->getShippable();
|
||
|
|
||
|
echo '<h2>Envoi possible</h2>';
|
||
|
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>Annonces d\'ordre "immatériel"</h2>';
|
||
|
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>';
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
include('footer.php');
|
||
|
|
||
|
|
||
|
|