2023-03-11 15:14:05 +01:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* AdminMenu.php
|
|
|
|
* Contains the admin navigation logic.
|
|
|
|
*
|
2023-04-08 21:32:38 +02:00
|
|
|
* Kabuki CMS (C) 2013-2023, Aaron van Geffen
|
2023-03-11 15:14:05 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
class AdminMenu extends Menu
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$user = Registry::has('user') ? Registry::get('user') : new Guest();
|
|
|
|
if (!$user->isAdmin())
|
|
|
|
return;
|
|
|
|
|
2023-03-12 01:04:28 +01:00
|
|
|
$this->items[0] = [
|
2023-03-11 15:14:05 +01:00
|
|
|
'label' => 'Admin',
|
|
|
|
'icon' => 'gear',
|
2023-03-12 01:04:28 +01:00
|
|
|
'badge' => ErrorLog::getCount(),
|
2023-03-11 15:14:05 +01:00
|
|
|
'subs' => [
|
|
|
|
[
|
|
|
|
'uri' => '/managealbums/',
|
|
|
|
'label' => 'Albums',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'uri' => '/manageassets/',
|
|
|
|
'label' => 'Assets',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'uri' => '/managetags/',
|
|
|
|
'label' => 'Tags',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'uri' => '/manageusers/',
|
|
|
|
'label' => 'Users',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'uri' => '/manageerrors/',
|
|
|
|
'label' => 'Errors',
|
|
|
|
'badge' => ErrorLog::getCount(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2023-03-12 01:04:28 +01:00
|
|
|
if ($this->items[0]['badge'] == 0)
|
|
|
|
unset($this->items[0]['badge']);
|
|
|
|
|
2023-03-11 15:14:05 +01:00
|
|
|
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'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|