summaryrefslogtreecommitdiff
path: root/app/Core/Helper.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-01-18 17:59:41 -0500
committerFrederic Guillot <fred@kanboard.net>2015-01-18 17:59:41 -0500
commit7c1c14cf64b59f211b9d505112797cb855e5b604 (patch)
tree79622c17096b386ca599c3f804a9d6d5513a8d7d /app/Core/Helper.php
parent74e4a7b0642b18d9aaa71dd72359495c5dc99107 (diff)
Pagination refactoring
Diffstat (limited to 'app/Core/Helper.php')
-rw-r--r--app/Core/Helper.php68
1 files changed, 1 insertions, 67 deletions
diff --git a/app/Core/Helper.php b/app/Core/Helper.php
index 146cb2f8..dbe5a271 100644
--- a/app/Core/Helper.php
+++ b/app/Core/Helper.php
@@ -462,73 +462,7 @@ class Helper
$values += $params;
- return '?'.http_build_query($values, '');
- }
-
- /**
- * Pagination links
- *
- * @param array $pagination Pagination information
- * @return string
- */
- public function paginate(array $pagination)
- {
- extract($pagination);
-
- if ($pagination['offset'] === 0 && ($total - $pagination['offset']) <= $limit) {
- return '';
- }
-
- $html = '<div class="pagination">';
- $html .= '<span class="pagination-previous">';
-
- if ($pagination['offset'] > 0) {
- $offset = $pagination['offset'] - $limit;
- $html .= $this->a('&larr; '.t('Previous'), $controller, $action, $params + compact('offset', 'order', 'direction'));
- }
- else {
- $html .= '&larr; '.t('Previous');
- }
-
- $html .= '</span>';
- $html .= '<span class="pagination-next">';
-
- if (($total - $pagination['offset']) > $limit) {
- $offset = $pagination['offset'] + $limit;
- $html .= $this->a(t('Next').' &rarr;', $controller, $action, $params + compact('offset', 'order', 'direction'));
- }
- else {
- $html .= t('Next').' &rarr;';
- }
-
- $html .= '</span>';
- $html .= '</div>';
-
- return $html;
- }
-
- /**
- * Column sorting (work with pagination)
- *
- * @param string $label Column title
- * @param string $column SQL column name
- * @param array $pagination Pagination information
- * @return string
- */
- public function order($label, $column, array $pagination)
- {
- extract($pagination);
-
- $prefix = '';
-
- if ($order === $column) {
- $prefix = $direction === 'DESC' ? '&#9660; ' : '&#9650; ';
- $direction = $direction === 'DESC' ? 'ASC' : 'DESC';
- }
-
- $order = $column;
-
- return $prefix.$this->a($label, $controller, $action, $params + compact('offset', 'order', 'direction'));
+ return '?'.http_build_query($values);
}
/**