bug 288 : fixed, ordre des criteres de tri
authorPascal Corpet <pascal.corpet@m4x.org>
Tue, 8 Feb 2005 20:38:30 +0000 (20:38 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:07 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-461

include/search.inc.php

index 5402510..271bab1 100644 (file)
@@ -33,9 +33,9 @@ class XOrgSearch extends XOrgPlugin
     var $order_defaut = 'promo';
     // type of orders : (field name, default ASC, text name, auth)
     var $orders = array(
-            'promo'     =>array('promo',  false, 'promotion',             AUTH_PUBLIC),
             'nom'       =>array('nom,prenom',   true,  'nom',             AUTH_PUBLIC),
-            'date_mod'  =>array('u.date', false, 'dernière modification', AUTH_COOKIE)
+            'promo'     =>array('promo,nom',  false, 'promotion',             AUTH_PUBLIC),
+            'date_mod'  =>array('u.date,nom', false, 'dernière modification', AUTH_COOKIE)
         );
 
     // }}}
@@ -65,8 +65,12 @@ class XOrgSearch extends XOrgPlugin
 
     function addOrder($name, $field, $inv_order, $text, $auth, $defaut=false)
     {
+        // reverse the array, to get the defaut order first
+        if ($defaut)
+            $this->orders = array_reverse($this->orders);
         $this->orders[$name] = array($field, $inv_order, $text, $auth);
         if ($defaut) {
+            $this->orders = array_reverse($this->orders);
             $this->order_defaut = $name;
         }
     }