59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
|
<?php
|
||
|
/*****************************************************************************
|
||
|
* AdminMenu.php
|
||
|
* Contains the admin navigation logic.
|
||
|
*
|
||
|
* Global Data Lab code (C) Radboud University Nijmegen
|
||
|
* Programming (C) Aaron van Geffen, 2015-2022
|
||
|
*****************************************************************************/
|
||
|
|
||
|
class AdminMenu extends Menu
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
$user = Registry::has('user') ? Registry::get('user') : new Guest();
|
||
|
if (!$user->isAdmin())
|
||
|
return;
|
||
|
|
||
|
$this->items[] = [
|
||
|
'label' => 'Admin',
|
||
|
'icon' => 'gear',
|
||
|
'subs' => [
|
||
|
[
|
||
|
'uri' => '/managealbums/',
|
||
|
'label' => 'Albums',
|
||
|
],
|
||
|
[
|
||
|
'uri' => '/manageassets/',
|
||
|
'label' => 'Assets',
|
||
|
],
|
||
|
[
|
||
|
'uri' => '/managetags/',
|
||
|
'label' => 'Tags',
|
||
|
],
|
||
|
[
|
||
|
'uri' => '/manageusers/',
|
||
|
'label' => 'Users',
|
||
|
],
|
||
|
[
|
||
|
'uri' => '/manageerrors/',
|
||
|
'label' => 'Errors',
|
||
|
'badge' => ErrorLog::getCount(),
|
||
|
],
|
||
|
],
|
||
|
];
|
||
|
|
||
|
foreach ($this->items as $i => $item)
|
||
|
{
|
||
|
if (isset($item['uri']))
|
||
|
$this->items[$i]['url'] = BASEURL . $item['uri'];
|
||
|
|
||
|
if (!isset($item['subs']))
|
||
|
continue;
|
||
|
|
||
|
foreach ($item['subs'] as $j => $subitem)
|
||
|
$this->items[$i]['subs'][$j]['url'] = BASEURL . $subitem['uri'];
|
||
|
}
|
||
|
}
|
||
|
}
|