mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-28935 Add days of week to monthly calendar view
This commit is contained in:
parent
4f3632441a
commit
2953ad13bb
1 changed files with 25 additions and 0 deletions
|
@ -433,6 +433,31 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||||
$dayweek = $startwday;
|
$dayweek = $startwday;
|
||||||
|
|
||||||
$row = new html_table_row(array());
|
$row = new html_table_row(array());
|
||||||
|
|
||||||
|
// Create an array of all the week days.
|
||||||
|
$wdays = array(0 => '<strong>'. get_string('sunday', 'calendar'). '</strong>',
|
||||||
|
1 => '<strong>'. get_string('monday', 'calendar'). '</strong>',
|
||||||
|
2 => '<strong>'. get_string('tuesday', 'calendar'). '</strong>',
|
||||||
|
3 => '<strong>'. get_string('wednesday', 'calendar'). '</strong>',
|
||||||
|
4 => '<strong>'. get_string('thursday', 'calendar'). '</strong>',
|
||||||
|
5 => '<strong>'. get_string('friday', 'calendar'). '</strong>',
|
||||||
|
6 => '<strong>'. get_string('saturday', 'calendar'). '</strong>');
|
||||||
|
|
||||||
|
// Loop only if the day offset is greater than 0.
|
||||||
|
// This loop involves shifting the days around until the desired start day
|
||||||
|
// is at the start of the array.
|
||||||
|
$daycount = 0;
|
||||||
|
while ($display->minwday > $daycount++) {
|
||||||
|
$wdays_end = array_shift($wdays);
|
||||||
|
array_push($wdays, $wdays_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now we set the (modified) array to the table cells to be displayed.
|
||||||
|
$row->cells = $wdays;
|
||||||
|
$table->data[] = $row;
|
||||||
|
|
||||||
|
$row = new html_table_row(array());
|
||||||
|
|
||||||
// Paddding (the first week may have blank days in the beginning)
|
// Paddding (the first week may have blank days in the beginning)
|
||||||
for($i = $display->minwday; $i < $startwday; ++$i) {
|
for($i = $display->minwday; $i < $startwday; ++$i) {
|
||||||
$cell = new html_table_cell(' ');
|
$cell = new html_table_cell(' ');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue