This repository has been archived by the owner on Sep 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next_event_menu.php
106 lines (82 loc) · 3.12 KB
/
next_event_menu.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
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Forthcoming events menu handler for event calendar
*
*/
if (!defined('e107_INIT'))
{
exit;
}
$e107 = e107::getInstance();
if (!$e107->isInstalled('calendar_menu')) return '';
if (!isset($ecal_class) || !is_object($ecal_class))
{
require_once(e_PLUGIN . 'calendar_menu/ecal_class.php');
$ecal_class = new ecal_class;
}
// See if the page is already in the cache
$cache_tag = 'nq_event_cal_next';
if ($cacheData = $e107->ecache->retrieve($cache_tag, $ecal_class->max_cache_time))
{
echo $cacheData;
return;
}
e107::lan('calendar_menu', e_LANGUAGE, false);
$calSc = e107::getScBatch('calendar_menu', true);
//require_once(e_PLUGIN.'calendar_menu/calendar_shortcodes.php');
//$calSc = new event_calendar_shortcodes();
$calendartemplate = e107::getTemplate('calendar_menu', 'calendar', 'next_event_menu');
$calSc->wrapper('calendar/next_event_menu');
$EVENT_CAL_FE_LINE = $calendartemplate['cal_fe_line'];
// Values defined through admin pages
$menu_title = varset($ecal_class->pref['eventpost_menuheading'], EC_LAN_140);
$days_ahead = varset($ecal_class->pref['eventpost_daysforward'], 30); // Number of days ahead to go
$show_count = varset($ecal_class->pref['eventpost_numevents'], 3); // Number of events to show
$show_recurring = varset($ecal_class->pref['eventpost_checkrecur'], 1); // Zero to exclude recurring events
$link_in_heading = varset($ecal_class->pref['eventpost_linkheader'], 0); // Zero for simple heading, 1 to have clickable link
$start_time = $ecal_class->cal_timedate;
$end_time = $start_time + (86400 * $days_ahead) - 1;
$cal_text = '';
$calSc->ecalClass = &$ecal_class; // Give shortcodes a pointer to calendar class
$ev_list = $ecal_class->get_n_events(
$show_count,
$start_time,
$end_time,
varset($ecal_class->pref['eventpost_fe_set'], FALSE),
$show_recurring,
'event_id,event_start, event_thread, event_title, event_recurring, event_allday, event_category',
'event_cat_icon'
);
$cal_totev = count($ev_list);
if ($cal_totev > 0)
{
foreach ($ev_list as $thisEvent)
{
$cal_totev--; // Can use this to modify inter-event gap
$calSc->numEvents = $cal_totev; // Number of events to display
$calSc->event = $thisEvent; // Give shortcodes the event data
$cal_text .= $tp->parseTemplate($EVENT_CAL_FE_LINE, FALSE, $calSc);
}
}
else
{
if ($this->ecal_class->pref['eventpost_fe_hideifnone']) return '';
$cal_text .= EC_LAN_141;
}
$calendar_title = $tp->toHTML($menu_title, FALSE, 'TITLE'); // Allows multi-language title, shortcodes
if ($link_in_heading == 1)
{
$calendar_title = "<a class='forumlink' href='" . e_PLUGIN_ABS . "calendar_menu/event.php' >" . $calendar_title . "</a>";
}
// Now handle the data, cache as well
ob_start(); // Set up a new output buffer
e107::getRender()->tablerender($calendar_title, $cal_text, 'next_event_menu');
$cache_data = ob_get_flush(); // Get the page content, and display it
$e107->ecache->set($cache_tag, $cache_data); // Save to cache
unset($ev_list);