17 require_once SQ_CORE_PACKAGE_PATH.
'/page/page.inc';
18 require_once SQ_FUDGE_PATH.
'/general/text.inc';
19 require_once SQ_PACKAGES_PATH.
'/calendar/lib/calendar_common.inc';
20 require_once SQ_PACKAGES_PATH.
'/calendar/page_templates/page_calendar_rolling/page_calendar_rolling.inc';
45 parent::__construct($assetid);
61 if (!isset($vars[
'keywords'])) {
62 $vars[
'keywords'] = Array();
66 $broadcaster_parents = $GLOBALS[
'SQ_SYSTEM']->am->getParents($broadcaster->id);
67 $format_bodycopy_link = reset($GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->id, SQ_LINK_TYPE_2,
'bodycopy', TRUE,
'major',
'',
'TRUE'));
68 if (!empty($format_bodycopy_link[
'minorid']) && isset($broadcaster_parents[$format_bodycopy_link[
'minorid']])) {
70 $vars[
'keywords'][
'next_link'] =
'Link to the next page of events';
71 $vars[
'keywords'][
'prev_link'] =
'Link to the previous page of events';
74 return parent::onRequestKeywords($broadcaster, $vars);
87 $res = parent::_getPageContentsReplacements();
89 $first_valid_date = substr($this->
attr(
'start_date'), 0, 10);
90 $last_valid_date = substr($this->
attr(
'end_date'), 0, 10);
91 $last_normal_start = date(
'Y-m-d', strtotime(substr($this->
attr(
'end_date'), 0, 10).
' -'.($this->
attr(
'days_per_page')-1).
' days'));
93 $res[
'next_link'] =
'';
94 if ($current_last_date < $last_valid_date) {
95 $next_date = date(
'Y-m-d', strtotime($current_start_date.
' +'.($this->attr(
'days_per_page')).
' days'));
96 $num_days_next = $this->
attr(
'days_per_page');
97 if ($next_date > $last_normal_start) {
98 $num_days_next = days_between_isos($last_valid_date, $next_date) + 1;
100 $url = htmlspecialchars(replace_query_string_vars(Array(
'show_date' => $next_date)));
101 $text = str_replace(
'%n%', $num_days_next, $this->
attr(
'next_text'));
102 $res[
'next_link'] =
'<a href="'.$url.
'">'.$text.
'</a>';
105 $res[
'prev_link'] =
'';
106 if ($current_start_date > $first_valid_date) {
107 $last_date = date(
'Y-m-d', strtotime($current_start_date.
' -'.$this->attr(
'days_per_page').
' days'));
108 $num_days_next = $this->
attr(
'days_per_page');
109 if ($last_date < $first_valid_date) {
110 $last_date = $first_valid_date;
111 $num_days_next = days_between_isos($current_start_date, $last_date) + 1;
113 $url = htmlspecialchars(replace_query_string_vars(Array(
'show_date' => $last_date)));
114 $text = str_replace(
'%n%', $num_days_next, $this->
attr(
'prev_text'));
115 $res[
'prev_link'] =
'<a href="'.$url.
'">'.$text.
'</a>';
133 return parent::_getEvents($first_date, $last_date);
147 $start_date = substr($this->
attr(
'start_date'), 0, 10);
148 $end_date = substr($this->
attr(
'end_date'), 0, 10);
149 $length = $this->
attr(
'days_per_page');
150 $display_date = array_get_index($_REQUEST,
'show_date', date(
'Y-m-d'));
151 if ($display_date < $start_date) {
152 $display_date = $start_date;
154 $last_date = date(
'Y-m-d', strtotime($display_date.
' +'.($length-1).
' days'));
155 if ($last_date > $end_date) $last_date = $end_date;
156 return Array($display_date, $last_date);
169 $end_date = substr($this->
attr(
'end_date'), 0, 10);
170 if ($end_date ==
'----------') {
171 trigger_localised_error(
'CAL0063', E_USER_WARNING, $this->
id);