From b8fc4e4cb1d3a574a8a624fa5a357c005fe73ac4 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 3 Feb 2004 06:22:29 +0000 Subject: Updates and initial wiring of day.tpl and day.php. --- day.php | 323 +++++++++------------------------------------------------------- 1 file changed, 44 insertions(+), 279 deletions(-) (limited to 'day.php') diff --git a/day.php b/day.php index 220903d..1be782d 100644 --- a/day.php +++ b/day.php @@ -9,291 +9,56 @@ if (isset($HTTP_GET_VARS['jumpto_day'])) { } define('BASE', './'); $current_view = 'day'; -include(BASE.'functions/ical_parser.php'); +require_once(BASE.'functions/ical_parser.php'); +require_once(BASE.'functions/template.php'); if ($minical_view == 'current') $minical_view = 'day'; -$starttime = '0500'; -$weekstart = 1; -$unix_time = strtotime($getdate); -$today_today = date('Ymd', strtotime("now + $second_offset seconds")); -$tomorrows_date = date( 'Ymd', strtotime('+1 day', $unix_time)); -$yesterdays_date = date( 'Ymd', strtotime('-1 day', $unix_time)); -$display_date = localizeDate($dateFormat_day, $unix_time); +$weekstart = 1; +$unix_time = strtotime($getdate); +$today_today = date('Ymd', strtotime("now + $second_offset seconds")); +$next_day = date('Ymd', strtotime("+1 day", $unix_time)); +$prev_day = date('Ymd', strtotime("-1 day", $unix_time)); -// For the side months -ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $getdate, $day_array2); -$this_day = $day_array2[3]; -$this_month = $day_array2[2]; -$this_year = $day_array2[1]; - -$parse_month = date ('Ym', $unix_time); -$thisday2 = localizeDate($dateFormat_week_list, $unix_time); +$display_date = localizeDate($dateFormat_week_list, $unix_time); $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day)); -$dayborder = 0; -$nbrGridCols = 1; -if (isset($master_array[($getdate)])) { - foreach($master_array[($getdate)] as $ovlKey => $ovlValue) { - if ($ovlKey != '-1') { - foreach($ovlValue as $ovl2Value) { - $nbrGridCols = kgv($nbrGridCols, ($ovl2Value['event_overlap'] + 1)); - } - } - } -} -include (BASE.'includes/header.inc.php'); +// select for calendars +$list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED)); +$list_years = list_years(); +$list_months = list_months(); +$list_weeks = list_weeks(); + +$page = new Page(BASE.'templates/'.$template.'/DAY.tpl'); -?> -
- - - - - - -
- - - - - - - -
- - - - - - -
-
- - \n"; - echo ''."\n"; - echo ''."\n"; - } - if ($daysofweek_dayview == 'yes') { - ?> +$page->replace_tags(array( + 'header' => BASE.'templates/'.$template.'/header.tpl', + 'footer' => BASE.'templates/'.$template.'/footer.tpl', + 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl', + 'event_js' => BASE.'functions/event.js', + 'template' => $template, + 'cal' => $cal, + 'getdate' => $getdate, + 'calendar_name' => $calendar_name, + 'display_date' => $display_date, + 'rss_powered' => $rss_powered, + 'rss_available' => '', + 'rss_valid' => '', + 'todo_js' => '', + 'show_search' => '', + 'next_day' => $next_day, + 'prev_day' => $prev_day, + 'show_goto' => '', + 'is_logged_in' => '', + 'list_icals' => $list_icals, + 'list_years' => $list_years, + 'list_months' => $list_months, + 'list_weeks' => $list_weeks, + 'style_select' => $style_select + )); + +$page->monthbottom($this->page); - - '; - echo ''; - } - ?> - - - - -
'."\n"; - echo ''."\n"; - foreach($master_array[($getdate)]['-1'] as $allday) { - echo "\n"; - $event_calno = $allday['calnumber']; - $event_calna = $allday['calname']; - $event_url = $allday['url']; - if ($event_calno < 1) $event_calno=1; - if ($event_calno > 7) $event_calno=7; - echo '\n\n"; - } - echo '
'; - openevent($event_calna, '', '', $allday, 0, '', '', '', 'psf', $url); - echo "
'."\n"; - echo '
- - '; - echo ""; - $thisdate = $start_week_time; - $start_day = strtotime($week_start_day); - $i = 0; - do { - $day_num = date("w", $start_day); - $day = $daysofweek_lang[$day_num]; - $thisday = date("Ymd", $thisdate); - echo "\n"; - $start_day = strtotime("+1 day", $start_day); - $thisdate = strtotime("+1 day", $thisdate); - $i++; - } while ($i < 7); - echo ''; - echo '
\n"; - echo "$day\n"; - echo "
'; - echo '
- - - - -  '; - } ?> - - 0) { - $this_time_arr = $master_array[$getdate][$cal_time]; - } - - // add events that overlap $day_start instead of cutting them out completely - if ("$day_start" == "$cal_time" && isset($master_array[$getdate])) { - foreach($master_array[$getdate] as $time_key => $time_arr) { - if ((int)$time_key < (int)$cal_time && is_array($time_arr) && $time_key != '-1') { - foreach($time_arr as $event_tmp) { - if ((int)$event_tmp['event_end'] > (int)$cal_time) { - $this_time_arr[] = $event_tmp; - } - } - } else { - break; - } - } - } - - // check for eventstart - if (isset($this_time_arr) && sizeof($this_time_arr) > 0) { - foreach ($this_time_arr as $eventKey => $loopevent) { - $drawEvent = drawEventTimes ($cal_time, $loopevent['event_end']); - $j = 0; - while (isset($event_length[$j])) { - if ($event_length[$j]['state'] == 'ended') { - $event_length[$j] = array ('length' => ($drawEvent['draw_length'] / $gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin'); - break; - } - $j++; - } - if ($j == sizeof($event_length)) { - array_push ($event_length, array ('length' => ($drawEvent['draw_length'] / $gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin')); - } - } - } - if (ereg('([0-9]{1,2}):00', $key)) { - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - } elseif("$cal_time" == "$day_start") { - $size_tmp = 60 - (int)substr($cal_time,2,2); - echo "\n"; - echo "\n"; - echo "\n"; - } else { - echo ''."\n"; - echo ''."\n"; - } - if ($dayborder == 0) { - $class = ' class="dayborder"'; - $dayborder++; - } else { - $class = ' class="dayborder2"'; - $dayborder = 0; - } - if (sizeof($event_length) == 0) { - echo ''."\n"; - - } else { - $emptyWidth = $nbrGridCols; - for ($i=0;$i 7) $event_calno = 7; - - echo ''."\n"; - break; - case 'started': - break; - case 'ended': - echo ''."\n"; - break; - } - $event_length[$i]['length']--; - if ($event_length[$i]['length'] == 0) { - $event_length[$i]['state'] = 'ended'; - } - } - //fill emtpy space on the right - if ($emptyWidth > 0) { - echo ''."\n"; - } - while (isset($event_length[(sizeof($event_length) - 1)]) && $event_length[(sizeof($event_length) - 1)]['state'] == 'ended') { - array_pop($event_length); - } - - } - echo ''."\n"; - } - - ?> -
'.$key.'
$key
 '."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - if ($event_status != '') { - echo ''."\n"; - } - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo '
'.$event_start.' - '.$event_end.''; - echo ''; - echo '
'."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo '
'; - $event_calna = $this_time_arr[($event_length[$i]['key'])]['calname']; - $event_url = $this_time_arr[($event_length[$i]['key'])]['url']; - openevent($event_calna, $event_start, $event_end, $this_time_arr[($event_length[$i]['key'])], '', 0, '', '', 'psf', $event_url); - echo '
'."\n"; - echo '
'."\n"; - echo '
  
-
-
-
 - -
-
- +$page->output(); +?> \ No newline at end of file -- cgit v1.2.3