diff options
author | Simon Rettberg | 2017-12-01 13:42:04 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-12-01 13:42:04 +0100 |
commit | 5393703f6e1485ddff94a50f63bcdd216ab629f4 (patch) | |
tree | ce2db7130302bd4fb78b170e1fbd75496a1b4510 /inc/pagination.inc.php | |
parent | Merge remote-tracking branch 'origin/permission-manager' into permission-manager (diff) | |
parent | [roomplanner] Sort already placed machines to the bottom (diff) | |
download | slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.gz slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.xz slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.zip |
Merge branch 'master' into permission-manager
Diffstat (limited to 'inc/pagination.inc.php')
-rw-r--r-- | inc/pagination.inc.php | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/inc/pagination.inc.php b/inc/pagination.inc.php deleted file mode 100644 index 65785a36..00000000 --- a/inc/pagination.inc.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/** - * TODO: Why does this class exist? - * There's already the Paginate class which works more efficient by using the LIMIT statement - * for the query, and has more options. Consider refactoring the places where this class is - * used (see syslog or eventlog for usage examples), then get rid of this one. - */ -class Pagination -{ - private $items; - private $page; - private $maxItems; - - public function __construct($par1, $par2) - { - $this->items = $par1; - $this->page = $par2; - - $this->maxItems = 5; - } - - public function getPagination() - { - $ret = array(); - $n = ceil(count($this->items) / $this->maxItems); - for ($i = 1; $i <= $n; $i++) { - $class = ($i == $this->page) ? 'active' : ''; - $ret[] = array( - 'class' => $class, - 'page' => $i - ); - } - return $ret; - } - - public function getItems() - { - $ret = array(); - $first = ($this->page - 1) * $this->maxItems; - for ($i = 0; $i < $this->maxItems; $i++) { - if ($first + $i < count($this->items)) - $ret[] = $this->items[$first + $i]; - } - return $ret; - } -}
\ No newline at end of file |