2017-11-05 16:47:32 +01:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* ManageAlbums.php
|
|
|
|
* Contains the controller for admin album management.
|
|
|
|
*
|
|
|
|
* Kabuki CMS (C) 2013-2017, Aaron van Geffen
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
class ManageAlbums extends HTMLController
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
// Ensure it's just admins at this point.
|
|
|
|
if (!Registry::get('user')->isAdmin())
|
|
|
|
throw new NotAllowedException();
|
|
|
|
|
|
|
|
$options = [
|
2017-11-05 17:09:01 +01:00
|
|
|
'form' => [
|
|
|
|
'action' => BASEURL . '/editalbum/',
|
|
|
|
'method' => 'get',
|
2023-03-11 14:24:17 +01:00
|
|
|
'class' => 'col-md-6 text-end',
|
2017-11-05 17:09:01 +01:00
|
|
|
'buttons' => [
|
|
|
|
'add' => [
|
|
|
|
'type' => 'submit',
|
|
|
|
'caption' => 'Add new album',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
2017-11-05 16:47:32 +01:00
|
|
|
'columns' => [
|
|
|
|
'id_album' => [
|
|
|
|
'value' => 'id_tag',
|
|
|
|
'header' => 'ID',
|
|
|
|
'is_sortable' => true,
|
|
|
|
],
|
|
|
|
'tag' => [
|
|
|
|
'header' => 'Album',
|
|
|
|
'is_sortable' => true,
|
|
|
|
'parse' => [
|
|
|
|
'link' => BASEURL . '/editalbum/?id={ID_TAG}',
|
|
|
|
'data' => 'tag',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'slug' => [
|
|
|
|
'header' => 'Slug',
|
|
|
|
'is_sortable' => true,
|
|
|
|
'parse' => [
|
|
|
|
'link' => BASEURL . '/editalbum/?id={ID_TAG}',
|
|
|
|
'data' => 'slug',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'count' => [
|
|
|
|
'header' => '# Photos',
|
|
|
|
'is_sortable' => true,
|
|
|
|
'value' => 'count',
|
|
|
|
],
|
|
|
|
],
|
2024-12-19 15:00:00 +01:00
|
|
|
'default_sort_order' => 'tag',
|
|
|
|
'default_sort_direction' => 'up',
|
|
|
|
'start' => $_GET['start'] ?? 0,
|
|
|
|
'sort_order' => $_GET['order'] ?? '',
|
|
|
|
'sort_direction' => $_GET['dir'] ?? '',
|
2017-11-05 16:47:32 +01:00
|
|
|
'title' => 'Manage albums',
|
|
|
|
'no_items_label' => 'No albums meet the requirements of the current filter.',
|
|
|
|
'items_per_page' => 9999,
|
2023-03-11 14:24:17 +01:00
|
|
|
'index_class' => 'col-md-6',
|
2017-11-05 16:47:32 +01:00
|
|
|
'base_url' => BASEURL . '/managealbums/',
|
2024-12-19 15:00:00 +01:00
|
|
|
'get_data' => function($offset, $limit, $order, $direction) {
|
|
|
|
assert(in_array($order, ['id_tag', 'tag', 'slug', 'count']));
|
|
|
|
return PhotoAlbum::getHierarchy($order, $direction);
|
2017-11-05 16:47:32 +01:00
|
|
|
},
|
|
|
|
'get_count' => function() {
|
|
|
|
return 9999;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
$table = new GenericTable($options);
|
|
|
|
parent::__construct('Album management - Page ' . $table->getCurrentPage() .' - ' . SITE_TITLE);
|
|
|
|
$this->page->adopt(new TabularData($table));
|
|
|
|
}
|
|
|
|
}
|