MDL-68974 calendar: Use page context for block check

This commit is contained in:
Andrew Nicols 2020-08-12 08:02:42 +08:00 committed by Jenkins
parent 5c91f31d2e
commit a35b0464b1

View file

@ -1281,9 +1281,12 @@ class calendar_information {
* @param string|null $view preference view options (eg: day, month, upcoming)
*/
public function add_sidecalendar_blocks(core_calendar_renderer $renderer, $showfilters=false, $view=null) {
if (!has_capability('moodle/block:view', $this->context) ) {
global $PAGE;
if (!has_capability('moodle/block:view', $PAGE->context) ) {
return;
}
if ($showfilters) {
$filters = new block_contents();
$filters->content = $renderer->event_filter();