-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
110 lines (91 loc) · 3.04 KB
/
index.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Event Registration</title>
<style>
.error {color: #FF0000;}
</style>
</head>
<body>
<?php
require_once 'model\RegistrationManager.php';
require_once 'model\Participant.php';
require_once 'model\Event.php';
require_once 'persistence\PersistenceEventRegistration.php';
require_once 'model/Participant.php';
session_start();
//Retrieve the data from the model
$pm = new PersistenceEventRegistration();
$rm = $pm->loadDataFromStore();
echo "<form action='register.php' method='post'>";
echo "<p>Name? <select name='participantspinner'>";
foreach ($rm->getParticipants() as $participant){
echo "<option>" . $participant->getName() . "</option>";
}
echo "</select><span class='error'>";
if(isset($_SESSION['errorRegisterParticipant']) && !empty($_SESSION['errorRegisterParticipant'])){
echo " * " . $_SESSION["errorRegisterParticipant"];
}
echo "</span></p>";
echo "<p>Event? <select name='eventspinner'>";
foreach ($rm->getEvents() as $event){
echo "<option>" . $event->getName() . "</option>";
}
echo "</select><span class='error'>";
if(isset($_SESSION['errorRegisterEvent']) && !empty($_SESSION['errorRegisterEvent'])){
echo " * " . $_SESSION["errorRegisterEvent"];
}
echo "</span></p>";
echo "<p><input type='submit' value='Register' /</p>";
echo "</form>";
?>
<form action="addparticipant.php" method="post">
<p>Name? <input type="text" name="participant_name" />
<span class="error">
<?php
if(isset($_SESSION['errorParticipantName']) && !empty($_SESSION['errorParticipantName'])){
echo " * " . $_SESSION["errorParticipantName"];
}
?>
</span></p>
<p><input type="submit" value="Add Participant"/></p>
</form>
<form action="addEvent.php" method="post">
<p>Name? <input type="text" name="event_name" />
<span class="error">
<?php
if(isset($_SESSION['errorEvent']) && !empty($_SESSION['errorEvent']) ){
echo " * " . $_SESSION["errorEvent"]; //&& strcmp($_SESSION['errorEvent'],"Event name cannot be empty!")==0
}
?>
</span></p>
<p>Date? <input type="date" name="event_date"
value="<?php echo date('Y-m-d');
?>"/>
<?php
if(isset($_SESSION['errorDate']) && !empty($_SESSION['errorDate']) ){
echo " * " . $_SESSION["errorDate"];
}
?>
<p>Start time?<input type="time" name="starttime"
value="<?php echo date('H:i'); ?>" />
<?php
if(isset($_SESSION['startTimeError']) && !empty($_SESSION['startTimeError']) ){
echo " * " . $_SESSION["startTimeError"];
}
?>
<p>End time?<input type="time" name="endtime"
value="<?php echo date('H:i'); ?>" />
<?php
if(isset($_SESSION['endBeforeStart']) && !empty($_SESSION['endBeforeStart'])){
echo " * " . $_SESSION["endBeforeStart"];
}
if(isset($_SESSION['endTimeError']) && !empty($_SESSION['endTimeError']) ){
echo " * " . $_SESSION["endTimeError"];
}
?>
<p><input type="submit" value="Add Event"/></p>
</form>
</body>
</html>