\n";
$menuItems = [
'Hjem' => '',
'Hendelser' => 'hendelser',
//'Kalender' => 'kalender',
//'Aktiviteter' => 'aktiviteter',
'Prosjekter' => 'prosjekt',
'Kontakt' => 'kontakt',
'Webmail' => 'mail',
'Galleri' => 'galleri',
'Wiki' => 'pvv',
'Git' => 'https://git.pvv.ntnu.no/',
'Tjenester' => 'tjenester',
];
foreach($menuItems as $caption => $link) {
$isActive = $active === $link;
if (substr( $link, 0, 4 ) != "http") {
$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];
$isAdmin = false;
if (isset($pdo)) {
$userManager = new \pvv\admin\UserManager($pdo);
$isAdmin = $userManager->isAdmin($uname);
}
$result .= "\t{$svg}" . htmlspecialchars($uname) . "\n";
$result .= "\n\t\n";
} else {
$result .= "\tgetLoginURL()) . "\">{$svg}Logg inn\n";
}
$result .= "\n\t\n";
return $result;
}