Commit 1ab85831 authored by Andrew Nicols's avatar Andrew Nicols
Browse files

MDL-60587 block: Correct courseid/categoryid check

pagelib uses magic getters for both the course, and category.
It does not define the magic __isset function though.
parent e20752c4
......@@ -48,8 +48,8 @@ class block_calendar_month extends block_base {
$this->content->text = '';
$this->content->footer = '';
$courseid = isset($this->page->course) ? $this->page->course->id : SITEID;
$categoryid = isset($this->page->category) ? $this->page->category->id : null;
$courseid = $this->page->course->id;
$categoryid = ($this->page->context->contextlevel === CONTEXT_COURSECAT) ? $this->page->category->id : null;
$calendar = \calendar_information::create(time(), $courseid, $categoryid);
list($data, $template) = calendar_get_view($calendar, 'mini');
......
......@@ -47,8 +47,8 @@ class block_calendar_upcoming extends block_base {
$this->content->text = '';
$this->content->footer = '';
$courseid = isset($this->page->course) ? $this->page->course->id : SITEID;
$categoryid = isset($this->page->category) ? $this->page->category->id : null;
$courseid = $this->page->course->id;
$categoryid = ($this->page->context->contextlevel === CONTEXT_COURSECAT) ? $this->page->category->id : null;
$calendar = \calendar_information::create(time(), $courseid, $categoryid);
list($data, $template) = calendar_get_view($calendar, 'upcoming_mini');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment