-
Notifications
You must be signed in to change notification settings - Fork 1
/
add.php
172 lines (150 loc) · 5.23 KB
/
add.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once('class.RegisterPage.php');
$page = new SecurePage('Burning Flipside - Registration');
$camps = array();
$arts = array();
$cars = array();
$events = array();
$tcDates = array();
$artDates = array();
$dmvDates = array();
$evtDates = array();
$now = time();
$secsInDay = 86399;
$data_set = DataSetFactory::getDataSetByName('registration');
$vars_data_table = $data_set['vars'];
$vars = $vars_data_table->read(new \Data\Filter('name eq year'));
$year = intval($vars[0]['value']);
$vars = $vars_data_table->read(new \Data\Filter('name eq tcRegDates'));
$tcDates = $vars[0]['value'];
$tcStart = strtotime($tcDates['start']);
$tcEnd = strtotime($tcDates['end'])+$secsInDay;
$tcRegClosed = $now < $tcStart || $now > $tcEnd;
$vars = $vars_data_table->read(new \Data\Filter('name eq artRegDates'));
$artDates = $vars[0]['value'];
$artStart = strtotime($artDates['start']);
$artEnd = strtotime($artDates['end'])+$secsInDay;
$artRegClosed = $now < $artStart || $now > $artEnd;
$vars = $vars_data_table->read(new \Data\Filter('name eq dmvRegDates'));
$dmvDates = $vars[0]['value'];
$dmvStart = strtotime($dmvDates['start']);
$dmvEnd = strtotime($dmvDates['end'])+$secsInDay;
$dmvRegClosed = $now < $dmvStart || $now > $dmvEnd;
$vars = $vars_data_table->read(new \Data\Filter('name eq eventRegDates'));
$evtDates = $vars[0]['value'];
$evtStart = strtotime($evtDates['start']);
$evtEnd = strtotime($evtDates['end'])+$secsInDay;
$evtRegClosed = $now < $evtStart || $now > $evtEnd;
if($page->user)
{
$camps_data_table = $data_set['camps'];
$art_data_table = $data_set['art'];
$dmv_data_table = $data_set['dmv'];
$event_data_table = $data_set['event'];
$filter = array('year'=>$year, 'registrars'=>$page->user->uid);
$camps = $camps_data_table->read($filter);
$arts = $art_data_table->read($filter);
$cars = $dmv_data_table->read($filter);
$events = $event_data_table->read($filter);
}
$camps_count = count($camps);
$arts_count = count($arts);
$cars_count = count($cars);
$events_count = count($events);
$manage_camp = '<a class="btn btn-secondary btn-lg" href="tc_reg.php">Register a Theme Camp</a>';
if($tcRegClosed)
{
$manage_camp = '<a class="btn btn-secondary btn-lg disabled" href="#">Theme Camp Registration is Closed</a>';
}
if($camps_count > 0)
{
$manage_camp.= '<ul>';
for($i = 0; $i < $camps_count; $i++)
{
if($tcRegClosed)
{
$manage_camp.= '<li><a href="tc_reg.php?_id='.$camps[$i]['_id'].'">View your theme camp: '.$camps[$i]['name'].'</a></li>';
}
else
{
$manage_camp.= '<li><a href="tc_reg.php?_id='.$camps[$i]['_id'].'">Manage your theme camp: '.$camps[$i]['name'].'</a></li>';
}
}
$manage_camp.= '</ul>';
}
$manage_art = '<a class="btn btn-secondary btn-lg" href="art_reg.php">Register an Art Project</a>';
if($artRegClosed)
{
$manage_art = '<a class="btn btn-secondary btn-lg disabled" href="#">Art Registration is Closed</a>';
}
if($arts_count > 0)
{
$manage_art.= '<ul>';
for($i = 0; $i < $arts_count; $i++)
{
if($artRegClosed)
{
$manage_art.= '<li><a href="art_reg.php?_id='.$arts[$i]['_id'].'">View your art project: '.$arts[$i]['name'].'</a></li>';
}
else
{
$manage_art.= '<li><a href="art_reg.php?_id='.$arts[$i]['_id'].'">Manage your art project: '.$arts[$i]['name'].'</a></li>';
}
}
$manage_art.= '</ul>';
}
$manage_car = '<a class="btn btn-secondary btn-lg" href="artCar_reg.php">Register an Art Car</a>';
if($dmvRegClosed)
{
$manage_car = '<a class="btn btn-secondary btn-lg disabled" href="#">Art Car Registration is Closed</a>';
}
if($cars_count > 0)
{
$manage_car.= '<ul>';
for($i = 0; $i < $events_count; $i++)
{
if($dmvRegClosed)
{
$manage_car.= '<li><a href="artCar_reg.php?_id='.$cars[$i]['_id'].'">View your art car: '.$cars[$i]['name'].'</a></li>';
}
else
{
$manage_car.= '<li><a href="artCar_reg.php?_id='.$cars[$i]['_id'].'">Manage your art car: '.$cars[$i]['name'].'</a></li>';
}
}
$manage_car.= '</ul>';
}
$manage_event = '<a class="btn btn-secondary btn-lg" href="event_reg.php">Register an Event</a>';
if($evtRegClosed)
{
$manage_event = '<a class="btn btn-secondary btn-lg disabled" href="#">Event Registration is Closed</a>';
}
if($events_count > 0)
{
$manage_event.= '<ul>';
for($i = 0; $i < $events_count; $i++)
{
if($evtRegClosed)
{
$manage_event.= '<li><a href="event_reg.php?_id='.$events[$i]['_id'].'">View your event: '.$events[$i]['name'].'</a></li>';
}
else
{
$manage_event.= '<li><a href="event_reg.php?_id='.$events[$i]['_id'].'">Manage your event: '.$events[$i]['name'].'</a></li>';
}
}
$manage_event.= '</ul>';
}
$page->body .= '
<div id="content">
<h1>Welcome to the Burning Flipside Registration System</h1>
<p></p>
<h1>What would you like register?</h1>
'.$manage_camp.'<div class="clearfix"></div>
'.$manage_art.'<div class="clearfix"></div>
'.$manage_car.'<div class="clearfix"></div>
'.$manage_event.'
</div>';
$page->printPage();