protected $sortkeys = array();
protected $defaultkey = null;
+ protected $bound_field = null;
+
public function __construct(PlSet &$set, $data, array $params)
{
$this->set =& $set;
return null;
}
+ public function bounds()
+ {
+ return null;
+ }
+
protected function addSortKey($name, array $keys, $desc, $default = false)
{
$this->sortkeys[$name] = array('keys' => $keys, 'desc' => $desc);
$this->order(),
$this->entriesPerPage,
$this->offset);
- $order = Env::v('order', $this->defaultkey);
+ $show_bounds = $this->bounds();
$end = end($res);
- $show_bounds = 0;
- if (($order == "name") || ($order == "-name")) {
- $first = $res[0]['nom'];
- $last = $end['nom'];
- $show_bounds = 1;
- } elseif (($order == "promo") || ($order == "-promo")) {
- $first = $end['promo'];
- $last = $res[0]['promo'];
- $show_bounds = 1;
- }
- if (($show_bounds) && ($order{0} == '-')) {
- $aux = $first;
- $first = $last;
- $last = $aux;
+ if ($show_bounds) {
+ if ($show_bounds == 1) {
+ $first = $res[0][$this->bound_field];
+ $last = $end[$this->bound_field];
+ } elseif ($show_bounds == -1) {
+ $first = $end[$this->bound_field];
+ $last = $res[0][$this->bound_field];
+ }
+ $page->assign('first', $first);
+ $page->assign('last', $last);
}
- $page->assign('first', $first);
- $page->assign('last', $last);
$page->assign('show_bounds', $show_bounds);
- $page->assign('order', $order);
+ $page->assign('order', Env::v('order', $this->defaultkey));
$page->assign('orders', $this->sortkeys);
$page->assign_by_ref('plview', $this);
$page->assign_by_ref('set', $res);
: "");
}
+ 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.minifiche.tpl';
ms.secteur, ms.ss_secteur";
}
+ 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';
return "INNER JOIN photo AS p ON (p.uid = u.user_id) ";
}
+ 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';
{capture name=pages}
{if $plview->pages > 1}
<div class="center pages">
- {if $show_bounds}[{$first} - {$last}]{/if}
+ {if $show_bounds}<small><strong>[{$first} - {$last}] </strong></small>{/if}
{if $plview->page neq 1}
<a href="{$platal->pl_self()}{$plset_search}order={$order}&page=1">{icon name=resultset_first title="Première page"}</a>{*
*}<a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->page-1}">{icon name=resultset_previous title="Page précédente"}</a>
{**************************************************************************}
<div class="contact-list" style="clear: both">
-{iterate from=$set item=p}
+{foreach from=$set item=p}
<div class="contact">
<div class="nom">
{$p.nom} {$p.prenom}
</table>
</div>
</div>
-{/iterate}
+{/foreach}
</div>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
</p>
{else}
<table cellpadding="8" cellspacing="2" style="width: 100%">
- {iterate from=$set item=p}
+ {foreach from=$set item=p}
{cycle values="1,2,3" assign="loop"}
{if $loop eq "1"}
<tr>
{if $loop eq "3"}
</tr>
{/if}
- {/iterate}
+ {/foreach}
{if $loop neq "3"}
{if $lopp eq "1"}
<td></td>