\n";
$menuItems = [
'Hjem' => '',
'Kalender' => 'kalender',
'Aktiviteter' => 'aktiviteter',
'Prosjekter' => 'prosjekt',
'Kontakt' => 'kontakt',
'Webmail' => 'https://webmail.pvv.ntnu.no/',
'Wiki' => 'pvv',
];
foreach($menuItems as $caption => $link) {
$isActive = $active === $link;
if ($caption !== 'webmail') {
$link = rtrim(str_repeat('../', $depth) . $link, '/') . '/';
}
if ($isActive) $link = '#';
$result .= "\t\t
'
. ''
. $caption
. "\n"
;
}
return $result . "\t\n";
}
function loginBar($sp = null, $pdo = null) {
if (is_null($sp)) $sp = 'default-sp';
$result = "\n";
require_once(__DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple($sp);
$svg = '
';
$attr = $as->getAttributes();
if($attr) {
$uname = $attr['uid'][0];
if (isset($pdo)) {
$userManager = new \pvv\admin\UserManager($pdo);
$isAdmin = $userManager->isAdmin($uname);
} else {
$isAdmin = false;
}
$result .= "\n\t\n";
$result .= "\t${svg}" . htmlspecialchars($uname) . "\n";
} else {
$result .= "\tgetLoginURL()) . "\">${svg}Logg inn\n";
}
$result .= "\n\t\n";
return $result;
}