X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fgeoloc.php;h=d9d73585f5ee6a1bfce48c678edf18f8cd72f96d;hb=baa62e58cdfb6839040e156ef91e2827bdde1600;hp=0336637a494a7f6fb6db63db0d0b399f82537448;hpb=90ccb0625d5bdeafaf852ab5c9fb25ef230778b2;p=platal.git diff --git a/modules/geoloc.php b/modules/geoloc.php index 0336637..d9d7358 100644 --- a/modules/geoloc.php +++ b/modules/geoloc.php @@ -25,7 +25,6 @@ class GeolocModule extends PLModule { return array( 'geoloc' => $this->make_hook('default', AUTH_COOKIE), - '%grp/geoloc' => $this->make_hook('default',AUTH_COOKIE), 'admin/geoloc' => $this->make_hook('admin', AUTH_MDP, 'admin'), 'admin/geoloc/dynamap' => $this->make_hook('admin_dynamap', AUTH_MDP, 'admin'), ); @@ -44,28 +43,28 @@ class GeolocModule extends PLModule $page->changeTpl('geoloc/admin.tpl'); require_once("geoloc.inc.php"); $page->assign('xorg_title','Polytechnique.org - Administration - Geolocalisation'); - + $nb_synchro = 0; - + if (Env::has('id') && is_numeric(Env::v('id'))) { if (synchro_city(Env::v('id'))) $nb_synchro ++; } - + if ($action == 'missinglat') { $res = XDB::iterRow("SELECT id FROM geoloc_city WHERE lat = 0 AND lon = 0"); while ($a = $res->next()) if (synchro_city($a[0])) $nb_synchro++; } - - if ($nb_synchro) + + if ($nb_synchro) $page->trig(($nb_synchro > 1)?($nb_synchro." villes ont été synchronisées"):"Une ville a été synchronisée"); - + $res = XDB::query("SELECT COUNT(*) FROM geoloc_city WHERE lat = 0 AND lon = 0"); $page->assign("nb_missinglat", $res->fetchOneCell()); } - + function handler_admin_dynamap(&$page, $action = false) { $page->changeTpl('geoloc/admin_dynamap.tpl'); - + if ($action == 'cities_not_on_map') { require_once('geoloc.inc.php'); if (!fix_cities_not_on_map(20)) @@ -73,31 +72,31 @@ class GeolocModule extends PLModule else $refresh = true; } - + if ($action == 'smallest_maps') { require_once('geoloc.inc.php'); set_smallest_levels(); } - + if ($action == 'precise_coordinates') { XDB::execute("UPDATE adresses AS a INNER JOIN geoloc_city AS c ON(a.cityid = c.id) SET a.glat = c.lat / 100000, a.glng = c.lon / 100000"); } - + if ($action == 'newmaps') { require_once('geoloc.inc.php'); if (!get_new_maps(Env::v('url'))) $page->trig("Impossible d'accéder aux nouvelles cartes"); } - + $countMissing = XDB::query("SELECT COUNT(*) FROM geoloc_city AS c LEFT JOIN geoloc_city_in_maps AS m ON(c.id = m.city_id) WHERE m.city_id IS NULL"); $missing = $countMissing->fetchOneCell(); - + $countNoSmallest = XDB::query("SELECT SUM(IF(infos = 'smallest',1,0)) AS n FROM geoloc_city_in_maps GROUP BY city_id ORDER BY n"); $noSmallest = $countNoSmallest->fetchOneCell() == 0; - + $countNoCoordinates = XDB::query("SELECT COUNT(*) FROM adresses WHERE cityid IS NOT NULL AND glat = 0 AND glng = 0"); $noCoordinates = $countNoCoordinates->fetchOneCell(); - + if (isset($refresh) && $missing) { $page->assign("xorg_extra_header", ""); } @@ -105,7 +104,7 @@ class GeolocModule extends PLModule $page->assign("no_smallest", $noSmallest); $page->assign("no_coordinates", $noCoordinates); } - + } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: