This repository has been archived on 2023-01-08. You can view files and clone it, but cannot push or open issues or pull requests.
stafett-for-livet/template/_header.php

88 lines
3.2 KiB
PHP
Raw Normal View History

2021-09-01 15:31:18 +00:00
<?php
2021-10-09 20:01:18 +00:00
require_once(__DIR__ . "/../app/template.php");
2021-09-01 15:31:18 +00:00
2021-09-11 18:12:29 +00:00
if ($templateParameters["render"] === FALSE) {
2021-09-06 07:04:29 +00:00
return;
}
2021-09-01 15:31:18 +00:00
?>
2021-08-30 15:17:53 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2021-09-01 15:31:18 +00:00
<title><?=htmlspecialchars($templateParameters["title"]);?> Stafett for livet</title>
2021-08-30 15:17:53 +00:00
2021-09-01 15:31:18 +00:00
<link rel="stylesheet" href="<?=$templateUrlPrefix;?>style/main.css">
<link rel="icon" href="<?=$templateUrlPrefix;?>img/cropped-kf-propell-ikon-32x32.png" sizes="32x32">
2021-08-30 15:17:53 +00:00
<body>
2021-10-09 19:11:59 +00:00
<header>
<div class="navbar-top">
<div class="inner">
<a href="<?=$templateUrlPrefix;?>" style="display: block; max-width: max-content;">
<img style="display: block; height: 32px;" src="<?=$templateUrlPrefix;?>img/cropped-kf-propell-ikon-32x32.png" alt="">
<div style="margin-left: 44px;">
<div style="font-size: 24px; margin-top: -38px;">Stafett for livet</div>
<div style="font-size: 10px; margin-top: -6px;"><b>KREFT</b>FORENINGEN</div>
</div>
</a>
</div>
2021-08-30 15:17:53 +00:00
</div>
2021-10-09 19:11:59 +00:00
</header>
2021-08-30 15:17:53 +00:00
2021-09-11 18:12:29 +00:00
<?php if ((isset($_SESSION['logged_in'])) && ($_SESSION['logged_in'] === TRUE)) : ?>
2021-09-11 16:31:53 +00:00
<div class="login-statusbar">
2021-10-09 19:11:59 +00:00
<div class="inner">
2021-09-11 16:31:53 +00:00
<a href="<?=$templateUrlPrefix;?>logout.php" style="float: right;">Logg ut</a>
<div>Inlogget som: <?=htmlspecialchars($_SESSION['username'])?></div>
</div>
</div>
<?php endif; ?>
2021-08-30 15:17:53 +00:00
<div class="grid-container">
<div>
2021-10-09 19:11:59 +00:00
<nav class="nav-links">
2021-08-30 15:17:53 +00:00
<ul>
2021-09-01 15:31:18 +00:00
<li><a href="<?=$templateUrlPrefix;?>">Forside</a></li>
2021-09-06 07:04:29 +00:00
<li><a href="<?=$templateUrlPrefix;?>login.php">Logg inn</a></li>
2021-09-01 15:31:18 +00:00
<li><a href="<?=$templateUrlPrefix;?>example.php">Eksempel</a></li>
2021-08-30 15:17:53 +00:00
</ul>
</nav>
</div>
<div>
2021-10-11 07:37:39 +00:00
<?php
// is my implementation of alerts janky? maybe...
if ((isset($_SESSION['alert'])) && (count($_SESSION['alert']) > 0)) {
foreach ($_SESSION['alert'] as $alert) {
switch ($alert[0]) {
case 'success':
2021-10-11 08:34:32 +00:00
$prefix = 'Suksess ';
2021-10-11 07:37:39 +00:00
break;
case 'info':
2021-10-11 08:34:32 +00:00
$prefix = 'Info ';
2021-10-11 07:37:39 +00:00
break;
case 'warning':
2021-10-11 08:34:32 +00:00
$prefix = 'Varsel ';
2021-10-11 07:37:39 +00:00
break;
case 'danger':
2021-10-11 08:34:32 +00:00
$prefix = 'Error ';
2021-10-11 07:37:39 +00:00
break;
default:
$alert[0] = 'danger';
2021-10-11 08:34:32 +00:00
$prefix = 'Ukjent ';
2021-10-11 07:37:39 +00:00
break;
}
echo('<div class="alert alert-'.$alert[0].'"><b>'.$prefix.'</b> '.$alert[1].'</div>');
}
$_SESSION['alert'] = [];
}
?>
2021-08-30 15:17:53 +00:00
<main>