2017-11-11 15:20:58 +01:00
|
|
|
<?php
|
|
|
|
function navbar($depth, $active = NULL) {
|
2017-11-13 23:13:24 +01:00
|
|
|
$result = '<img class="logo" src="' . rtrim(str_repeat('../', $depth)) . "/css/logo-disk-white.png\"/>\n";
|
|
|
|
$result .= "\t\t<ul>\n";
|
2017-11-11 15:20:58 +01:00
|
|
|
$menuItems = [
|
2017-11-13 23:13:24 +01:00
|
|
|
'Hjem' => '',
|
|
|
|
'Kalender' => 'kalender',
|
|
|
|
'Aktiviteter' => 'aktiviteter',
|
|
|
|
'Prosjekter' => 'prosjekt',
|
|
|
|
'Kontakt' => 'kontakt',
|
|
|
|
'Wiki' => 'pvv'
|
2017-11-11 15:20:58 +01:00
|
|
|
];
|
|
|
|
foreach($menuItems as $caption => $link) {
|
2017-11-13 13:21:51 +01:00
|
|
|
$result .= "\t\t\t<a href=\"" . rtrim(str_repeat('../', $depth) . $link, '/') . "/\"" . ($active === $link ? ' class="active"' : '') . ">"
|
|
|
|
. "<li>" . $caption . "</li></a>\n"
|
2017-11-11 15:20:58 +01:00
|
|
|
;
|
|
|
|
}
|
2017-11-13 23:13:24 +01:00
|
|
|
$result .= "\t\t\t" . '<a href="javascript:void(0);" style="font-size:15px;" id="navopen" onclick="navbar()">☰</a>' . "\n";
|
2017-11-13 13:21:51 +01:00
|
|
|
return $result . "\t\t</ul>\n";
|
2017-11-11 15:20:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function loginBar($sp = 'default-sp') {
|
|
|
|
$result = "\n";
|
|
|
|
require_once(__DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
|
|
|
$as = new SimpleSAML_Auth_Simple($sp);
|
|
|
|
|
|
|
|
$attr = $as->getAttributes();
|
|
|
|
if($attr) {
|
|
|
|
$uname = $attr['uid'][0];
|
2017-11-13 23:13:24 +01:00
|
|
|
$result .= "\t\t<p class=\"login\">Logget inn som: " . htmlspecialchars($uname) . "</p>\n";
|
2017-11-11 15:20:58 +01:00
|
|
|
} else {
|
2017-11-13 23:13:24 +01:00
|
|
|
$result .= "\t\t<a class=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">Logg inn</a>\n";
|
2017-11-11 15:20:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|