Exemplo n.º 1
0
}
// Generates a menu item based on the $section argument, referring to the global $arr
function genMenuItem($section)
{
    global $arr, $found;
    // Whether the current one is active
    $active = $found == $section ? ' navbar-link-active' : '';
    // We want Join to be bold
    $join = $section == "Join" ? '<b>' . $section . '</b>' : $section;
    return '<a href="' . array_search($section, $arr) . '"class="pure-menu-link navbar-link' . $active . '">' . $join . '</a>';
}
?>

<div class="pure-u-1 pure-u-lg-1-4">
	<div id="navBottom">
		<a href="/" class="pure-menu-heading" style="display:inline-block"><img class="logo" src="/assets/img/logo.png"></a>
		<div class="navbar-toggle" id="toggle"><span class="toggle-icon"></span></div>
	</div>
</div>

<div class="pure-u-1 pure-u-lg-3-4 flex-nav">
	<div class="pure-menu-horizontal navbar-menu menu-can-transform">
		<ul class="pure-menu-list">
			<?php 
foreach ($arr as $folder => $target) {
    echo '<li class="pure-menu-item ieee-menu-item">' . genMenuItem($target) . '</li>';
}
?>
		</ul>
	</div>
</div>
Exemplo n.º 2
0
<?php

if (!$user->id) {
    $loginform = "\r\n        Login:\r\n        <form id='toplogin' method='post' action='login.php'>\r\n        <input type='text' name='user' />\r\n        <input type='password' name='password' />\r\n        <input type='submit' style='display:none' />\r\n        </form>\r\n        or <a href='index.php?p=register'>register</a>&nbsp;&nbsp;\r\n    ";
} else {
    $loginform = "\r\n        <a href='logout.php'><button>Log out</button></a>\r\n    ";
}
function genMenuItem($caption, $page)
{
    global $p;
    if ($p == $page) {
        $cl = " class='active'";
    } else {
        $cl = '';
    }
    if ($page == 'default') {
        $pp = '';
    } else {
        $pp = "?p={$page}";
    }
    return "<li><a{$cl} href='index.php{$pp}'>{$caption}</a></li>";
}
$menu = "";
$menu .= genMenuItem('View last submissions', 'default');
if ($user->isAdmin()) {
    $menu .= genMenuItem('View users', 'users');
}
$name = $user->namelink();
$header = "\r\n    <table id='topbar'><tr>\r\n        <td class='topleft'>Welcome, {$name}.</td>\r\n        <td class='topright'>{$loginform}</td>\r\n    </tr></table>\r\n    <ul class='menu'>{$menu}</ul>\r\n";
$doc->set('header', $header);