From 30027f73164beba826a969f7dc9e9ebd2cd15b8e Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 5 Feb 2004 06:34:56 +0000 Subject: Added week template. --- week.php | 386 ++++++++------------------------------------------------------- 1 file changed, 44 insertions(+), 342 deletions(-) (limited to 'week.php') diff --git a/week.php b/week.php index bb14818..ebb08ab 100644 --- a/week.php +++ b/week.php @@ -2,7 +2,9 @@ $current_view = "week"; define('BASE', './'); -include(BASE.'functions/ical_parser.php'); +require_once(BASE.'functions/ical_parser.php'); +require_once(BASE.'functions/list_functions.php'); +require_once(BASE.'functions/template.php'); if ($minical_view == "current") $minical_view = "week"; $starttime = "0500"; @@ -22,350 +24,50 @@ $display_date = "$start_week - $end_week"; // For the side months ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); -$this_day = $day_array2[3]; +$this_day = $day_array2[3]; $this_month = $day_array2[2]; -$this_year = $day_array2[1]; +$this_year = $day_array2[1]; -$dayborder = 0; -$thisdate = $start_week_time; -for ($i=0;$i<7;$i++) { - $thisday = date("Ymd", $thisdate); - $nbrGridCols[$thisday] = 1; - if (isset($master_array[$thisday])) { - foreach($master_array[($thisday)] as $ovlKey => $ovlValue) { - if ($ovlKey != "-1") { - foreach($ovlValue as $ovl2Value) { - $nbrGridCols[($thisday)] = kgv($nbrGridCols[($thisday)], ($ovl2Value["event_overlap"] + 1)); - } - } - } - } - $thisdate = ($thisdate + (25 * 60 * 60)); -} -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(); +$list_jumps = list_jumps(); +$list_calcolors = list_calcolors(); -?> +$page = new Page(BASE.'templates/'.$template.'/week.tpl'); -
- - - - - - -
- - - - - - - -
- - - - - - -
-
- - - - -
- - - - - \"\n"; - } - $thisdate = ($thisdate + (25 * 60 * 60)); - $i++; - } while ($i < 7); - ?> - - "; - $thisdate = $start_week_time; - $i = 0; - echo ""; - echo ""; - do { - $thisday = date("Ymd", $thisdate); - $thisday3 = localizeDate($dateFormat_week_list, $thisdate); - echo "\n"; - $thisdate = ($thisdate + (25 * 60 * 60)); - $i++; - } while ($i < 7); - echo ""; - ?> - - - - \"\n"; - } - $thisdate = ($thisdate + (25 * 60 * 60)); - $i++; - } while ($i < 7); - ?> - - \n"; - echo ""; - do { - $thisday = date("Ymd", $thisdate); - echo "\n"; - $thisdate = ($thisdate + (25 * 60 * 60)); - $i++; - } while ($i < 7); - echo "\n"; - } - $thisdate = $start_week_time; - for ($i=0;$i<7;$i++) { - $thisday = date("Ymd", $thisdate); - $event_length[$thisday] = array (); - $thisdate = ($thisdate + (25 * 60 * 60)); - } - foreach ($day_array as $key) { - $cal_time = $key; - ereg('([0-9]{2})([0-9]{2})', $key, $regs_tmp); - $key = mktime($regs_tmp[1],$regs_tmp[2],0,$this_month,$this_day,$this_year); - $key = date ($timeFormat, $key); - - - 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"; - } - - // initialize $thisdate again - $thisdate = $start_week_time; - - // loop this part 7 times, one for each day - - for ($week_loop=0; $week_loop<7; $week_loop++) { - $thisday = date("Ymd", $thisdate); - $dayborder = 0; - unset($this_time_arr); - if (isset($master_array[$thisday][$cal_time]) && sizeof($master_array[$thisday][$cal_time]) > 0) { - $this_time_arr = $master_array[$thisday][$cal_time]; - } - - if ("$day_start" == "$cal_time" && isset($master_array[$thisday]) && is_array($master_array[$thisday])) { - foreach($master_array[$thisday] 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[$thisday][$j])) { - if ($event_length[$thisday][$j]["state"] == "ended") { - $event_length[$thisday][$j] = array ("length" => ($drawEvent["draw_length"] / $gridLength), "key" => $eventKey, "overlap" => $loopevent["event_overlap"],"state" => "begin"); - break; - } - $j++; - } - if ($j == sizeof($event_length[$thisday])) { - array_push ($event_length[$thisday], array ("length" => ($drawEvent["draw_length"] / $gridLength), "key" => $eventKey, "overlap" => $loopevent["event_overlap"],"state" => "begin")); - } - } - } - - if (sizeof($event_length[$thisday]) == 0) { - if ($dayborder == 0) { - $class = " class=\"weekborder\""; - $dayborder++; - } else { - $class = ""; - $dayborder = 0; - } - - echo "\n"; - - } else { - $emptyWidth = $nbrGridCols[$thisday]; - for ($i=0;$i"; - $drawWidth = $nbrGridCols[$thisday] / ($event_length[$thisday][$i]["overlap"] + 1); - $emptyWidth = $emptyWidth - $drawWidth; - switch ($event_length[$thisday][$i]["state"]) { - case "begin": - $event_length[$thisday][$i]["state"] = "started"; - $event_start = $this_time_arr[($event_length[$thisday][$i]["key"])]["start_unixtime"]; - $event_start = date ($timeFormat, $event_start); - $event_calno = $this_time_arr[($event_length[$thisday][$i]['key'])]['calnumber']; - $event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']); - if ($event_calno < 1) $event_calno = 1; - if ($event_calno > 7) $event_calno = 7; - echo '\n"; - break; - case "started": - break; - case "ended": - echo "\n"; - break; - } - $event_length[$thisday][$i]["length"]--; - if ($event_length[$thisday][$i]["length"] == 0) { - $event_length[$thisday][$i]["state"] = "ended"; - } - } - //fill emtpy space on the right - if ($emptyWidth > 0) { - echo "\n"; - } - while (isset($event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]["state"]) && $event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]["state"] == "ended") { - array_pop($event_length[$thisday]); - } - } - $thisdate = ($thisdate + (25 * 60 * 60)); - } - echo "\n"; - } - - ?> -
\"\n"; - echo "$thisday3\n"; - echo "
\n"; - if (isset($master_array[($thisday)]["-1"])) { - echo "\n"; - foreach($master_array[($thisday)]["-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"; - } - echo "
'; - openevent("$event_calna", - "", - "", - $allday, - $allday_week_lines, - 12, - '', - "", - "psf", - $event_url); - echo "
\n"; - } - echo "
$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'; - echo ''; - echo "
\n"; - echo "\n"; - echo "\n"; - echo '\n"; - echo "
'; - $event_end = $this_time_arr[($event_length[$thisday][$i]["key"])]["end_unixtime"]; - if (isset($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end'])) $event_end = strtotime ($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end']); - $event_end = date ($timeFormat, $event_end); +$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, + 'list_jumps' => $list_jumps, + 'legend' => $list_calcolors, + 'style_select' => $style_select + )); + +$page->draw_day($this->page); - $event_calna = $this_time_arr[($event_length[$thisday][$i]["key"])]['calname']; - $event_url = $this_time_arr[($event_length[$thisday][$i]["key"])]['url']; - openevent("$event_calna", - "$event_start", - "$event_end", - $this_time_arr[($event_length[$thisday][$i]["key"])], - $week_events_lines, - 25, - "", - "", - "psf", - $event_url); - echo "
\n"; - echo "
\n"; - echo "
  
-
-
-
 - -
-
- +$page->output(); +?> \ No newline at end of file -- cgit v1.2.3