forked from Public/pics
GenericTable: refactor order and pagination initalisation
This commit is contained in:
@@ -54,27 +54,19 @@ class ManageAlbums extends HTMLController
|
||||
'value' => 'count',
|
||||
],
|
||||
],
|
||||
'start' => !empty($_GET['start']) ? (int) $_GET['start'] : 0,
|
||||
'sort_order' => !empty($_GET['order']) ? $_GET['order'] : null,
|
||||
'sort_direction' => !empty($_GET['dir']) ? $_GET['dir'] : null,
|
||||
'default_sort_order' => 'tag',
|
||||
'default_sort_direction' => 'up',
|
||||
'start' => $_GET['start'] ?? 0,
|
||||
'sort_order' => $_GET['order'] ?? '',
|
||||
'sort_direction' => $_GET['dir'] ?? '',
|
||||
'title' => 'Manage albums',
|
||||
'no_items_label' => 'No albums meet the requirements of the current filter.',
|
||||
'items_per_page' => 9999,
|
||||
'index_class' => 'col-md-6',
|
||||
'base_url' => BASEURL . '/managealbums/',
|
||||
'get_data' => function($offset = 0, $limit = 9999, $order = '', $direction = 'up') {
|
||||
if (!in_array($order, ['id_tag', 'tag', 'slug', 'count']))
|
||||
$order = 'tag';
|
||||
if (!in_array($direction, ['up', 'down']))
|
||||
$direction = 'up';
|
||||
|
||||
$rows = PhotoAlbum::getHierarchy($order, $direction);
|
||||
|
||||
return [
|
||||
'rows' => $rows,
|
||||
'order' => $order,
|
||||
'direction' => ($direction == 'up' ? 'up' : 'down'),
|
||||
];
|
||||
'get_data' => function($offset, $limit, $order, $direction) {
|
||||
assert(in_array($order, ['id_tag', 'tag', 'slug', 'count']));
|
||||
return PhotoAlbum::getHierarchy($order, $direction);
|
||||
},
|
||||
'get_count' => function() {
|
||||
return 9999;
|
||||
|
||||
Reference in New Issue
Block a user