2023-03-11 15:14:05 +01:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* MainNavBar.php
|
|
|
|
* Contains the primary navigational menu template.
|
|
|
|
*
|
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 MainNavBar extends NavBar
|
|
|
|
{
|
|
|
|
protected $outerMenuId = 'mainNav';
|
|
|
|
protected $innerMenuId = 'mainNavigation';
|
|
|
|
protected $ariaLabel = 'Main navigation';
|
2023-03-11 15:27:15 +01:00
|
|
|
protected $navBarClasses = 'navbar-dark bg-dark sticky-top';
|
2023-03-11 15:14:05 +01:00
|
|
|
protected $primaryBadgeClasses = 'bg-light text-dark';
|
|
|
|
protected $secondaryBadgeClasses = 'bg-dark text-light';
|
|
|
|
|
|
|
|
public function html_main()
|
|
|
|
{
|
2023-03-11 16:38:03 +01:00
|
|
|
// Select a random space invader, with a bias towards the mascot
|
|
|
|
$rnd = rand(0, 100);
|
|
|
|
$alt = $rnd > 50 ? ' alt-' . ($rnd % 6 + 1) : '';
|
2023-11-11 11:50:09 +01:00
|
|
|
$className = $rnd > 5 ? 'space-invader' . $alt : 'nyan-cat';
|
2023-03-11 16:38:03 +01:00
|
|
|
|
2023-03-11 15:14:05 +01:00
|
|
|
echo '
|
|
|
|
<nav id="', $this->outerMenuId, '" class="navbar navbar-expand-lg ', $this->navBarClasses, '" aria-label="', $this->ariaLabel, '">
|
|
|
|
<div class="container">
|
|
|
|
<a class="navbar-brand flex-grow-1" href="', BASEURL, '/">
|
2023-11-11 11:50:09 +01:00
|
|
|
<i class="', $className, '"></i>
|
2023-03-11 15:14:05 +01:00
|
|
|
HashRU Pics
|
|
|
|
</a>
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#', $this->innerMenuId, '" aria-controls="', $this->innerMenuId, '" aria-expanded="false" aria-label="Toggle navigation">
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
2023-03-11 16:39:30 +01:00
|
|
|
</button>';
|
|
|
|
|
|
|
|
if (Registry::get('user')->isLoggedIn())
|
|
|
|
{
|
|
|
|
echo '
|
2023-03-11 15:14:05 +01:00
|
|
|
<div class="collapse navbar-collapse justify-content-end" id="', $this->innerMenuId, '">
|
|
|
|
<ul class="navbar-nav mb-2 mb-lg-0">';
|
|
|
|
|
2023-03-11 16:39:30 +01:00
|
|
|
$mainMenu = new MainMenu();
|
|
|
|
$this->renderMenuItems($mainMenu->getItems());
|
2023-03-11 15:14:05 +01:00
|
|
|
|
2023-03-11 16:39:30 +01:00
|
|
|
echo '
|
2023-03-11 15:14:05 +01:00
|
|
|
<li class="nav-divider d-none d-lg-inline"></li>';
|
|
|
|
|
2023-03-11 16:39:30 +01:00
|
|
|
$adminMenu = new AdminMenu();
|
|
|
|
$this->renderMenuItems($adminMenu->getItems());
|
2023-03-11 15:14:05 +01:00
|
|
|
|
2023-03-11 16:39:30 +01:00
|
|
|
$userMenu = new UserMenu();
|
|
|
|
$this->renderMenuItems($userMenu->getItems());
|
2023-03-11 15:14:05 +01:00
|
|
|
|
2023-11-11 11:37:26 +01:00
|
|
|
$this->darkModeToggle();
|
|
|
|
|
2023-03-11 16:39:30 +01:00
|
|
|
echo '
|
2023-03-11 15:14:05 +01:00
|
|
|
</ul>
|
2023-03-11 16:39:30 +01:00
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
2023-03-11 15:14:05 +01:00
|
|
|
</div>
|
|
|
|
</nav>';
|
|
|
|
}
|
2023-11-11 11:37:26 +01:00
|
|
|
|
|
|
|
private function darkModeToggle()
|
|
|
|
{
|
|
|
|
echo '
|
|
|
|
<li class="nav-item dropdown">
|
|
|
|
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle d-flex align-items-center"
|
|
|
|
id="bd-theme" type="button" data-bs-toggle="dropdown" data-bs-display="static">
|
|
|
|
<i id="theme-icon-active" class="bi bi-light"></i>
|
|
|
|
<span class="d-lg-none ms-2" id="bd-theme-text">Toggle theme</span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
|
|
<li>
|
|
|
|
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light">
|
|
|
|
<i class="bi bi-sun-fill"></i>
|
|
|
|
Light
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark">
|
|
|
|
<i class="bi bi-moon-stars-fill"></i>
|
|
|
|
Dark
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto">
|
|
|
|
<i class="bi bi-circle-half"></i>
|
|
|
|
Auto
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>';
|
|
|
|
}
|
2023-03-11 15:14:05 +01:00
|
|
|
}
|