petite icone pour specifier le tri dans le table-editor
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 16 Oct 2006 13:01:38 +0000 (13:01 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 16 Oct 2006 13:01:38 +0000 (13:01 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@984 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/pltableeditor.php
templates/table-editor.tpl

index a2ea533..39eb9e7 100644 (file)
@@ -38,6 +38,7 @@ class PLTableEditor {
     var $nbfields;
     // the field for sorting entries
     var $sortfield;
+    var $sortdesc = false;
     // action to do to delete row:
        // null => delete effectively, false => no deletion, SQL
     var $delete_action;
@@ -221,6 +222,10 @@ class PLTableEditor {
             if (isset($this->sortfield)) {
                 // add this sort order after the others (chosen by dev)
                 $this->add_sort_field($this->sortfield);
+                if (substr($this->sortfield,-5) == ' DESC') {
+                    $this->sortfield = substr($this->sortfield,0,-5);
+                    $this->sortdesc = true;
+                }
             }
             if (count($this->sort) > 0) {
                 $sort = 'ORDER BY ' . join($this->sort, ',');
index df4100f..6040137 100644 (file)
@@ -34,7 +34,7 @@
 <table class="bicol">
 <tr>
   {foreach from=$t->vars item=myval key=myvar}{if $myval.display}
-    <th style="cursor:pointer" onclick="redirect('{$t->pl}/sort{if $t->sortfield eq $myvar}desc{/if}/{$myvar}')">{$myval.desc}</th>
+    <th style="cursor:pointer" onclick="redirect('{$t->pl}/sort{if $t->sortfield eq $myvar && !$t->sortdesc}desc{/if}/{$myvar}')">{$myval.desc}{if $t->sortfield eq $myvar}<img src="images/{if $t->sortdesc}up{else}dn{/if}.png"/>{/if}</th>
   {/if}{/foreach}
   {if !$hideactions}
   <th>action</th>