Some alignments.
[platal.git] / modules / geoloc.php
index e276e1f..30ab573 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -24,8 +24,8 @@ class GeolocModule extends PLModule
     function handlers()
     {
         return array(
-            'geoloc'             => $this->make_hook('default', AUTH_COOKIE),
-            'admin/geoloc'           => $this->make_hook('admin', AUTH_MDP, 'admin'),
+            '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'),
         );
     }
@@ -36,13 +36,13 @@ class GeolocModule extends PLModule
 
         $set = new UserSet();
         $set->addMod('geoloc', 'Geolocalisation', true);
-        $set->apply('geoloc', $page, 'geoloc', $action);
+        $set->apply('geoloc', $page, $action, $subaction);
     }
 
     function handler_admin(&$page, $action = false) {
         $page->changeTpl('geoloc/admin.tpl');
         require_once("geoloc.inc.php");
-        $page->assign('xorg_title','Polytechnique.org - Administration - Geolocalisation');
+        $page->setTitle('Administration - Geolocalisation');
 
         $nb_synchro = 0;
 
@@ -56,7 +56,7 @@ class GeolocModule extends PLModule
         }
 
         if ($nb_synchro)
-            $page->trig(($nb_synchro > 1)?($nb_synchro." villes ont été synchronisées"):"Une ville a été synchronisée");
+            $page->trigSuccess(($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());
@@ -68,7 +68,7 @@ class GeolocModule extends PLModule
         if ($action == 'cities_not_on_map') {
             require_once('geoloc.inc.php');
             if (!fix_cities_not_on_map(20))
-                $page->trig("Impossible d'accéder au webservice");
+                $page->trigError("Impossible d'accéder au webservice");
             else
                 $refresh = true;
         }
@@ -79,13 +79,15 @@ class GeolocModule extends PLModule
         }
 
         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");
+            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");
+                $page->trigError("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");
@@ -98,7 +100,7 @@ class GeolocModule extends PLModule
         $noCoordinates = $countNoCoordinates->fetchOneCell();
 
         if (isset($refresh) && $missing) {
-            $page->assign("xorg_extra_header", "<meta http-equiv='Refresh' content='3'/>");
+            $page->assign("pl_extra_header", "<meta http-equiv='Refresh' content='3'/>");
         }
         $page->assign("nb_cities_not_on_map", $missing);
         $page->assign("no_smallest", $noSmallest);