From d716e12ac4617353ddd77ee5290ea39e9ee28b2e Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 26 May 2005 12:53:11 +0000 Subject: [PATCH] More little fixes for the calendar days thing --- calendar/lib.php | 9 +++++---- calendar/view.php | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index c1455c681c5..93c04f3a491 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -62,6 +62,8 @@ define ('CALENDAR_URL', $CFG->wwwroot.'/calendar/'); define ('CALENDAR_TF_24', '%H:%M'); define ('CALENDAR_TF_12', '%I:%M %p'); +$CALENDARDAYS = array('sunday','monday','tuesday','wednesday','thursday','friday','saturday'); + // Initialize the session variables here to be sure calendar_session_vars(); @@ -536,7 +538,7 @@ function calendar_sql_where($tstart, $tend, $users, $groups, $courses, $withdura } function calendar_top_controls($type, $data) { - global $CFG; + global $CFG, $CALENDARDAYS; $content = ''; if(!isset($data['d'])) { $data['d'] = 1; @@ -595,11 +597,10 @@ function calendar_top_controls($type, $data) { break; case 'day': $data['d'] = $date['mday']; // Just for convenience - $dayname = calendar_wday_name($date['weekday']); $prevdate = usergetdate(make_timestamp($data['y'], $data['m'], $data['d'] - 1)); $nextdate = usergetdate(make_timestamp($data['y'], $data['m'], $data['d'] + 1)); - $prevname = $prevdate['weekday']; - $nextname = $nextdate['weekday']; + $prevname = calendar_wday_name($CALENDARDAYS[$prevdate['wday']]); + $nextname = calendar_wday_name($CALENDARDAYS[$nextdate['wday']]); $content .= ''; $content .= '\n"; diff --git a/calendar/view.php b/calendar/view.php index 9841084281c..8281b07adf5 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -261,7 +261,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) { } function calendar_show_month_detailed($m, $y, $courses, $groups, $users) { - global $CFG, $SESSION, $USER; + global $CFG, $SESSION, $USER, $CALENDARDAYS; global $day, $mon, $yr; $getvars = 'from=month&cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering @@ -343,11 +343,10 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) { echo '
<< '.$prevname."
'; // Begin table. First row: day names // Print out the names of the weekdays - $days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); for($i = $display->minwday; $i <= $display->maxwday; ++$i) { // This uses the % operator to get the correct weekday no matter what shift we have // applied to the $display->minwday : $display->maxwday range from the default 0 : 6 - echo ''; + echo ''; } echo ''; // End of day names; prepare for day numbers
'.get_string($days[$i % 7], 'calendar').''.get_string($CALENDARDAYS[$i % 7], 'calendar').'