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.
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user