-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.php
73 lines (69 loc) · 2.38 KB
/
event.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
<?php
include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');
if (perch_get('s')) {
$opts = array(
'filter'=>'eventSlug',
'match'=>'eq',
'value'=>$_GET['s'],
'sort'=>'eventDateTime',
'sort-order'=>'desc',
'skip-template'=>'true'
);
$eventarray = perch_events_custom($opts);
$start = $eventarray[0]['eventDateTime'];
$event = $eventarray[0]['eventTitle'];
$duration = $eventarray[0]['program_duration'];
$duration_hour = floor($duration);
$duration_minute = round(60*($duration-$duration_hour));
$tz = new DateTimeZone(PERCH_TZ);
$date = new DateTime($start, $tz);
$date->modify('+'.$duration_hour.' hours +'.$duration_minute.' minutes');
$endtime = $date->format('g:i a');
$endtimeadd = $date->format('m-d-Y h:i:s A');
if (empty($duration)) {
$endtime = $date->modify('+ 2 hours');
$endtime = $date->format('g:i a');
$endtimeadd = $date->format('m-d-Y h:i:s A');
};
$eventarray[0]['endtimeadd'] = $endtimeadd;
$eventarray[0]['endtime'] = $endtime;
};
if (perch_get('r')) {
$opts = array(
'filter'=>'slug',
'match'=>'eq',
'value'=>$_GET['r'],
'skip-template'=>'true',
'page'=>'/calendar.php'
);
$eventarray = perch_content_custom('Recurring Events', $opts);
$start = $eventarray[0]['eventDateTime'];
$event = $eventarray[0]['eventTitle'];
$duration = $eventarray[0]['program_duration'];
$duration_hour = floor($duration);
$duration_minute = round(60*($duration-$duration_hour));
$tz = new DateTimeZone(PERCH_TZ);
$date = new DateTime($start, $tz);
$date->modify('+'.$duration_hour.' hours +'.$duration_minute.' minutes');
$endtime = $date->format('g:i a');
$endtimeadd = $date->format('m-d-Y h:i:s A');
if (empty($duration)) {
$endtime = $date->modify('+ 2 hours');
$endtime = $date->format('g:i a');
$endtimeadd = $date->format('m-d-Y h:i:s A');
};
$eventarray[0]['endtimeadd'] = $endtimeadd;
$eventarray[0]['endtime'] = $endtime;
}
perch_layout('global.head.calendar');
?>
<?php
// echo($endtimeadd);
// print_r($eventarray);
if (perch_get('s')) {
perch_template('content/_event_page_listing.html', $eventarray);
};
if (perch_get('r')) {
perch_template('content/_recurring_event_page_listing.html', $eventarray);
};
?>