forked from Public/pics
57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?php
|
|
/*****************************************************************************
|
|
* MainNavBar.php
|
|
* Contains the primary navigational menu template.
|
|
*
|
|
* Global Data Lab code (C) Radboud University Nijmegen
|
|
* Programming (C) Aaron van Geffen, 2015-2022
|
|
*****************************************************************************/
|
|
|
|
class MainNavBar extends NavBar
|
|
{
|
|
protected $outerMenuId = 'mainNav';
|
|
protected $innerMenuId = 'mainNavigation';
|
|
protected $ariaLabel = 'Main navigation';
|
|
protected $navBarClasses = 'navbar-dark bg-dark sticky-top';
|
|
protected $primaryBadgeClasses = 'bg-light text-dark';
|
|
protected $secondaryBadgeClasses = 'bg-dark text-light';
|
|
|
|
public function html_main()
|
|
{
|
|
// Select a random space invader, with a bias towards the mascot
|
|
$rnd = rand(0, 100);
|
|
$alt = $rnd > 50 ? ' alt-' . ($rnd % 6 + 1) : '';
|
|
|
|
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, '/">
|
|
<i class="space-invader', $alt, '"></i>
|
|
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>
|
|
</button>
|
|
<div class="collapse navbar-collapse justify-content-end" id="', $this->innerMenuId, '">
|
|
<ul class="navbar-nav mb-2 mb-lg-0">';
|
|
|
|
$mainMenu = new MainMenu();
|
|
$this->renderMenuItems($mainMenu->getItems());
|
|
|
|
echo '
|
|
<li class="nav-divider d-none d-lg-inline"></li>';
|
|
|
|
$adminMenu = new AdminMenu();
|
|
$this->renderMenuItems($adminMenu->getItems());
|
|
|
|
$userMenu = new UserMenu();
|
|
$this->renderMenuItems($userMenu->getItems());
|
|
|
|
echo '
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>';
|
|
}
|
|
}
|