limit = $row*3; } // }}} // {{{ function setAdmin() function setAdmin() { $this->admin = true; } // }}} // {{{ function hidePromo() function hidePromo() { $this->showpromo = false; } // }}} // {{{ function show() 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; $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); } 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'); } // }}} } // }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?>