Continue #448: fix search and order with PlSet
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 2 Apr 2007 16:14:10 +0000 (16:14 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 2 Apr 2007 16:14:10 +0000 (16:14 +0000)
Finish job on xnet perms

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1655 839d8a87-29fc-0310-9880-83ba4fa771e5

17 files changed:
classes/plset.php
htdocs/images/icons/null.gif [new file with mode: 0644]
htdocs/images/icons/resultset_first.gif [new file with mode: 0644]
htdocs/images/icons/resultset_last.gif [new file with mode: 0644]
include/userset.inc.php
include/xnet.inc.php
include/xnet/session.inc.php
include/xorg.inc.php
modules/search.php
modules/search/classes.inc.php
modules/xnetgrp.php
templates/core/plset.tpl
templates/geoloc/country.tpl
templates/geoloc/init.tpl
templates/include/plview.geoloc.tpl
templates/include/plview.multipage.tpl
templates/search/quick.form.tpl

index d2267d0..aa5bfa6 100644 (file)
@@ -86,6 +86,27 @@ class PlSet
         return $it;
     }
 
+    public function args()
+    {
+        $get = $_GET;
+        unset($get['n']);
+        return $get;
+    }
+
+    protected function encodeArgs(array $args, $encode = false)
+    {
+        $qs = '?';
+        $sep = $encode ? '&' : '&amp;';
+        foreach ($args as $k=>$v) {
+            if (!$encode) {
+                $k = urlencode($k);
+                $v = urlencode($v);
+            }
+            $qs .= "$k=$v$sep";
+        }
+        return $encode ? urlencode($qs) : $qs;
+    }
+
     public function &get($fields, $joins, $where, $groupby, $order, $limitcount = null, $limitfrom = null)
     {
         if (!is_null($limitcount)) {
@@ -138,10 +159,13 @@ class PlSet
         if (is_null($view)) {
             return false;
         }
+        $args = $view->args();
         $page->changeTpl('core/plset.tpl');
         $page->assign('plset_base', $baseurl);
         $page->assign('plset_mods', $this->mods);
         $page->assign('plset_mod', $this->mod);
+        $page->assign('plset_search', $this->encodeArgs($args));
+        $page->assign('plset_search_enc', $this->encodeArgs($args, true));
         foreach ($this->modParams[$this->mod] as $param=>$value) {
             $page->assign($this->mod . '_' . $param, $value);
         }
@@ -155,6 +179,7 @@ interface PlView
 {
     public function __construct(PlSet &$set, $data, array $params);
     public function apply(PlatalPage &$page);
+    public function args();
 }
 
 abstract class MultipageView implements PlView
@@ -165,10 +190,12 @@ abstract class MultipageView implements PlView
     public $page   = 1;
     public $offset = 0;
 
-    protected $order  = array();
     protected $entriesPerPage = 20;
     protected $params = array();
 
+    protected $sortkeys = array();
+    protected $defaultkey = null;
+
     public function __construct(PlSet &$set, $data, array $params)
     {
         $this->set   =& $set;
@@ -192,20 +219,41 @@ abstract class MultipageView implements PlView
         return null;
     }
 
+    protected function addSortKey($name, array $keys, $desc, $default = false)
+    {
+        $this->sortkeys[$name] = array('keys' => $keys, 'desc' => $desc);
+        if (!$this->defaultkey || $default) {
+            $this->defaultkey = $name;
+        }
+    }
+
     public function order()
     {
-        foreach ($this->order as &$item) {
-            if ($item{0} == '-') {
-                $item = substr($item, 1) . ' DESC';
+        $order = Env::v('order', $this->defaultkey);
+        $invert = ($order{0} == '-');
+        if ($invert) {
+            $order = substr($order, 1);
+        }
+        $list = array();
+        foreach ($this->sortkeys[$order]['keys'] as $item) {
+            $desc = ($item{0} == '-');
+            if ($desc) {
+                $item = substr($item, 1);
             }
+            if ($desc xor $invert) {
+                $item .= ' DESC';
+            }
+            $list[] = $item;
         }
-        return implode(', ', $this->order);
+        return implode(', ', $list);
     }
 
     abstract public function templateName();
 
     public function apply(PlatalPage &$page)
     {
+        $page->assign('order', Env::v('order', $this->defaultkey));
+        $page->assign('orders', $this->sortkeys);
         $page->assign_by_ref('plview', $this);
         $page->assign_by_ref('set',
                              $this->set->get($this->fields(),
@@ -217,9 +265,16 @@ abstract class MultipageView implements PlView
                                              $this->offset));
         $count = $this->set->count();
         $this->pages = intval(ceil($count / $this->entriesPerPage));
-
         return 'include/plview.multipage.tpl';
     }
+
+    public function args()
+    {
+        $list = $this->set->args();
+        unset($list['page']);
+        unset($list['order']);
+        return $list;
+    } 
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
diff --git a/htdocs/images/icons/null.gif b/htdocs/images/icons/null.gif
new file mode 100644 (file)
index 0000000..4682c24
Binary files /dev/null and b/htdocs/images/icons/null.gif differ
diff --git a/htdocs/images/icons/resultset_first.gif b/htdocs/images/icons/resultset_first.gif
new file mode 100644 (file)
index 0000000..f0830ee
Binary files /dev/null and b/htdocs/images/icons/resultset_first.gif differ
diff --git a/htdocs/images/icons/resultset_last.gif b/htdocs/images/icons/resultset_last.gif
new file mode 100644 (file)
index 0000000..752b4e1
Binary files /dev/null and b/htdocs/images/icons/resultset_last.gif differ
index db56b4c..bdfb90a 100644 (file)
@@ -24,7 +24,7 @@ require_once('user.func.inc.php');
 
 global $globals;
 
-$globals->search->result_where_statement = '
+@$globals->search->result_where_statement = '
     LEFT JOIN  applis_ins     AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
     LEFT JOIN  applis_def     AS ad0 ON (ad0.id = ai0.aid)
     LEFT JOIN  applis_ins     AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
@@ -57,6 +57,7 @@ class UserSet extends PlSet
 
 class SearchSet extends UserSet
 {
+    private $score = null;
     private $order = null;
     private $quick = false;
 
@@ -88,7 +89,9 @@ class SearchSet extends UserSet
         if ($qSearch->isEmpty()) {
             new ThrowError('Recherche trop générale.');
         }
-        parent::__construct($fields->get_select_statement()  . ' ' . $globals->search->result_where_statement,
+        $this->score = $qSearch->get_score_statement();
+        parent::__construct("{$fields->get_select_statement()}
+                             {$globals->search->result_where_statement}",
                             $fields->get_where_statement() .
                             (S::logged() && Env::has('nonins') ? ' AND u.perms="pending" AND u.deces=0' : ''));
 
@@ -108,6 +111,14 @@ class SearchSet extends UserSet
         $this->order = implode(',',array_filter(array($fields->get_order_statement(),
                                                       'promo DESC, NomSortKey, prenom')));
     }
+
+    public function &get($fields, $joins, $where, $groupby, $order, $limitcount = null, $limitfrom = null)
+    {
+        if ($this->score) {
+            $fields .= ', ' . $this->score;
+        }
+        return parent::get($fields, $joins, $where, $groupby, $order, $limitcount, $limitfrom);
+    }
 }
 
 class MinificheView extends MultipageView
@@ -117,7 +128,12 @@ class MinificheView extends MultipageView
         require_once 'applis.func.inc.php';
         global $globals;
         $this->entriesPerPage = $globals->search->per_page;
-        $this->order = explode(',', Env::v('order', 'nom,prenom,promo'));
+        if (@$params['with_score']) {
+            $this->addSortKey('score', array('-score', '-watch_last', '-promo', 'nom', 'prenom'), 'pertinence');
+        }
+        $this->addSortKey('name', array('nom', 'prenom'), 'nom');
+        $this->addSortKey('promo', array('-promo', 'nom', 'prenom'), 'promotion');
+        $this->addSortKey('date', array('-watch_last', '-promo', 'nom', 'prenom'), 'dernière modification');
         parent::__construct($set, $data, $params);
     }
 
@@ -171,6 +187,12 @@ class TrombiView extends MultipageView
     {
         $this->entriesPerPage = 24;
         $this->order = explode(',', Env::v('order', 'nom,prenom,promo'));
+        if (@$params['with_score']) {
+            $this->addSortKey('score', array('-score', '-watch_last', '-promo', 'nom', 'prenom'), 'pertinence');
+        }
+        $this->addSortKey('name', array('nom', 'prenom'), 'nom');
+        $this->addSortKey('promo', array('-promo', 'nom', 'prenom'), 'promotion');
+        $this->addSortKey('date', array('-watch_last', '-promo', 'nom', 'prenom'), 'dernière modification');
         parent::__construct($set, $data, $params);
     }
 
@@ -218,19 +240,12 @@ class GeolocView implements PlView
                is_file(dirname(__FILE__) . '/../modules/geoloc/icon.swf');
     }
 
-    private function make_qs($urlencode = true)
+    public function args()
     {
-        $qs = "";
-        foreach ($_GET as $v=>$a) {
-            if ($v != 'initfile' && $v != 'n' && $v != 'mapid') {
-                if (!$urlencode) {
-                    $qs .= $v . '=' . $a . '&';
-                } else { 
-                    $qs .= urlencode($v) . '=' . urlencode($a) . '&amp;';
-                }
-            }
-        }
-        return $qs;
+        $args = $this->set->args();
+        unset($args['initfile']);
+        unset($args['mapid']);
+        return $args;
     }
 
     public function apply(PlatalPage &$page)
@@ -258,7 +273,6 @@ class GeolocView implements PlView
             if (!empty($GLOBALS['IS_XNET_SITE'])) {
                 $page->assign('background', 0xF2E9D0);
             }
-            $page->assign('querystring', $this->make_qs()); 
             break;
 
           case 'city':
@@ -282,8 +296,6 @@ class GeolocView implements PlView
                 header('Content-Type: text/xml');
                 header('Pragma:');
             }
-            $querystring = $this->make_qs();
-            $page->assign('searchvars', $querystring);
             $mapid = Env::has('mapid') ? Env::i('mapid', -2) : false;
             list($countries, $cities) = geoloc_getData_subcountries($mapid, $this->set, 10);
             $page->assign('countries', $countries);
@@ -300,9 +312,6 @@ class GeolocView implements PlView
             }
             $page->assign('protocole', @$_SERVER['HTTPS'] ? 'https' : 'http');
             $this->set->get('u.user_id', null, "u.perms != 'pending' AND u.deces = 0", "u.user_id", null);
