forked from waveney/chippenham
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhatsOnNow.php
More file actions
executable file
·132 lines (108 loc) · 4.73 KB
/
WhatsOnNow.php
File metadata and controls
executable file
·132 lines (108 loc) · 4.73 KB
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
<?php
include_once("int/fest.php");
include_once("int/ProgLib.php");
include_once("int/DateTime.php");
include_once("int/DispLib.php");
include_once("int/DanceLib.php");
include_once("int/MusicLib.php");
global $db,$YEAR,$SHOWYEAR,$YEARDATA,$DayList,$DayLongList,$Event_Types ;
global $PLANYEAR;
$Vens = Get_Venues(1);
/* Get all events that are public, sort by day, time
opening display is each day - click to expand
sub events are shown
find those with start < (now +1.5 hrs) & end >=now)
if day !=0-2 (1.5hrs = whole day)
More to come from event states and general
Add Type to selection later
*/
$Poster = 0;
// var_dump($_REQUEST);
if (isset($_REQUEST['AtDate'])) {
$date = Date_BestGuess($_REQUEST['AtDate'] ?? '31/12/2000');
$time = Time_BestGuess($_REQUEST['AtTime'] ?? '14:00');
// var_dump($date,$time);
$now = $date + timereal($time)*60;
dominimalhead("Whats on",['files/Newstyle.css'],1);
$Poster = 1;
$Link = 0;
$Now = getdate($now);
} else {
$now = time();
$Link = 1;
dohead("Whats on Now",[],1);
$Now = getdate($now);
$Now['hours']++; // Festivals is BST server is UTC
}
// Fudge for testing...
// $Now['mon'] = 6;
// $Now['mday']= 9;
$StartTime = mktime(0,0,0,$YEARDATA['MonthFri'],$YEARDATA['DateFri']+$YEARDATA['FirstDay'],substr($PLANYEAR,0,4));
$EndTime = mktime(23,59,59,$YEARDATA['MonthFri'],$YEARDATA['DateFri']+$YEARDATA['LastDay'],substr($PLANYEAR,0,4));
//var_dump($now,$StartTime,$EndTime);
if ($now < $StartTime || $now > $EndTime) {
echo "<h3>There are no festival events today</h3>\n";
dotail();
}
/*
if (($Now['year'] != $SHOWYEAR) || ($Now['mon'] != 6) || ($Now['mday'] < ($YEARDATA['DateFri']-3)) || ($Now['mday'] > ($YEARDATA['DateFri']+3))) { // Not during festival
}
*/
$xtr = isset($_REQUEST['Mode'])?'':"AND ( e.Public=1 OR (e.Type=t.ETypeNo AND t.State>1 AND e.Public<2 ))";
$today = ($Now['mday']-$YEARDATA['DateFri']);
$res = $db->query("SELECT DISTINCT e.* FROM Events e, EventTypes t WHERE e.Year='$YEAR' AND Day=$today AND t.Public=1 $xtr ORDER BY Start");
if ($Poster) {
$StartLim = $Now['hours']*100 + $Now['minutes'] + 100;
$EndLim = $StartLim;
} else {
$StartLim = (($today < 0 || $today>2) ? 2400 : ($Now['hours']+2)*100 );
$EndLim = (($today < 0 || $today>2) ? 0 : ($Now['hours'])*100 + $Now['minutes']);
}
if (!$res || $res->num_rows==0) {
echo "<h3>There are no festival events today</h3>\n";
dotail();
}
// var_dump($StartLim,$EndLim);
if (!$Poster) echo "<h2 class=subtitle>What is on Now?</h2>";
echo "<script src=/js/WhatsWhen.js></script>";
$something = 0;
while( $e = $res->fetch_assoc()) {
$eid = $e['EventId'];
/* New day give table header, links to Dance Grid/Music Grid (if applicable), Events have click to expand */
if ($e['Start'] >= $StartLim) continue;
if ($e['End'] < $EndLim) continue;
if ((($e['SubEvent'] < 0) && ($e['SlotEnd'] < $EndLim) && !$e['IsConcert'] ) || ($e['IsConcert'] && ($e['SubEvent']>0))) continue;
if ($e['BigEvent'] == 0) {
if ($e['Side1'] == 0 && $e['Side2'] == 0 && $e['Side3'] == 0 && $e['Side4'] == 0 && $e['NoPart'] == 0) continue; // Nobody there
}
$dname = $DayLongList[$e['Day']];
if (DayTable($e['Day'],"Events",($Poster?(" in the next hour or so "):''),'style=min-width:1000')) {
echo "<tr class=Day$dname><td>Time<td >What<td>Where" . ($Poster?'':"<td>With") . "<td>Price";
}
$imps = [];
$Others = [];
Get_Imps($e,$imps,1,(Access('Staff')?1:0));
echo "<tr class=Day$dname><td>" . timecolon($e['Start']) . " - " . timecolon($e['End']);
echo "<td>" . ($Poster? $e['SN'] : "<a href=/int/EventShow?e=$eid>" . $e['SN'] . "</a>");
$With = ($e['BigEvent'] ? Get_Other_Participants($Others,0,$Link,15,1,'',$e) : Get_Event_Participants($eid,0,$Link,15));
if ($e['Description']) echo "<br>" . $e['Description'];
if ($Poster) echo "<br>With: $With";
echo "<td>" . ($Poster? $Vens[$e['Venue']]['SN'] : Venue_Parents($Vens,$e['Venue']) . "<a href=/int/VenueShow?v=" . $e['Venue'] . ">" . $Vens[$e['Venue']]['SN'] . "</a>");
if ($e['BigEvent']) {
$Others = Get_Other_Things_For($eid);
foreach ($Others as $i=>$o) {
if (($o['Type'] == 'Venue') && ($o['Identifier']>0) ) {
echo ", " . ($Poster? $Vens[$o['Identifier']]['SN'] : Venue_Parents($Vens,$o['Identifier']) . "<a href=/int/VenueShow?v=" . $o['Identifier'] . ">" .
$Vens[$o['Identifier']]['SN'] . "</a>");
}
}
}
if (!$Poster) echo "<td>$With";
echo "<td>" . Price_Show($e,1);
$something = 1;
}
echo "</table>\n";
if ($something == 0) {
echo "<h3>There are no festival events later today</h3>\n";
}
if (!$Poster) dotail();