MDL-68974 calendar: Use page context for block check
[moodle.git] / calendar / lib.php
index 9195b28..9755765 100644 (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();