-            $url = '?' . $this->make_qs(false);
-            $page->assign('search_nourlencode', $url);
-            $page->assign('search', urlencode($url));
             return 'include/plview.geoloc.tpl';
         }
     }
index d2104e0..8e13153 100644 (file)
@@ -25,35 +25,16 @@ require_once('xnet/session.inc.php');
 $globals = new PlatalGlobals('XnetSession');
 XnetSession::init();
 
-// {{{ function new_skinned_page()
-
-function new_skinned_page($tpl_name, $refuse_access = false)
+function new_skinned_page($tpl_name)
 {
-    global $page, $globals;
+    global $page;
     require_once("xnet/page.inc.php");
     if (!$page instanceof XnetPage) {
-        $page = new XnetPage($tpl_name, $type);
+        $page = new XnetPage($tpl_name);
     } else {
-        $page->changeTpl($tpl_name, $type);
-    }
-    if ($refuse_access) {
-        $page->kill("Vous n'avez pas les droits suffisants pour accéder à cette page");
+        $page->changeTpl($tpl_name);
     }
 }
 
-// }}}
-// {{{ function new_annu_page()
-
-function new_annu_page($tpl_name)
-{
-    global $globals;
-    new_skinned_page($tpl_name, 
-                     !may_update()
-                     && (!is_member()  || $globals->asso('pub') != 'public')
-                     && $globals->asso('cat') != 'Promotions');
-}
-
-// }}}
-
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index f319d80..3fbeac4 100644 (file)
@@ -47,12 +47,20 @@ class XnetSession
             $perms = S::v('perms');
             $perms->rmFlag('groupadmin');
             $perms->rmFlag('groupmember');
