From e5e49f470c5e4cdcf55671416ea7297177d139ff Mon Sep 17 00:00:00 2001 From: Wesley Miaw Date: Thu, 1 Dec 2005 06:15:28 +0000 Subject: Feature #1353342. You can now specify how many days should be displayed on the week view. All numbers, negative to more than seven, work with the expected behavior. Thanks to Nicolas Contamin for the code changes. --- config.inc.php | 1 + functions/template.php | 8 ++++---- week.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.inc.php b/config.inc.php index a3c7517..bdae127 100644 --- a/config.inc.php +++ b/config.inc.php @@ -11,6 +11,7 @@ $minical_view = 'current'; // Where do the mini-calendars go when clicked? = $default_cal = $ALL_CALENDARS_COMBINED; // Exact filename of calendar without .ics. Or set to $ALL_CALENDARS_COMBINED to open all calenders combined into one. $language = 'English'; // Language support - 'English', 'Polish', 'German', 'French', 'Dutch', 'Danish', 'Italian', 'Japanese', 'Norwegian', 'Spanish', 'Swedish', 'Portuguese', 'Catalan', 'Traditional_Chinese', 'Esperanto', 'Korean' $week_start_day = 'Sunday'; // Day of the week your week starts on +$week_length = '7'; // Number of days to display in the week view $day_start = '0700'; // Start time for day grid $day_end = '2300'; // End time for day grid $gridLength = '15'; // Grid distance in minutes for day view, multiples of 15 preferred diff --git a/functions/template.php b/functions/template.php index 260d057..c70da14 100644 --- a/functions/template.php +++ b/functions/template.php @@ -231,7 +231,7 @@ class Page { }#end draw_search function draw_week($template_p) { - global $unique_colors, $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small, $day_start; + global $unique_colors, $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small, $day_start, $week_length; // Figure out colspans $dayborder = 0; @@ -252,7 +252,7 @@ class Page { $thisdate = ($thisdate + (25 * 60 * 60)); } - for ($i=0; $i<7; $i++) { + for ($i=0; $i<$week_length; $i++) { $thisdate = date ('Ymd', $start_week_time); $weekarray[$i] = $thisdate; $start_week_time = strtotime('+1 day', $start_week_time); @@ -289,7 +289,7 @@ class Page { $loop_dof = trim($match1[1]); $start_wt = strtotime(dateOfWeek($getdate, $week_start_day)); $start_day = strtotime($week_start_day); - for ($i=0; $i<7; $i++) { + for ($i=0; $i<$week_length; $i++) { $day_num = date("w", $start_day); $daylink = date('Ymd', $start_wt); if ($current_view == 'day') { @@ -360,7 +360,7 @@ class Page { $thisdate = $swt; // loop this part 7 times, one for each day - for ($week_loop=0; $week_loop<7; $week_loop++) { + for ($week_loop=0; $week_loop<$week_length; $week_loop++) { $thisday = date("Ymd", $thisdate); $dayborder = 0; unset($this_time_arr); diff --git a/week.php b/week.php index 5c170ad..d863821 100644 --- a/week.php +++ b/week.php @@ -17,7 +17,7 @@ $prev_week = date("Ymd", strtotime("-1 week", $unix_time)); $next_day = date('Ymd', strtotime("+1 day", $unix_time)); $prev_day = date('Ymd', strtotime("-1 day", $unix_time)); $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day)); -$end_week_time = $start_week_time + (6 * 25 * 60 * 60); +$end_week_time = $start_week_time + (($week_length - 1) * 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"; -- cgit v1.2.3