\n"; $menuItems = [ 'Hjem' => '', 'Hendelser' => 'hendelser', // 'Kalender' => 'kalender', // 'Aktiviteter' => 'aktiviteter', 'Prosjekter' => 'prosjekt', 'Kontakt' => 'kontakt', 'Webmail' => 'https://webmail.pvv.ntnu.no/roundcube/', 'Galleri' => 'galleri', 'Wiki' => 'https://wiki.pvv.ntnu.no/', '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 (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☰ MENU\n"; return $result; }