+            $perms->rmFlag('groupannu');
             if (may_update()) {
                 $perms->addFlag('groupadmin');
                 $perms->addFlag('groupmember');
+                $perms->addFlag('groupannu');
             }
             if (is_member()) {
                 $perms->addFlag('groupmember');
+                if ($globals->asso('pub') == 'public') {
+                    $perms->addFlag('groupannu');
+                }
+            }
+            if ($globals->asso('cat') == 'Promotions') {
+                $perms->addFlag('groupannu');
             }
             $_SESSION['perms'] = $perms;
         }
index 6aa6cbf..62bfbe8 100644 (file)
@@ -53,9 +53,9 @@ function new_skinned_page($tpl_name)
 {
     global $page;
     if (!$page instanceof XorgPage) {
-        $page = new XorgPage($tpl_name, $type);
+        $page = new XorgPage($tpl_name);
     } else {
-        $page->changeTpl($tpl_name, $type);
+        $page->changeTpl($tpl_name);
     }
 }
 
index 2847322..bcb6423 100644 (file)
@@ -90,9 +90,11 @@ class SearchModule extends PLModule
 
             require_once 'userset.inc.php';
             $view = new SearchSet(true, $action == 'geoloc' && substr($subaction, -3) == 'swf');
-            $view->addMod('minifiche', 'Minifiches', true);
-            $view->addMod('trombi', 'Trombinoscope');
-            $view->addMod('geoloc', 'Planishpère');
+            $view->addMod('minifiche', 'Minifiches', true, array('with_score' => true));
+            if (S::logged() && !Env::i('nonins')) {
+                $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true, 'with_score' => true));
+                $view->addMod('geoloc', 'Planisphère');
+            }
             $view->apply('search', $page, $action, $subaction);
 
             $nb_tot = $view->count();
