MDL-63445 core_renderer: display course image in context header
This commit is contained in:
@@ -4141,7 +4141,7 @@ EOD;
|
||||
}
|
||||
|
||||
public function context_header($headerinfo = null, $headinglevel = 1) {
|
||||
global $DB, $USER, $CFG;
|
||||
global $DB, $USER, $CFG, $COURSE;
|
||||
require_once($CFG->dirroot . '/user/lib.php');
|
||||
$context = $this->page->context;
|
||||
$heading = null;
|
||||
@@ -4152,6 +4152,14 @@ EOD;
|
||||
if (isset($headerinfo['heading'])) {
|
||||
$heading = $headerinfo['heading'];
|
||||
}
|
||||
|
||||
// Show a course image if enabled.
|
||||
if ($context->contextlevel == CONTEXT_COURSE && get_config('moodlecourse', 'showcourseimages')) {
|
||||
$exporter = new core_course\external\course_summary_exporter($COURSE, ['context' => $context]);
|
||||
$courseinfo = $exporter->export($this);
|
||||
$imagedata = $this->render_from_template('core/course_header_image', $courseinfo);
|
||||
}
|
||||
|
||||
// The user context currently has images and buttons. Other contexts may follow.
|
||||
if (isset($headerinfo['user']) || $context->contextlevel == CONTEXT_USER) {
|
||||
if (isset($headerinfo['user'])) {
|
||||
|
||||
Reference in New Issue
Block a user