MDL-78744 completion: Split activity_information in completion and dates
Deprecate core_course\output\activity_information class and move its code to two new classes: core_course\output\activity_completion and core_course\output\activity_dates. In this process refactor activity_completion improving readability and and also deprecate renderer_base::activity_information() and core_course_renderer::render_activity_information().
This commit is contained in:
@@ -175,11 +175,18 @@ class activity_header implements \renderable, \templatable {
|
||||
return ['title' => ''];
|
||||
}
|
||||
|
||||
$completion = null;
|
||||
$activityinfo = null;
|
||||
if (!$this->hidecompletion) {
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($this->page->cm, $this->user->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($this->page->cm, $this->user->id);
|
||||
$completion = $output->activity_information($this->page->cm, $completiondetails, $activitydates);
|
||||
|
||||
$activitycompletion = new \core_course\output\activity_completion($this->page->cm, $completiondetails);
|
||||
$activitycompletiondata = (array) $activitycompletion->export_for_template($output);
|
||||
$activitydates = new \core_course\output\activity_dates($activitydates);
|
||||
$activitydatesdata = (array) $activitydates->export_for_template($output);
|
||||
$data = array_merge($activitycompletiondata, $activitydatesdata);
|
||||
|
||||
$activityinfo = $output->render_from_template('core_course/activity_info', $data);
|
||||
}
|
||||
|
||||
$format = course_get_format($this->page->course);
|
||||
@@ -193,7 +200,7 @@ class activity_header implements \renderable, \templatable {
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'completion' => $completion,
|
||||
'completion' => $activityinfo,
|
||||
'additional_items' => $this->hideoverflow ? '' : $this->additionalnavitems,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user