X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2Ftrombi.php;h=31aa528c4a06279f31bd849912f3d11b9c7de23d;hb=c15afc4e9844238cab4173022b3ef40d0dc9585d;hp=1f688f3b5286e9d17dc1f5bb638b7ae423047910;hpb=f8058a738ee912cb780989e720a4d4cd93acef65;p=platal.git diff --git a/classes/trombi.php b/classes/trombi.php index 1f688f3..31aa528 100644 --- a/classes/trombi.php +++ b/classes/trombi.php @@ -1,6 +1,6 @@ _get_vars = array('offset'); + parent::__construct($funcname, $prefix); + } + + public function setNbRows($row) { $this->limit = $row*3; } - function setAdmin() + public function setAdmin() { $this->admin = true; } - function hidePromo() + public function hidePromo() { $this->showpromo = false; } - function show() + public function show() { - /* this point is nasty... but since show() is called from the template ... - * I can't see any more clever way to achieve that - */ - global $page; + /* this point is nasty... but since show() is called from the template ... + * I can't see any more clever way to achieve that + */ + global $page; - $offset = intval($this->get_value('offset')); - list($total, $list) = call_user_func($this->_callback, $offset, $this->limit); - $page_max = intval(($total-1)/$this->limit); + $offset = intval($this->get_value('offset')); + list($total, $list) = call_user_func($this->_callback, $offset, $this->limit); + $page_max = intval(($total-1)/$this->limit); - $links = Array(); - if ($offset) { - $links[] = Array('u'=> $this->make_url($offset-1), 'i' => $offset-1, 'text' => 'précédent'); - } - for ($i = 0; $i <= $page_max ; $i++) { - $links[] = Array('u'=>$this->make_url($i), 'i' => $i, 'text' => $i+1); + $links = Array(); + if ($offset) { + $links[] = Array('u'=> $this->make_url($offset-1), 'i' => $offset-1, 'text' => 'précédent'); + } + for ($i = 0; $i <= $page_max ; $i++) { + $links[] = Array('u'=>$this->make_url($i), 'i' => $i, 'text' => $i+1); + } + if ($offset < $page_max) { + $links[] = Array ('u' => $this->make_url($offset+1), 'i' => $offset+1, 'text' => 'suivant'); } - if ($offset < $page_max) { - $links[] = Array ('u' => $this->make_url($offset+1), 'i' => $offset+1, 'text' => 'suivant'); - } - $page->assign_by_ref('trombi_show_promo', $this->showpromo); - $page->assign_by_ref('trombi_list', $list); - $page->assign_by_ref('trombi_links', $links); - $page->assign('trombi_admin', $this->admin); - return $page->fetch('include/trombi.tpl'); + $page->assign_by_ref('trombi_show_promo', $this->showpromo); + $page->assign_by_ref('trombi_list', $list); + $page->assign_by_ref('trombi_links', $links); + $page->assign('trombi_admin', $this->admin); + return $page->fetch('include/trombi.tpl'); } } -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>