Skip to content

Commit

Permalink
MDL-73117 calendar: Final deprecation of threemonth_cal
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Mar 11, 2024
1 parent b2fa19f commit 3d301ab
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 321 deletions.
13 changes: 0 additions & 13 deletions calendar/amd/build/calendar_threemonth.min.js

This file was deleted.

1 change: 0 additions & 1 deletion calendar/amd/build/calendar_threemonth.min.js.map

This file was deleted.

148 changes: 0 additions & 148 deletions calendar/amd/src/calendar_threemonth.js

This file was deleted.

57 changes: 2 additions & 55 deletions calendar/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,63 +51,10 @@ public function complete_layout() {
}

/**
* Produces the content for the three months block (pretend block)
*
* This includes the previous month, the current month, and the next month
*
* @deprecated since 4.0 MDL-72810.
* @todo MDL-73117 This will be deleted in Moodle 4.4.
*
* @param calendar_information $calendar
* @return string
*/
public function fake_block_threemonths(calendar_information $calendar) {
debugging('This method is no longer used as the three month calendar block has been removed', DEBUG_DEVELOPER);

// Get the calendar type we are using.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$time = $calendartype->timestamp_to_date_array($calendar->time);

$current = $calendar->time;
$prevmonthyear = $calendartype->get_prev_month($time['year'], $time['mon']);
$prev = $calendartype->convert_to_timestamp(
$prevmonthyear[1],
$prevmonthyear[0],
1
);
$nextmonthyear = $calendartype->get_next_month($time['year'], $time['mon']);
$next = $calendartype->convert_to_timestamp(
$nextmonthyear[1],
$nextmonthyear[0],
1
);

$content = '';

// Previous.
$calendar->set_time($prev);
list($previousmonth, ) = calendar_get_view($calendar, 'minithree', false, true);

// Current month.
$calendar->set_time($current);
list($currentmonth, ) = calendar_get_view($calendar, 'minithree', false, true);

// Next month.
$calendar->set_time($next);
list($nextmonth, ) = calendar_get_view($calendar, 'minithree', false, true);

// Reset the time back.
$calendar->set_time($current);

$data = (object) [
'previousmonth' => $previousmonth,
'currentmonth' => $currentmonth,
'nextmonth' => $nextmonth,
];

$template = 'core_calendar/calendar_threemonth';
$content .= $this->render_from_template($template, $data);
return $content;
public function fake_block_threemonths() {
throw new coding_exception(__FUNCTION__ . '() has been removed.');
}

/**
Expand Down
Loading

0 comments on commit 3d301ab

Please sign in to comment.