2017-10-12 00:38:28 +02:00
|
|
|
<?php
|
|
|
|
date_default_timezone_set('Europe/Oslo');
|
2018-02-10 18:08:53 +01:00
|
|
|
setlocale(LC_ALL, 'nb_NO');
|
2017-11-11 15:20:58 +01:00
|
|
|
require __DIR__ . '/../../../inc/navbar.php';
|
2017-10-12 00:38:28 +02:00
|
|
|
require __DIR__ . '/../../../src/_autoload.php';
|
2024-02-15 22:57:03 +01:00
|
|
|
require __DIR__ . '/../../../config.php';
|
2017-11-11 15:20:58 +01:00
|
|
|
|
2017-10-12 00:38:28 +02:00
|
|
|
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
|
|
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
2017-11-11 17:06:56 +01:00
|
|
|
$userManager = new \pvv\admin\UserManager($pdo);
|
|
|
|
|
|
|
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
|
|
|
$as = new SimpleSAML_Auth_Simple('default-sp');
|
|
|
|
$as->requireAuth();
|
|
|
|
$attrs = $as->getAttributes();
|
|
|
|
$uname = $attrs['uid'][0];
|
2018-08-10 00:19:16 +02:00
|
|
|
$name = $attrs['cn'][0];
|
2017-11-11 17:06:56 +01:00
|
|
|
|
|
|
|
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
2017-11-11 20:37:04 +01:00
|
|
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
2017-11-11 17:06:56 +01:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-10-12 00:38:28 +02:00
|
|
|
$customActivity = new \pvv\side\DBActivity($pdo);
|
|
|
|
|
|
|
|
$new = 0;
|
|
|
|
if(isset($_GET['new'])){
|
|
|
|
$new = $_GET['new'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$eventID = 0;
|
|
|
|
if(isset($_GET['id'])){
|
|
|
|
$eventID = $_GET['id'];
|
|
|
|
}else if($new == 0){
|
|
|
|
echo "\nID not set";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$today = new DateTimeImmutable;
|
2018-08-10 00:19:16 +02:00
|
|
|
$today = $today->setTime(18, 15);
|
|
|
|
$defaultStart = $today->format("Y-m-d H:15:00");
|
|
|
|
$inTwoHours = $today->add(new DateInterval('PT1H45M'));
|
|
|
|
$defaultEnd = $inTwoHours->format("Y-m-d H:00:00");
|
|
|
|
|
|
|
|
$event;
|
2017-10-12 00:38:28 +02:00
|
|
|
if($new == 0){
|
|
|
|
$event = $customActivity->getEventByID($eventID);
|
|
|
|
}
|
2018-08-10 00:19:16 +02:00
|
|
|
else {
|
|
|
|
$event = new \pvv\side\SimpleEvent(
|
|
|
|
0,
|
|
|
|
'',
|
|
|
|
$today,
|
|
|
|
$inTwoHours,
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
''
|
|
|
|
);
|
|
|
|
}
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-08-10 00:19:16 +02:00
|
|
|
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="no" locale="no">
|
2018-08-14 02:09:32 +02:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
|
|
|
<link rel="shortcut icon" href="favicon.ico">
|
|
|
|
<link rel="stylesheet" href="../../css/normalize.css">
|
|
|
|
<link rel="stylesheet" href="../../css/style.css">
|
|
|
|
<link rel="stylesheet" href="../../css/nav.css">
|
|
|
|
<link rel="stylesheet" href="../../css/events.css">
|
|
|
|
<link rel="stylesheet" href="../../css/admin.css">
|
2018-08-14 03:29:10 +02:00
|
|
|
<meta name="theme-color" content="#024" />
|
2018-08-14 02:09:32 +02:00
|
|
|
<title>Adminverkstedet</title>
|
|
|
|
|
|
|
|
<header>Admin­verk­stedet</header>
|
|
|
|
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
<body>
|
|
|
|
<nav>
|
|
|
|
<?php echo navbar(3, 'admin'); ?>
|
2018-02-24 17:02:00 +01:00
|
|
|
<?php echo loginbar(null, $pdo); ?>
|
2018-02-10 16:13:18 +01:00
|
|
|
</nav>
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
<main>
|
|
|
|
<h2>Aktivietsadministrasjon</h2>
|
|
|
|
<hr class="ruler">
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
<h2><?= ($new == 1 ? "Ny hendelse" : "Rediger hendelse"); ?></h2>
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-08-10 00:19:16 +02:00
|
|
|
<form action="update.php", method="post" class="gridsplit fullwidth_inputs">
|
2018-02-10 16:13:18 +01:00
|
|
|
<div class="gridl">
|
|
|
|
<p class="subtitle">Tittel</p>
|
2018-08-10 00:19:16 +02:00
|
|
|
<input type="text" name="title" value="<?= $event->getName() ?>" class="boxinput" required placeholder="En kul hendelse"><br>
|
|
|
|
|
|
|
|
<div class="gridsplit5050">
|
|
|
|
<div class="gridl">
|
|
|
|
<p class="subtitle">Arrangør</p>
|
|
|
|
<input type="text" name="organiser" value="<?= $event->getOrganiser() ?>" class="boxinput" required placeholder="<?= $name ?>"><br>
|
|
|
|
</div>
|
|
|
|
<div class="gridr noborder">
|
|
|
|
<p class="subtitle">Sted</p>
|
|
|
|
<input type="text" name="location" value="<?= $event->getLocation() ?>" class="boxinput" required placeholder="Terminalrommet"><br>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-08-12 03:52:55 +02:00
|
|
|
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
|
2018-08-10 00:19:16 +02:00
|
|
|
<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivese" required><?= implode($event->getDescription(), "\n"); ?></textarea>
|
|
|
|
|
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
</div>
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-08-10 00:19:16 +02:00
|
|
|
<div class="gridr" style="line-height: 1.3em;">
|
|
|
|
<h4>Starttid</h4><br>
|
|
|
|
<i>Måned:</i><br>
|
|
|
|
<input name="start_mon" type="month" class="boxinput" required value="<?= $event->getStart()->format('Y-m') ?>"><br>
|
|
|
|
<i>Dag:</i><br>
|
|
|
|
<input name="start_day" type="number" min="1" max="31" required class="boxinput" value="<?= $event->getStart()->format('d') ?>"><br>
|
|
|
|
<i>Klokkeslett:</i><br>
|
|
|
|
<input name="start_time" type="time" class="boxinput" required value="<?= $event->getStart()->format('H:i:s') ?>"><br>
|
|
|
|
<br>
|
|
|
|
<h4>Varighet</h4><br>
|
|
|
|
<?php $diff = $event->getStart()->diff($event->getStop()); ?>
|
|
|
|
<i>Timer:</i><br>
|
|
|
|
<input name="lasts_hours" type="number" min="0" class="boxinput" required value="<?= $diff->h ?>"><br>
|
|
|
|
<i>Minutter:</i><br>
|
|
|
|
<input name="lasts_minutes" type="number" min="0" max="59" class="boxinput" required value="<?= $diff->i ?>"><br>
|
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
</div>
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-08-10 00:19:16 +02:00
|
|
|
<input type="hidden" name="id" value="<?= $event->getID() ?>" />
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
<div class="allgrids" style="margin-top: 2em;">
|
|
|
|
<hr class="ruler">
|
|
|
|
<input type="submit" class="btn" value="Lagre"></a>
|
|
|
|
</div>
|
|
|
|
</form>
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
|
2017-10-12 00:38:28 +02:00
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
<p>
|
|
|
|
</main>
|
|
|
|
</body>
|