From e8e034fd9237000dba475f8ed890bc52115963d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Tue, 17 Aug 2010 00:11:19 +0200 Subject: [PATCH] Update doc for PlSet to explain 'arg' functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Rename the Smarty part of these for consistency. Signed-off-by: Raphaël Barrois --- classes/plset.php | 21 +++++++++++++-------- templates/plset.tpl | 2 +- templates/plview.multipage.tpl | 16 ++++++++-------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/classes/plset.php b/classes/plset.php index 41e73da..106c18a 100644 --- a/classes/plset.php +++ b/classes/plset.php @@ -137,7 +137,9 @@ abstract class PlSet return $it; } - /** XXX ?? + /** Return an array containing all pertinent parameters for this page + * Generated from $_GET, after some cleanup (remove 'n' (plat/al field + * for the handler path) */ public function args() { @@ -146,7 +148,9 @@ abstract class PlSet return $get; } - /** XXX? + /** Convert an array into an URL query (?foo=bar) + * @param $args An associative array to convert to a query string + * @param $encode Whether to url-encode the string */ protected function encodeArgs(array $args, $encode = false) { @@ -204,15 +208,12 @@ abstract class PlSet return false; } $args = $view->args(); - if (!isset($args['rechercher'])) { - $args['rechercher'] = 'Chercher'; - } $page->coreTpl('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)); + $page->assign('plset_args', $this->encodeArgs($args)); + $page->assign('plset_args_enc', $this->encodeArgs($args, true)); foreach ($this->modParams[$this->mod] as $param=>$value) { $page->assign($this->mod . '_' . $param, $value); } @@ -238,7 +239,8 @@ interface PlView */ public function apply(PlPage &$page); - /** XXX? + /** As PlSet->args(), returns the ?foo=bar part of the URL for generating + * this PlSet, after adding the necessary components and removing useless ones. */ public function args(); } @@ -393,6 +395,9 @@ abstract class MultipageView implements PlView return PlPage::getCoreTpl('plview.multipage.tpl'); } + /** Arguments are those needed by the set, minus 'page' and 'order' which + * will be set to new values in the html links. + */ public function args() { $list = $this->set->args(); diff --git a/templates/plset.tpl b/templates/plset.tpl index 4f13ada..08a3261 100644 --- a/templates/plset.tpl +++ b/templates/plset.tpl @@ -28,7 +28,7 @@ {foreach from=$plset_mods key=mod item=desc name=mods} {if $mod neq $plset_mod} {if $has_prev}| {/if} - {$desc} + {$desc} {assign var=has_prev value=true} {/if} {/foreach} diff --git a/templates/plview.multipage.tpl b/templates/plview.multipage.tpl index a03c7fc..49e6ae9 100644 --- a/templates/plview.multipage.tpl +++ b/templates/plview.multipage.tpl @@ -25,8 +25,8 @@ {if $show_bounds}
[{$first} - {$last}] 
{/if}
{if $plview->page neq 1} - {icon name=resultset_first title="Première page"}{* - *}{icon name=resultset_previous title="Page précédente"} + {icon name=resultset_first title="Première page"}{* + *}{icon name=resultset_previous title="Page précédente"} {else} {icon name=null title=""}{icon name=null title=""} {/if} @@ -34,12 +34,12 @@ {if $smarty.section.page.index eq $plview->page} {$plview->page} {else} - {$smarty.section.page.index} + {$smarty.section.page.index} {/if} {/section} {if $plview->page neq $plview->pages} - {icon name=resultset_next title="Page suivante"}{* - *}{icon name=resultset_last title="Dernière page"} + {icon name=resultset_next title="Page suivante"}{* + *}{icon name=resultset_last title="Dernière page"} {else} {icon name=null title=""}{icon name=null title=""} {/if} @@ -55,12 +55,12 @@ [ {if $name eq $order} tri ascendant - {$sort->displaytext} + {$sort->displaytext} {elseif $order eq "-$name"} tri ascendant - {$sort->displaytext} + {$sort->displaytext} {else} - {$sort->displaytext} + {$sort->displaytext} {/if} ]  {/foreach} -- 2.1.4