From a0a7d7f0979d6d4bf6c2f39a0e2425d489112aea Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 5 Feb 2004 23:45:54 +0000 Subject: Wired Tomorrow's Events with new function. --- day.php | 3 +++ functions/template.php | 42 +++++++++++++++++++++++++++++++++++++++++- templates/default/sidebar.tpl | 10 +++++----- week.php | 3 ++- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/day.php b/day.php index 4a7fc99..6c602a4 100644 --- a/day.php +++ b/day.php @@ -21,6 +21,7 @@ $next_day = date('Ymd', strtotime("+1 day", $unix_time)); $prev_day = date('Ymd', strtotime("-1 day", $unix_time)); $display_date = localizeDate($dateFormat_day, $unix_time); +$sidebar_date = localizeDate($dateFormat_week_list, $unix_time); $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day)); @@ -44,6 +45,7 @@ $page->replace_tags(array( 'getdate' => $getdate, 'calendar_name' => $calendar_name, 'display_date' => $display_date, + 'sidebar_date' => $sidebar_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', @@ -63,6 +65,7 @@ $page->replace_tags(array( )); $page->draw_day($this->page); +$page->tomorrows_events($this->page); $page->output(); diff --git a/functions/template.php b/functions/template.php index e7bc7f1..ab0c742 100644 --- a/functions/template.php +++ b/functions/template.php @@ -18,7 +18,7 @@ class Page { $event_url = $allday['url']; if ($event_calno < 1) $event_calno=1; if ($event_calno > 7) $event_calno=7; - $event = openevent($event_calna, '', '', $allday, 0, '', '', '', 'psf', $url); + $event = openevent($event_calna, '', '', $allday, 0, '', '', '', 'psf', $event_url); $loop_tmp = str_replace('{EVENT}', $event, $loop_ad); $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp); $replace .= $loop_tmp; @@ -45,6 +45,46 @@ class Page { } + function tomorrows_events() { + global $template, $getdate, $master_array, $next_day, $timeFormat; + + preg_match("!<\!-- switch t_allday on -->(.*)<\!-- switch t_allday off -->!is", $this->page, $match1); + preg_match("!<\!-- switch t_event on -->(.*)<\!-- switch t_event off -->!is", $this->page, $match2); + $loop_t_ad = trim($match1[1]); + $loop_t_e = trim($match2[1]); + $return_adtmp = ''; + $return_etmp = ''; + + if (is_array($master_array[$next_day])) { + foreach ($master_array[$next_day] as $event_times) { + foreach ($event_times as $val) { + $event_text = stripslashes(urldecode($val["event_text"])); + $event_text = strip_tags($event_text, ''); + if ($event_text != "") { + $event_start = $val["event_start"]; + $event_end = $val["event_end"]; + $event_calna = $val["calname"]; + $event_url = $val["url"]; + $event_start = date ($timeFormat, @strtotime ($event_start)); + $event_end = date ($timeFormat, @strtotime ($event_end)); + if (!isset($val["event_start"])) { + $event_start = $lang['l_all_day']; + $event_end = ''; + $return_adtmp = openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '', '', 'psf', $event_url); + $replace_ad .= str_replace('{T_ALLDAY}', $return_adtmp, $loop_t_ad); + } else { + $return_etmp = openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '', '', 'ps3', $event_url); + $replace_e .= str_replace('{T_EVENT}', $return_etmp, $loop_t_e); + } + } + } + } + } + + $this->page = ereg_replace('(.*)', $replace_ad, $this->page); + $this->page = ereg_replace('(.*)', $replace_e, $this->page); + } + function draw_month($template_p, $offset = '+0', $type) { global $template, $getdate, $master_array, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat; preg_match("!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is", $template_p, $match1); diff --git a/templates/default/sidebar.tpl b/templates/default/sidebar.tpl index 48a4062..f0d64e3 100644 --- a/templates/default/sidebar.tpl +++ b/templates/default/sidebar.tpl @@ -1,8 +1,8 @@ - - - + + + diff --git a/week.php b/week.php index ebb08ab..8edc416 100644 --- a/week.php +++ b/week.php @@ -10,7 +10,6 @@ if ($minical_view == "current") $minical_view = "week"; $starttime = "0500"; $weekstart = 1; $unix_time = strtotime($getdate); -$thisday2 = localizeDate($dateFormat_week_list, $unix_time); $today_today = date('Ymd', strtotime("now + $second_offset seconds")); $next_week = date("Ymd", strtotime("+1 week", $unix_time)); $prev_week = date("Ymd", strtotime("-1 week", $unix_time)); @@ -21,6 +20,7 @@ $end_week_time = $start_week_time + (6 * 25 * 60 * 60); $start_week = localizeDate($dateFormat_week, $start_week_time); $end_week = localizeDate($dateFormat_week, $end_week_time); $display_date = "$start_week - $end_week"; +$sidebar_date = localizeDate($dateFormat_week_list, $unix_time); // For the side months ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); @@ -48,6 +48,7 @@ $page->replace_tags(array( 'getdate' => $getdate, 'calendar_name' => $calendar_name, 'display_date' => $display_date, + 'sidebar_date' => $sidebar_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', -- cgit v1.2.3
{PREV_LANG}{DISPLAY_DATE}{NEXT_LANG}{L_PREV}{SIDEBAR_DATE}{L_NEXT}
@@ -79,10 +79,10 @@
- {T_ALLDAY}
+ {T_ALLDAY}
- • {T_EVENT}
+ • {T_EVENT}