[ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 <?php 2 /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 3 /* 4 # ***** BEGIN LICENSE BLOCK ***** 5 # This file is part of Plume CMS, a website management application. 6 # Copyright (C) 2001-2005 Loic d'Anterroches and contributors. 7 # 8 # Plume CMS is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # Plume CMS is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 # 22 # ***** END LICENSE BLOCK ***** */ 23 24 require_once dirname(__FILE__).'/class.resourceset.php'; 25 26 /** 27 * paginator extends resourceset to provide pagination of 28 * a resourceset. 29 */ 30 class Paginator extends ResourceSet 31 { 32 /** 33 * Number of resources per page. 34 */ 35 var $res_per_page = 0; 36 37 /** 38 * Current page. 39 */ 40 var $current_page = 1; 41 42 /** 43 * Total number of pages. 44 */ 45 var $total_pages = 1; 46 47 /** 48 * Init the Paginator from an array. 49 * 50 * @param array Resource data ('') 51 * @param int Number of resource per page ('') 52 * @param int Current page number ('') 53 */ 54 function Paginator($data='', $res_per_page='', $current_page='') 55 { 56 parent::ResourceSet($data); 57 if ($res_per_page !== '') { 58 $this->res_per_page = $res_per_page; 59 } 60 if ($current_page != '') { 61 $this->current_page = $current_page; 62 } 63 if (!$this->isEmpty()) { 64 if ($this->res_per_page > 0) { 65 $this->move(($this->current_page-1) * $this->res_per_page); 66 } 67 } 68 } 69 70 /** 71 * End of file. Returns true at the end of the page. 72 * 73 * @return bool Is at the end of the page. 74 */ 75 function EOF() 76 { 77 return ($this->int_index == $this->int_row_count) 78 or ($this->int_index and ($this->int_index == $this->res_per_page * $this->current_page)); 79 } 80 81 } 82 83 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |