forked from elsplatto/hcf-btw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.php
260 lines (215 loc) · 8.97 KB
/
events.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
<?php
$pageMetaTitle = "Beyond the Wharf - Events";
$pageSection = "events";
$pageMetaDesc = "Find and share events that are coming up on Sydney Harbour.";
include 'includes/head.php';
function getEvents($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE)
{
$str = 'events';
$query = 'SELECT tiles.start_date, tiles.end_date, tiles.title, types.title as type_title, categories.title AS category_title, ';
$query .= 'tiles.image_thumb, tiles.image_thumb_med, tiles.tile_size, tiles.alt, tiles.id FROM tiles ';
$query .= 'JOIN types ON (tiles.type_id = types.id) ';
$query .= 'LEFT OUTER JOIN categories ON (tiles.category_id = categories.id) ';
$query .= 'WHERE types.title = ? AND tiles.start_date > ' . time() .' OR tiles.end_date > '. time() .' AND tiles.is_live = 1 ORDER BY tiles.start_date';
//echo 'query['.$query.']';
$mysqli = new mysqli($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
$stmt = $mysqli->prepare($query);
$stmt->bind_param('s', $str);
$stmt->execute();
$stmt->bind_result($start_date, $end_date, $title, $type_title, $category_title, $image_thumb, $image_thumb_med, $tile_size, $alt, $tile_id);
$results = array();
$i = 0;
while($stmt->fetch())
{
$results[$i]['start_date'] = $start_date;
$results[$i]['end_date'] = $end_date;
$results[$i]['title'] = $title;
$results[$i]['type_title'] = $type_title;
$results[$i]['category_title'] = $category_title;
$results[$i]['image_thumb'] = $image_thumb;
$results[$i]['image_thumb_med'] = $image_thumb_med;
$results[$i]['tile_size'] = $tile_size;
$results[$i]['alt'] = $alt;
$results[$i]['tile_id'] = $tile_id;
$i++;
}
$stmt->close();
$mysqli->close();
return $results;
}
function getFeaturedEvent($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE)
{
$query = 'SELECT tiles.start_date, tiles.end_date, tiles.title, types.title as type_title, categories.title AS category_title, ';
$query .= 'tiles.image_thumb, tiles.image_large, tiles.alt, tiles.id FROM tiles ';
$query .= 'JOIN types ON (tiles.type_id = types.id) ';
$query .= 'LEFT OUTER JOIN categories ON (tiles.category_id = categories.id) ';
$query .= 'WHERE tiles.is_feature_event = 1';
$mysqli = new mysqli($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
$stmt = $mysqli->prepare($query);
$stmt->execute();
$stmt->bind_result($start_date, $end_date, $title, $type_title, $category_title, $image_thumb, $image_large, $alt, $tile_id);
$results = array();
$i = 0;
while($stmt->fetch())
{
$results[$i]['start_date'] = $start_date;
$results[$i]['end_date'] = $end_date;
$results[$i]['title'] = $title;
$results[$i]['type_title'] = $type_title;
$results[$i]['category_title'] = $category_title;
$results[$i]['image_thumb'] = $image_thumb;
$results[$i]['image_large'] = $image_large;
$results[$i]['alt'] = $alt;
$results[$i]['tile_id'] = $tile_id;
$i++;
}
$stmt->close();
$mysqli->close();
return $results;
}
$events = getEvents($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
$featureEvents = getFeaturedEvent($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
?>
<body>
<?php
include 'includes/nav.php';
?>
<section class="breadcrumbsHolder">
<div class="row">
<div class="large-12 columns breadcrumbs">
<a href="<?=$baseURL?>/">Home</a><span>Events</span>
</div>
</div>
</section>
<section class="featureEvents marginBottomStandard">
<div class="row marginTop20">
<div class="large-12 columns">
<?php
include 'includes/addthis.php';
?>
<h2 class="block clearfix text-left">Harbour Event Diary</h2>
</div>
<?php
foreach ($featureEvents as $featureEvent)
{
$feature_start_date = getdate($featureEvent['start_date']);
$feature_end_date = getdate($featureEvent['end_date']);
$feature_start_hour = $feature_start_date['hours'];
$feature_start_mins = $feature_start_date['minutes'];
$feature_end_hour = $feature_end_date['hours'];
$feature_end_mins = $feature_end_date['minutes'];
if ($feature_start_hour == 0 && $feature_start_mins == 0)
{
$display_start_date = date('d F',$featureEvent['start_date']);
}
else
{
$display_start_date = date('d F Y H:i',$featureEvent['start_date']);
}
if ($feature_end_hour == 0 && $feature_end_mins == 0)
{
$display_end_date = date('d F',$featureEvent['end_date']);
}
else
{
$display_end_date = date('d F Y H:i',$featureEvent['end_date']);
}
?>
<div class="small-12 medium-9 large-9 columns left">
<div class="large-12 small-12 eventFeature">
<img src="<?=$baseURL?>/img/locations/large/<?=$featureEvent['image_large']?>" alt="<?=$featureEvent['title']?>" />
<div class="infoContainer">
<div class="inner">
<h5><a href="#" class="panelFlyoutTrigger" data-location="<?=$featureEvent['tile_id']?>" data-target="featureEventPanelHolder" title="Link opens event details in dynamic panel." onClick="trackInternalLink('Feature Event Panel - click', '<?=$featureEvent['title']?>'); return false;"><?=$featureEvent['title']?></a></h5>
<span><?=$display_start_date?> - <?=$display_end_date?></span>
</div>
</div>
</div>
</div>
<?php
break;
}
?>
<div class="small-6 medium-3 large-3 columns">
<div class="small-12 medium-12 large-12 insta">
<img src="<?=$baseURL?>/img/btwTile.gif" alt="" />
</div>
</div>
<div class="small-6 medium-3 large-3 columns">
<div class="small-12 medium-12 large-12 insta">
<a href="mailto:events@beyondthewharf.com.au"><img src="<?=$baseURL?>/img/content/emailus-message-tile.gif" alt="Have an event to promote - click here to let us know about it." /></a>
</div>
</div>
</div>
</section>
<section class="eventTileHolder standardLightGrey paddingTopBottom20 marginBottomStandard">
<div class="row marginBottomStandard">
<div id="featureEventPanelHolder" class="large-12 medium-12 small-12 columns"></div>
<?php
$present_timestamp = getdate(time());
$present_month_num = $present_timestamp['mon'];
$present_month_name = $present_timestamp['month'];
$event_count = 0;
$flyout_count = 0;
$last_month_name = '';
$new_month = false;
foreach ($events as $event)
{
$event_count++;
$start_date = getdate($event['start_date']);
$month_name = $start_date['month'];
$month_num = $start_date['mon'];
if ($month_num < $present_month_num) {
$month_name = $present_month_name;
}
if ($last_month_name !== $month_name)
{
$new_month = true;
$flyout_count++;
?>
<div id="panelHolder-<?=$flyout_count?>" class="large-12 medium-12 small-12 columns"></div>
<div class="large-12 columns">
<h3 class="text-center"><?=$month_name?></h3>
</div>
<?php
}
else
{
$new_month = false;
}
?>
<div class="large-3 medium-6 small-12 columns left">
<div class="tile">
<div class="imgHolder">
<img src="<?=$baseURL?>/img/locations/thumbnails/<?=$event['image_thumb']?>" alt="<?=$event['alt']?>" />
</div>
<div class="textHolder">
<span><?=$event['type_title']?></span>
<h5><a href="#" class="panelFlyoutTrigger" data-location="<?=$event['tile_id']?>" data-target="panelHolder-<?=($flyout_count+1)?>" title="<?=$event['title']?>" onClick="trackInternalLink('Standard Event Tile - click', '<?=addslashes($event['title'])?>'); return false;"><?=$event['title']?></a></h5>
</div>
</div>
</div>
<?php
$last_month_name = $month_name;
if ($event_count == count($events))
{
?><div id="panelHolder-<?=($flyout_count+1)?>" class="large-12 columns"></div><?php
}
}
?>
</div>
</section>
<?php
include 'includes/footer.php';
?>
<?php
$pageId = 3;
include 'includes/global-js.php';
?>
<?php
include 'includes/analytics.php';
?>
<script>
</script>
</body>
</html>