forked from stephenliang/Flourish-Conference-CMS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schedule.php
executable file
·107 lines (86 loc) · 2.64 KB
/
schedule.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
<?php
define('SITE_PATH', './');
define('HACKFREE', 1);
//// INCLUDE INFO
include (SITE_PATH."common.php");
$stmt = $db->stmt_init();
$sql = "SELECT x.id,x.talkTitle,x.talkDescription,x.start_time,x.end_time,x.location,x.speaker,y.name FROM ". TALKS_TABLE ." x, ". SPEAKER_TABLE ." y WHERE x.speaker = y.id AND start_time < 1333170000 ORDER BY start_time ASC";
if ( $stmt->prepare($sql) )
{
$stmt->execute();
$result = $stmt->get_result();
//check for same time talks
$current_hour = 0;
$current_minute = 0;
$i = 0;
$j = 0;
$fri_max_tracks = 0;
while ( $row = $result->fetch_assoc())
{
$hour = date("G", $row['start_time']);
$minute = date("i", $row['start_time']);
$row['start_time'] = date("g:i A", $row['start_time']);
$row['end_time'] = date("g:i A", $row['end_time']);
$row['hour'] = $hour;
$row['minute'] = $minute;
if ( $hour != $current_hour || $minute != $current_minute )
{
$i++;
$j = 0;
}else{
$j++;
}
if ( $j > $fri_max_tracks ) $fri_max_tracks = $j;
$talksFri[$i][$j] = $row;
$current_hour = $hour;
$current_minute = $minute;
}
}
$sql = "SELECT x.id,x.talkTitle,x.talkDescription,x.start_time,x.end_time,x.location,x.speaker,y.name FROM ". TALKS_TABLE ." x, ". SPEAKER_TABLE ." y WHERE x.speaker = y.id AND start_time >= 1333170000 ORDER BY start_time ASC";
if ( $stmt->prepare($sql) )
{
$stmt->execute();
$result = $stmt->get_result();
//check for same time talks
$current_hour = 0;
$current_minute = 0;
$i = 0;
$j = 0;
$sat_max_tracks = 0;
while ( $row = $result->fetch_assoc())
{
$hour = date("G", $row['start_time']);
$minute = date("i", $row['start_time']);
$row['start_time'] = date("g:i A", $row['start_time']);
$row['end_time'] = date("g:i A", $row['end_time']);
$row['hour'] = $hour;
$row['minute'] = $minute;
if ( $hour != $current_hour || $minute != $current_minute )
{
$i++;
$j = 0;
}else{
$j++;
}
if ( $j > $sat_max_tracks ) $sat_max_tracks = $j;
//This is a hack for flourish 2012.. perhaps change it later?
if ( $row['location'] == "Illinois A" || $row['name'] == "" || $row['name'] == "Chris McAvoy" )
$talksSat[$i][0] = $row;
elseif ( $row['location'] == "Illinois B" || $row['location'] == "White Oak Room" )
$talksSat[$i][1] = $row;
else
$talksSat[$i][2] = $row;
$current_hour = $hour;
$current_minute = $minute;
}
}
$stmt->close();
$smarty->assign('talksFri', $talksFri);
$smarty->assign('talksSat', $talksSat);
$smarty->assign('satTracks', $sat_max_tracks+1);
$smarty->assign('friTracks', $fri_max_tracks+1);
//We reached end, parse and end
include (SITE_PATH."footer.php");
$smarty->display('schedule.tpl');
//We're out of here.
?>