@@ -133,7 +135,7 @@ class SearchModule extends PLModule
             require_once 'userset.inc.php';
             $view = new SearchSet(false, $action == 'geoloc' && substr($subaction, -3) == 'swf');
             $view->addMod('minifiche', 'Minifiches', true);
-            $view->addMod('trombi', 'Trombinoscope');
+            $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true));
             $view->addMod('geoloc', 'Planishpère');
             $view->apply('search', $page, $action, $subaction);
             
index c0110eb..9f788a9 100644 (file)
@@ -23,7 +23,7 @@ require_once("xorg.misc.inc.php");
 
 // {{{ Global variables used for the search Queries
 
-$globals->search->result_fields = '
+@$globals->search->result_fields = '
     u.user_id, u.promo, u.matricule, u.matricule_ax,
     if(u.nom_usage=\'\', u.nom, u.nom_usage) AS NomSortKey,
     u.nom_usage,u.date,
@@ -54,7 +54,7 @@ else
         IF(adr.pub='public', gp.pays, '') AS countrytxt,
         IF(adr.pub='public', gr.name, '') AS region,
         IF(e.pub='public', e.entreprise, '') AS entreprise,";
-$globals->search->result_where_statement = '
+@$globals->search->result_where_statement = '
     LEFT JOIN  applis_ins     AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
     LEFT JOIN  applis_def     AS ad0 ON (ad0.id = ai0.aid)
     LEFT JOIN  applis_ins     AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
index bbb557a..9049d47 100644 (file)
@@ -80,16 +80,16 @@ class XnetGrpModule extends PLModule
             '%grp/edit'           => $this->make_hook('edit',      AUTH_MDP, 'groupadmin'),
             '%grp/mail'           => $this->make_hook('mail',      AUTH_MDP, 'groupadmin'),
             '%grp/forum'          => $this->make_hook('forum',     AUTH_MDP, 'groupmember'),
-            '%grp/annuaire'       => $this->make_hook('annuaire',  AUTH_MDP),
-            '%grp/annuaire/vcard' => $this->make_hook('vcard',     AUTH_MDP),
-            '%grp/trombi'         => $this->make_hook('trombi',    AUTH_MDP),
+            '%grp/annuaire'       => $this->make_hook('annuaire',  AUTH_MDP, 'groupannu'),
+            '%grp/annuaire/vcard' => $this->make_hook('vcard',     AUTH_MDP, 'groupmember:groupannu'),
+            '%grp/trombi'         => $this->make_hook('trombi',    AUTH_MDP, 'groupannu'),
             '%grp/subscribe'      => $this->make_hook('subscribe', AUTH_MDP),
             '%grp/unsubscribe'    => $this->make_hook('unsubscribe', AUTH_MDP, 'groupmember'),
 
             '%grp/change_rights'  => $this->make_hook('change_rights', AUTH_MDP),
 
             '%grp/admin/annuaire'
-                 => $this->make_hook('admin_annuaire', AUTH_MDP),
+                 => $this->make_hook('admin_annuaire', AUTH_MDP, 'groupadmin'),
 
             '%grp/member'
                  => $this->make_hook('admin_member', AUTH_MDP, 'groupadmin'),
@@ -326,7 +326,7 @@ class XnetGrpModule extends PLModule
     function handler_annuaire(&$page)
     {
         global $globals;
-        new_annu_page('xnetgrp/annuaire.tpl');
+        $page->changeTpl('xnetgrp/annuaire.tpl');
 
         $sort = Env::v('order');
         switch (Env::v('order')) {
@@ -436,16 +436,11 @@ class XnetGrpModule extends PLModule
     function handler_vcard(&$page, $photos = null)
     {
         global $globals;
-
-        if (($globals->asso('pub') == 'public' && is_member()) || may_update()) {
-            $res = XDB::query('SELECT uid
-                                 FROM groupex.membres
-                                WHERE asso_id = {?}', $globals->asso('id'));
-            $vcard = new VCard($res->fetchColumn(), $photos == 'photos', 'Membre du groupe ' . $globals->asso('nom'));
-            $vcard->do_page($page);
-        } else {
-            return PL_FORBIDDEN;
-        }
+        $res = XDB::query('SELECT  uid
+                             FROM  groupex.membres
+                            WHERE  asso_id = {?}', $globals->asso('id'));
+        $vcard = new VCard($res->fetchColumn(), $photos == 'photos', 'Membre du groupe ' . $globals->asso('nom'));
+        $vcard->do_page($page);
     }
 
     function handler_subscribe(&$page, $u = null)
index ef12a7a..c33621f 100644 (file)
@@ -35,7 +35,7 @@
   {if $plset_mods|@count > 1}[
   {foreach from=$plset_mods key=mod item=desc name=mods}
     {if $mod neq $plset_mod}
-    <a href="{$plset_base}/{$mod}">{$desc}</a> {if !$smarty.foreach.mods.last}| {/if}
+    <a href="{$plset_base}/{$mod}{$plset_search}">{$desc}</a> {if !$smarty.foreach.mods.last}| {/if}
     {/if}
   {/foreach}
   ]
@@ -43,6 +43,8 @@
 </h1>
 </div>
 
+<div id="plset_content" style="clear: both">
 {include file=$plset_content}
+</div>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 1201862..809add5 100644 (file)
@@ -30,7 +30,7 @@
       {if $country.nbPop > 0 or $country.id eq 0}\r
       <map x="{$country.x}" y="{$country.y}" height="{$country.height}" width="{$country.width}" ratio="{$country.rat}"/>\r
       <icon x="{$country.xPop}" y="{$country.yPop}" nb="{$country.nbPop}" size="{$country.rad}" name="{$country.name}" green="{if $country.nbPop}{$country.yellow/$country.nbPop}{else}0{/if}" blue="0" alpha="0.7"/>\r
-      <moreinfos url="country?{$searchvars}mapid={$country.id}"/>\r
+      <moreinfos url="country{$plset_search}mapid={$country.id}"/>\r
       {/if}\r
     </country>\r
     {/foreach}\r
@@ -39,7 +39,7 @@
     {foreach from=$cities item="city"}\r
     <city id="{$city.id}" name="{$city.name}">\r
       <icon x="{$city.x}" y="{$city.y}" nb="{$city.pop}" size="{$city.size}" name="{$city.name}" green="{if $city.pop}{$city.yellow/$city.pop}{else}0{/if}" blue="0"/>\r
-      <moreinfos url="city?{$searchvars}cityid={$city.id}"/>\r
+      <moreinfos url="city{$plset_search}cityid={$city.id}"/>\r
     </city>\r
     {/foreach}\r
   </cities>\r
index 7cb6d85..dfc34a8 100644 (file)
@@ -46,5 +46,5 @@ zoomBarBackgroundColor="{$background}"
 textCopyright="Les règles de l'annuaire s'appliquent aussi à cette application"
 autofolder="true"
 iconSwf="icon.swf"
-scriptInfosArea="country?{$querystring}"/>
+scriptInfosArea="country{$plset_search}"/>
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 2c6bc57..593598c 100644 (file)
@@ -60,7 +60,7 @@ function searchMapId(f)
   
   {if $smarty.request.only_current neq 'on'}
   <p class="center">
-    [<a href="{$platal->ns}{$plset_base}/geoloc{$search_nourlencode|smarty:nodefaults}&amp;only_current=on">Ne voir que les adresses principales</a>]
+    [<a href="{$platal->ns}{$plset_base}/geoloc{$plset_search}only_current=on">Ne voir que les adresses principales</a>]
   </p>
   {/if}
   
@@ -75,7 +75,7 @@ function searchMapId(f)
       <param name="bgcolor" value="#ffffff"/>
       <param name="wmode" value="opaque"/>
       <param name="quality" value="high"/>
-      <param name="flashvars" value="initfile={$platal->ns|urlencode}{$plset_base|urlencode}%2Fgeoloc%2Finit{$search|smarty:nodefaults}"/>
+      <param name="flashvars" value="initfile={$platal->ns|urlencode}{$plset_base|urlencode}%2Fgeoloc%2Finit{$plset_search_enc}"/>
       <embed
         src="{$platal->ns}{$plset_base}/geoloc/dynamap.swf"
         quality="high"
@@ -85,7 +85,7 @@ function searchMapId(f)
         name="dynamap"
         id="dynamap"
         align="middle"
-        flashvars="initfile={$platal->ns|urlencode}{$plset_base|urlencode}%2Fgeoloc%2Finit{$search|smarty:nodefaults}"
+        flashvars="initfile={$platal->ns|urlencode}{$plset_base|urlencode}%2Fgeoloc%2Finit{$plset_search_enc}"
         type="application/x-shockwave-flash"
         menu="false"
         wmode="opaque"
index f273327..e8bd8ff 100644 (file)
 {if $plview->pages > 1}
 <div class="center pages">
   {if $plview->page neq 1}
-  <a href="{$platal->pl_self()}?page=1">&lt;&lt;</a>
-  <a href="{$platal->pl_self()}?page={$plview->page-1}">&lt;</a>
+  <a href="{$platal->pl_self()}{$plset_search}order={$order}&amp;page=1">{icon name=resultset_first title="Première page"}</a>{*
+  *}<a href="{$platal->pl_self()}{$plset_search}order={$order}&amp;page={$plview->page-1}">{icon name=resultset_previous title="Page précédente"}</a>
+  {else}
+  {icon name=null title=""}{icon name=null title=""}
   {/if}
   {section name=page loop=$plview->pages+1 start=1}
   {if $smarty.section.page.index eq $plview->page}
   <span style="color: red">{$plview->page}</span> 
   {else}
-  <a href="{$platal->pl_self()}?page={$smarty.section.page.index}">{$smarty.section.page.index}</a>
+  <a href="{$platal->pl_self()}{$plset_search}order={$order}&amp;page={$smarty.section.page.index}">{$smarty.section.page.index}</a>
   {/if}
   {/section}
   {if $plview->page neq $plview->pages}
-  <a href="{$platal->pl_self()}?page={$plview->page+1}">&gt;</a>
-  <a href="{$platal->pl_self()}?page={$plview->pages}">&gt;&gt;</a>
+  <a href="{$platal->pl_self()}{$plset_search}order={$order}&amp;page={$plview->page+1}">{icon name=resultset_next title="Page suivante"}</a>{*
+  *}<a href="{$platal->pl_self()}{$plset_search}order={$order}&amp;page={$plview->pages}">{icon name=resultset_last title="Dernière page"}</a>
+  {else}
+  {icon name=null title=""}{icon name=null title=""}
   {/if}
 </div>
 {/if}
 {/capture}
 
+{capture name=order}
+{if $plset_count > 1}
+<div>
+  Trier par :
+  {foreach from=$orders key=name item=sort}
+  [
+  {if $name eq $order}
+  <img src='images/dn.png' alt='tri ascendant' />
+  <a href="{$platal->pl_self()}{$plset_search}order=-{$name}">{$sort.desc}</a>
+  {elseif $order eq "-$name"}
+  <img src='images/up.png' alt='tri ascendant' />
+  <a href="{$platal->pl_self()}{$plset_search}order={$name}">{$sort.desc}</a>
+  {else}
+  <a href="{$platal->pl_self()}{$plset_search}order={$name}">{$sort.desc}</a>
+  {/if}
+  ]&nbsp;
+  {/foreach}
+</div>
+{/if}
+{/capture}
+
+
 {$smarty.capture.pages|smarty:nodefaults}
 
+{$smarty.capture.order|smarty:nodefaults}
+
 <div id="multipage_content" style="padding: 0.5em 0">
   {include file=$plview->templateName()}
 </div>
 
+{$smarty.capture.order|smarty:nodefaults}
+
 {$smarty.capture.pages|smarty:nodefaults}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 4bdf86b..9231222 100644 (file)
@@ -39,7 +39,7 @@
       <td style="width: 78%">
         <input type="checkbox" name="with_soundex" value="1" {if $smarty.request.with_soundex}checked="checked"{/if} /> Activer la recherche par proximité sonore
         <br /><input type='checkbox' name='order' value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} /> Mettre les fiches modifiées récemment en premier
-        <br /><input type='checkbox' name='nonins' readonly="readonly" {if $smarty.request.noins}checked='checked'{/if} value='1' /> Chercher uniquement des non inscrits
+        <br /><input type='checkbox' name='nonins' readonly="readonly" {if $smarty.request.nonins}checked='checked'{/if} value='1' /> Chercher uniquement des non inscrits
       </td>
     {else}
     <tr class="noprint">