diff --git a/calendar/lib.php b/calendar/lib.php
index 65b67eb2796..9a6ce1ae1a1 100644
--- a/calendar/lib.php
+++ b/calendar/lib.php
@@ -114,17 +114,18 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
// Arguments passed by reference.
calendar_events_by_day($events, $display->tstart, $eventsbyday, $durationbyday, $typesbyday);
- $content .= '
'; // Begin table. First row: day names
+ $content .= ''; // Begin table
+ $content .= ''; // Header row: day names
// Print out the names of the weekdays
$days = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
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
- $content .= '\n";
+ $content .= '| '.get_string($days[$i % 7], 'calendar').' | ';
}
- $content .= '
'; // End of day names; prepare for day numbers
+ $content .= '
'; // End of day names; prepare for day numbers
// For the table display. $week is the row; $dayweek is the column.
$week = 1;
@@ -132,7 +133,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
// Paddding (the first week may have blank days in the beginning)
for($i = $display->minwday; $i < $startwday; ++$i) {
- $content .= '| | '."\n";
+ $content .= ' | '."\n";
}
// Now display all the calendar
@@ -143,16 +144,16 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
$dayweek = $display->minwday;
++$week;
}
+
// Reset vars
- $class = '';
$cell = '';
if($dayweek % 7 == 0 || $dayweek % 7 == 6) {
// Weekend. This is true no matter what the exact range is.
- $class = 'cal_day_mini calendarweekend';
+ $class = 'cal_weekend';
}
else {
// Normal working day.
- $class = 'cal_day_mini';
+ $class = '';
}
// Special visual fx if an event is defined
@@ -210,16 +211,19 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
}
// Just display it
- $content .= ''.$cell." | \n";
+ if(!empty($class)) {
+ $class = ' class="'.trim($class).'"';
+ }
+ $content .= ''.$cell." | \n";
}
// Paddding (the last week may have blank days at the end)
for($i = $dayweek; $i <= $display->maxwday; ++$i) {
- $content .= ' | ';
+ $content .= ' | ';
}
$content .= '
'; // Last row ends
- $content .= '
'; // Tabular display of days ends
+ $content .= '
'; // Tabular display of days ends
return $content;
}
diff --git a/calendar/view.php b/calendar/view.php
index ed2070d7805..511642d7d3b 100644
--- a/calendar/view.php
+++ b/calendar/view.php
@@ -414,17 +414,17 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
echo calendar_top_controls('month', array('m' => $m, 'y' => $y));
// Start calendar display
- echo ''; // Begin table. First row: day names
+ echo ''; // 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 '\n";
+ echo '';
}
- echo '
'; // End of day names; prepare for day numbers
+ echo '
'; // End of day names; prepare for day numbers
// For the table display. $week is the row; $dayweek is the column.
$week = 1;
@@ -432,7 +432,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
// Paddding (the first week may have blank days in the beginning)
for($i = $display->minwday; $i < $startwday; ++$i) {
- echo '| | '."\n";
+ echo ' | '."\n";
}
// Now display all the calendar
@@ -445,15 +445,14 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
}
// Reset vars
- $class = '';
$cell = '';
if($dayweek % 7 == 0 || $dayweek % 7 == 6) {
// Weekend. This is true no matter what the exact range is.
- $class = 'calendardaymonth calendarweekend';
+ $class = 'cal_weekend';
}
else {
// Normal working day.
- $class = 'calendardaymonth';
+ $class = '';
}
// Special visual fx if an event is defined
@@ -502,12 +501,16 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
}
// Just display it
- echo ''.$cell;
+ if(!empty($class)) {
+ $class = ' class="'.trim($class).'"';
+ }
+ echo ' | '.$cell;
+
if(isset($eventsbyday[$day])) {
echo '';
}
@@ -521,9 +524,9 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
// Paddding (the last week may have blank days at the end)
for($i = $dayweek; $i <= $display->maxwday; ++$i) {
- echo ' | | ';
+ echo ' | ';
}
- echo "
\n"; // Last row ends
+ echo "\n\n"; // Last row ends
echo "
\n
\n"; // Tabular display of days ends