Fix Xnet's trombi, fix display of bound in trombi.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 11 Apr 2010 14:31:44 +0000 (16:31 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 11 Apr 2010 14:31:44 +0000 (16:31 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/userset.inc.php
modules/xnetgrp.php

index 92e041a..23a117e 100644 (file)
@@ -152,6 +152,23 @@ abstract class ProfileView extends MultipageView
         }
         return null;
     }
+
+    public function bounds()
+    {
+        $order = Env::v('order', $this->defaultkey);
+        $show_bounds = 0;
+        if (($order == "name") || ($order == "-name")) {
+            $this->bound_field = "name";
+            $show_bounds = 1;
+        } elseif (($order == "promo") || ($order == "-promo")) {
+            $this->bound_field = "promo";
+            $show_bounds = -1;
+        }
+        if ($order{0} == '-') {
+            $show_bounds = -$show_bounds;
+        }
+        return $show_bounds;
+    }
 }
 
 class MinificheView extends ProfileView
@@ -185,23 +202,6 @@ class MinificheView extends ProfileView
         parent::__construct($set, $data, $params);
     }
 
-    public function bounds()
-    {
-        $order = Env::v('order', $this->defaultkey);
-        $show_bounds = 0;
-        if (($order == "name") || ($order == "-name")) {
-            $this->bound_field = "name";
-            $show_bounds = 1;
-        } elseif (($order == "promo") || ($order == "-promo")) {
-            $this->bound_field = "promo";
-            $show_bounds = -1;
-        }
-        if ($order{0} == '-') {
-            $show_bounds = -$show_bounds;
-        }
-        return $show_bounds;
-    }
-
     public function templateName()
     {
         return 'include/plview.minifiche.tpl';
@@ -227,23 +227,6 @@ class MentorView extends ProfileView
         parent::__construct($set, $data, $params);
     }
 
-    public function bounds()
-    {
-        $order = Env::v('order', $this->defaultkey);
-        $show_bounds = 0;
-        if (($order == "name") || ($order == "-name")) {
-            $this->bound_field = "nom";
-            $show_bounds = 1;
-        } elseif (($order == "promo") || ($order == "-promo")) {
-            $this->bound_field = "promo";
-            $show_bounds = -1;
-        }
-        if ($order{0} == '-') {
-            $show_bounds = -$show_bounds;
-        }
-        return $show_bounds;
-    }
-
     public function templateName()
     {
         return 'include/plview.referent.tpl';
@@ -255,6 +238,7 @@ class TrombiView extends ProfileView
     public function __construct(PlSet &$set, $data, array $params)
     {
         $this->entriesPerPage = 24;
+        $this->defaultkey = 'name';
         if (@$params['with_score']) {
             $this->addSort(new PlViewOrder('score', array(
                             new UFO_Score(true),
@@ -263,32 +247,15 @@ class TrombiView extends ProfileView
                             new UFO_Name(Profile::DN_SORT),
             ), 'pertinence'));
         }
+        $set->addCond(new UFC_Photo());
         $this->addSort(new PlViewOrder('name', array(new UFO_Name(Profile::DN_SORT)), 'nom'));
         $this->addSort(new PlViewOrder('promo', array(
                         new UFO_Promo(UserFilter::DISPLAY, true),
                         new UFO_Name(Profile::DN_SORT),
                     ), 'promotion'));
-        $set->addCond(new UFC_Photo());
         parent::__construct($set, $data, $params);
     }
 
-    public function bounds()
-    {
-        $order = Env::v('order', $this->defaultkey);
-        $show_bounds = 0;
-        if (($order == "name") || ($order == "-name")) {
-            $this->bound_field = "nom";
-            $show_bounds = 1;
-        } elseif (($order == "promo") || ($order == "-promo")) {
-            $this->bound_field = "promo";
-            $show_bounds = -1;
-        }
-        if ($order{0} == '-') {
-            $show_bounds = -$show_bounds;
-        }
-        return $show_bounds;
-    }
-
     public function templateName()
     {
         return 'include/plview.trombi.tpl';
index 1f58fd5..3c8861a 100644 (file)
@@ -282,10 +282,7 @@ class XnetGrpModule extends PLModule
     {
         global $globals;
 
-        if ($action == 'search') {
-            http_redirect("https://www.polytechnique.org/search/adv?rechercher=Chercher&groupex={$globals->asso('id')}"
-                        . "&cityid=" . Env::v('cityid') . "&mapid=" . Env::v('mapid'));
-        } else if ($action == 'geoloc' || $action == 'trombi') {
+        if ($action == 'trombi') {
             __autoload('userset');
             if ($action == 'trombi') {
                 $view = new ProfileSet(new UFC_Group($globals->asso('id')));
@@ -293,15 +290,12 @@ class XnetGrpModule extends PLModule
                 $view = new UserSet(new UFC_Group($globals->asso('id')));
             }
             $view->addMod('trombi', 'Trombinoscope');
-            // TODO: Reactivate when the new map is completed.
-            // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'annuaire/search'));
             $view->apply('annuaire', $page, $action, $subaction);
-            if ($action == 'geoloc' && $subaction) {
-                return;
-            }
+            $page->changeTpl('xnetgrp/annuaire.tpl');
+            return;
         }
-        $page->changeTpl('xnetgrp/annuaire.tpl');
 
+        $page->changeTpl('xnetgrp/annuaire.tpl');
         $sort = Env::s('order', 'directory_name');
         $ofs  = Env::i('offset');
         if ($ofs < 0) {