forked from fsi-tue/eei
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.php
81 lines (75 loc) · 2.49 KB
/
event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
require_once('config.php');
require_once('utils.php');
require_once('localisation/localizer.php');
$localizer = new Localizer();
// import event_data after localizer, because event_data uses $localizer
require_once('event_data.php');
// global variables
global $events, $CONFIG_TERM;
# If event id is not set, redirect to main page.
if (!isset($_GET["e"])) {
header("Location:/");
die();
}
$event_id = filter_input(INPUT_GET, "e", FILTER_SANITIZE_ENCODED);
# If event id is unknown, redirect to main page.
if (!array_key_exists($event_id, $events)) {
header("Location:/");
die();
}
$E = $events[$event_id];
?>
<!DOCTYPE html>
<html lang="<?= $localizer->getLang() ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/style.css">
<title> <?= "{$E['name']} - $CONFIG_TERM"; ?></title>
</head>
<body>
<div id="center">
<div class="block">
<h1><?= "{$E['name']} - $CONFIG_TERM"; ?></h1>
<h2 class="description icon clock"><?= showDateAndTime($E) ?></h2>
<h2 class="description icon marker"><?= $E['location']; ?></h2>
<h2 class="description"><?= $localizer['remaining'] . ": " . getNumberOfRemainingSpots($E) ?></h2>
<?= $E["text"] ?>
<br>
<?php
if ($E['info'] != '') {
?>
<div class='block info'><?= $E['info'] ?></div>
<?php
} ?>
<div class="block>">
<?php
# If registration id is set, the user can delete his registration.
if (isset($_GET["r"])) {
$registration_id = filter_input(INPUT_GET, "r", FILTER_SANITIZE_ENCODED);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($registration_id)) {
deleteRegistration($registration_id, $E);
} else {
register($E);
}
} else {
if (isset($registration_id)) {
showDeleteRegistration($registration_id, $E);
} else {
showRegistration($E);
}
}
?>
<a href="index.php?lang=<?= $localizer->getLang() ?>">
<div class="box icon arrow-left">
<p class="name"><?= $localizer['back'] ?></p>
</div>
</a>
</div>
</div>
</body>
</html>