-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
357 lines (287 loc) · 11.2 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<?php
require_once("settings2.php");
require_once("{$TKTDIR}user.php");
session_start();
require_once('include.php');
// tkt0.2
require_once("{$TKTDIR}functions.php");
require_once("{$TKTDIR}database.php");
// lib
require_once("DynHtmlPage.php");
require_once("DynHtmlBlock.php");
$pageName = "Home Page";
$debug = 0;
DynHtmlPage::docHeader($pageName);
echo "<div class='colmask leftmenu'>\n";
DynHtmlPage::header();
loginprompt();
dbconnect();
echo "<meta property='fb:admins' content='100000225422795' />\n";
echo "<div class='colleft'>\n";
$page = new DynHtmlPage($pageName);
$page->load($pageName);
$page->displayHeader();
foreach($page->block as $block)
if ($block->seq < 1000)
$block->display();
# Database functions
function getEventTypeMinDate($eventcdptrn) {
$sql = "SELECT MIN(eventdt) ed FROM event where eventcd LIKE '$eventcdptrn' AND active AND eventdt >= CURDATE()";
return dbgetsingleton($sql, "ed");
}
function getEventTypeCount($eventcdptrn) {
$sql = "SELECT COUNT(*) cnt FROM event WHERE eventcd LIKE '$eventcdptrn' AND active AND eventdt >= CURDATE()";
return dbgetsingleton($sql, "cnt");
}
function makeEventQuery($eventcdptrn) {
return "SELECT DATE_FORMAT(e.eventdt, '%a %b %e, %Y') edt,
TIME_FORMAT(e.advstarttm, '%l:%i %p') etm,
TIME_FORMAT(e.teardowntm, '%l:%i %p') etmend,
e.mbrprice, e.guestprice, e.eventcd
FROM `event` e
WHERE e.eventcd LIKE '$eventcdptrn' AND active AND CURDATE() <= e.eventdt
ORDER BY e.eventdt";
}
# Event printing functions
function printOpenCurling() {
$b = new DynHtmlBlock();
$b->leftRaw = "<img align='left' width=400 height=256 src='image/Tatem.delivery.jpeg' />";
$eventcdptrn = "OC%";
if (getEventTypeCount($eventcdptrn) > 0) {
$sql = makeEventQuery($eventcdptrn);
$res = mysql_query($sql)
or die("Error during event select. " . mysql_error());
$ix = 0;
while ($row = mysql_fetch_object($res)) {
$url = "eventstatus.php?eventMask=$row->eventcd";
if ($ix == 0) {
$b->header = "Open Curling on $row->edt";
$b->rightRaw .= "<p>";
$b->rightRaw .= "The curling season continues in Atlanta! ";
$b->rightRaw .= "Our next Open Curling event is scheduled for <strong><a href='$url'>$row->edt at $row->etm</a></strong>. ";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= "The member price is \$$row->mbrprice, and the event is \$$row->guestprice for non-members. ";
$b->rightRaw .= "All are welcome -- we will have some capability for teaching first-timers. ";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= "Sign up for Open Curling is online. ";
$b->rightRaw .= "Make sure you <a href='login.php'>Login or Register</a> and then go to the ";
$b->rightRaw .= "<a href='eventstatus.php'>Events page</a> to sign up and pay for upcoming sessions. ";
$b->rightRaw .= "</p>";
} else {
if ($ix == 1) {
$b->bottomRaw .= "<p>Remaining dates for Open Curling:\n";
$b->bottomRaw .= "<ul>\n";
}
$b->bottomRaw .= "<li><a href='$url'>$row->edt at $row->etm</a></li>\n";
}
$ix ++;
}
if ($ix > 1) {
$b->bottomRaw .= "</ul>\n";
$b->bottomRaw .= "See the <a href='eventstatus.php'>Events page</a> for more details and signup.</p>\n";
}
$b->display();
}
}
function printLearnToCurl () {
$b = new DynHtmlBlock();
$b->leftRaw = "<img align='left' width=400 height=256 src='image/Maxwell.delivery.jpeg' />";
$eventcdptrn = "LTC%";
if (getEventTypeCount($eventcdptrn) > 0) {
$sql = makeEventQuery($eventcdptrn);
$res = mysql_query($sql)
or die("Error during event select. " . mysql_error());
$ix = 0;
while ($row = mysql_fetch_object($res)) {
$url = "eventstatus.php?eventMask=$row->eventcd";
if ($ix == 0) {
$b->header = "Learn to Curl on $row->edt";
$b->rightRaw .= "<p>";
$b->rightRaw .= "We want to teach you the great sport of curling and we have an event specifically designed for doing so. ";
$b->rightRaw .= "Our next Learn to Curl is scheduled for <strong><a href='$url'>$row->edt at $row->etm</a></strong>. ";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= ($row->mbrprice == $row->guestprice) ?
"The price for this event is \$$row->guestprice. " :
"The member price is \$$row->mbrprice, and the event is \$$row->guestprice for non-members. ";
$b->rightRaw .= "All are welcome -- no experience is necessary. ";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= "We recommend signing up for Learn to Curls online since they can fill quickly. ";
$b->rightRaw .= "Make sure you <a href='login.php'>Login or Register</a> and then go to the ";
$b->rightRaw .= "<a href='eventstatus.php'>Events page</a> to sign up and pay. ";
$b->rightRaw .= "</p>";
} else {
if ($ix == 1) {
$b->bottomRaw .= "<p>Remaining Learn to Curls:\n";
$b->bottomRaw .= "<ul>\n";
}
$b->bottomRaw .= "<li><a href='$url'>$row->edt</a></li>\n";
}
$ix ++;
}
if ($ix > 1) {
$b->bottom .= "</ul>\n";
$b->bottom .= "See the <a href='eventstatus.php'>Events page</a> for more details and signup.</p>\n";
}
$b->display();
}
}
function printPickUpCurling () {
$b = new DynHtmlBlock();
// $b->leftRaw = "<img align='left' width=400 height=256 src='image/Maxwell.delivery.jpeg' />";
$b->leftRaw = "<img align='left' width=400 height=256 src='image/Tatem.delivery.jpeg' />";
$eventcdptrn = "PC%";
if (getEventTypeCount($eventcdptrn) > 0) {
$sql = makeEventQuery($eventcdptrn);
$res = mysql_query($sql)
or die("Error during event select. " . mysql_error());
$ix = 0;
while ($row = mysql_fetch_object($res)) {
$url = "eventstatus.php?eventMask=$row->eventcd";
if ($ix == 0) {
$b->header = "Pickup Curling on $row->edt";
$b->rightRaw .= "<p>";
$b->rightRaw .= "Our next Pickup Curling is at <strong><a href='$url'>$row->edt at $row->etm</a></strong>. ";
$b->rightRaw .= "Come curl with whoever else signs up. Or bring a friend who knows how to curl. Teams will be formed at the event.";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= ($row->mbrprice == $row->guestprice) ?
"The price for this event is \$$row->guestprice. " :
"The member price is \$$row->mbrprice, and the event is \$$row->guestprice for non-members. ";
$b->rightRaw .= "Only curlers that have already learned the basics of curling should come to Pickup Curling ";
$b->rightRaw .= "— there will be no instruction available. ";
$b->rightRaw .= "</p>";
$b->bottomRaw .= "<p>";
$b->bottomRaw .= "Just like with all events, we recommend registering online. ";
$b->bottomRaw .= "Make sure you <a href='login.php'>Login or Register</a> and then go to the ";
$b->bottomRaw .= "<a href='eventstatus.php'>Events page</a> to sign up and pay. ";
$b->bottomRaw .= "</p>";
} else {
if ($ix == 1) {
$b->bottomRaw .= "<p>Remaining Pickup Curling:\n";
$b->bottomRaw .= "<ul>\n";
}
$b->bottomRaw .= "<li><a href='$url'>$row->edt</a></li>\n";
}
$ix ++;
}
if ($ix > 1) {
$b->bottomRaw .= "</ul>\n";
$b->bottomRaw .= "See the <a href='eventstatus.php'>Events page</a> for more details and signup.</p>\n";
}
$b->display();
}
}
function printOpenHouse () {
$b = new DynHtmlBlock();
$b->leftRaw = "<img align='left' width=400 height=256 src='image/Tatem.delivery.jpeg' />";
$eventcdptrn = "OH%a";
if (getEventTypeCount($eventcdptrn) > 0) {
$sql = makeEventQuery($eventcdptrn);
$res = mysql_query($sql)
or die("Error during event select. " . mysql_error());
$ix = 0;
while ($row = mysql_fetch_object($res)) {
$url = "eventstatus.php?eventMask=$row->eventcd";
if ($ix == 0) {
$b->header = "Open House on $row->edt";
$b->rightRaw .= "<p>";
$b->rightRaw .= "Our Open House is the perfect event for a person who wants a taste of what curling is all about. ";
$b->rightRaw .= "The Open House is about a 45-minute experience that will give you a chance to get out on the ice, ";
$b->rightRaw .= "throw a few stones and get the basics.";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= "The Open House will be on <strong>$row->edt from $row->etm until about $row->etmend</strong>. ";
$b->rightRaw .= "Register online to sign up for a specific start time. ";
$b->rightRaw .= "(Your participation will begin within the 30-minute period you register for.) ";
$b->rightRaw .= "</p>";
$b->rightRaw .= "<p>";
$b->rightRaw .= "The price for this event is \$$row->guestprice. ";
$b->rightRaw .= "</p>";
$b->bottomRaw .= "<p>";
$b->bottomRaw .= "To make sure you get the time slot you want, we recommend registering online. ";
$b->bottomRaw .= "Make sure you <a href='login.php'>Login or Register</a> and then go to the ";
$b->bottomRaw .= "<a href='eventstatus.php'>Events page</a> to sign up and pay. ";
$b->bottomRaw .= "</p>";
} else {
if ($ix == 1) {
$b->bottomRaw .= "<p>Additional Open Houses:\n";
$b->bottomRaw .= "<ul>\n";
}
$b->bottomRaw .= "<li>$row->edt</li>\n";
}
$ix ++;
}
if ($ix > 1) {
$b->bottomRaw .= "</ul>\n";
$b->bottomRaw .= "See the <a href='eventstatus.php'>Events page</a> for more details and signup.</p>\n";
}
$b->display();
}
}
# Print the events in order by what comes first
$ocdt = getEventTypeMinDate("OC%");
$ltcdt = getEventTypeMinDate("LTC%");
$pucdt = getEventTypeMinDate("PC%");
$ohdt = getEventTypeMinDate("OH%a");
$occnt = getEventTypeCount("OC%");
$ltccnt = getEventTypeCount("LTC%");
$puccnt = getEventTypeCount("PC%");
$ohcnt = getEventTypeCount("OH%a");
if ($debug) {
echo "<table style='border: thin solid black'>\n";
echo "<tr><th>Event Type</th><th>Next Date</th><th>Count</th></tr>\n";
echo "<tr><td>Open Curling</td><td>$ocdt</td><td>$occnt</td></tr>\n";
echo "<tr><td>Learn to Curl</td><td>$ltcdt</td><td>$ltccnt</td></tr>\n";
echo "<tr><td>Pickup Curling</td><td>$pucdt</td><td>$puccnt</td></tr>\n";
echo "<tr><td>Open House</td><td>$ohdt</td><td>$ohcnt</td></tr>\n";
echo "</table>\n";
}
# if ($ocdt < $ltcdt) {
# if ($pucdt < $ocdt) {
# printPickupCurling();
# printOpenCurling();
# printLearnToCurl();
# } else {
# printOpenCurling();
# if ($pucdt < $ltcdt) {
# printPickupCurling();
# printLearnToCurl();
# } else {
# printPickupCurling();
# printLearnToCurl();
# }
# }
# } else {
# if ($pucdt < $ltcdt) {
# printPickupCurling();
# printLearnToCurl();
# printOpenCurling();
# } else {
# printLearnToCurl();
# if ($pucdt < $ocdt) {
# printPickupCurling();
# printOpenCurling();
# } else {
# printOpenCurling();
# printPickupCurling();
# }
# }
# }
printOpenHouse();
printLearnToCurl();
printOpenCurling();
printPickupCurling();
foreach($page->block as $block)
if ($block->seq >= 1000)
$block->display();
$page->displayFooter();
DynHtmlPage::upcoming();
print "</div><!-- colleft -->\n";
print "</div><!-- colmask -->\n";
DynHtmlPage::footer();
DynHtmlPage::docFooter();
?>