\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);
$svgWhite = '
';
$svgBlue = '
';
$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 .= "\t${svgWhite}" . htmlspecialchars($uname) . "\n";
$result .= "\n\t\n";
} else {
$result .= "\tgetLoginURL()) . "\">${svgWhite}Logg inn\n";
}
$result .= "\n\t\n";
return $result;
}