More little fixes for the calendar days thing

This commit is contained in:
moodler
2005-05-26 12:53:11 +00:00
parent e8b9d71f03
commit d716e12ac4
2 changed files with 7 additions and 7 deletions
+5 -4
View File
@@ -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 .= '<table class="calendar-controls"><tr>';
$content .= '<td class="previous"><a href="'.calendar_get_link_href('view.php?view=day&amp;', $prevdate['mday'], $prevdate['mon'], $prevdate['year']).'">&lt;&lt; '.$prevname."</a></td>\n";
+2 -3
View File
@@ -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&amp;cal_d='.$day.'&amp;cal_m='.$mon.'&amp;cal_y='.$yr; // For filtering
@@ -343,11 +343,10 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
echo '<table class="calendarmonth"><tr class="weekdays">'; // 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 '<th>'.get_string($days[$i % 7], 'calendar').'</th>';
echo '<th>'.get_string($CALENDARDAYS[$i % 7], 'calendar').'</th>';
}
echo '</tr><tr>'; // End of day names; prepare for day numbers