MDL-63836 course: No course header images

This feature may be added in future, but for now we are not going to include it.
This commit is contained in:
Damyon Wiese 2018-11-01 14:04:27 +08:00
parent 5160567c5f
commit f41207400b
10 changed files with 10 additions and 87 deletions

View file

@ -2666,12 +2666,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2018102900.00);
}
if ($oldversion < 2018102900.01) {
// Show course images by default.
set_config('showcourseimages', 1, 'moodlecourse');
upgrade_main_savepoint(true, 2018102900.01);
}
if ($oldversion < 2018110500.01) {
// Define fields to be added to the 'badge' table.
$tablebadge = new xmldb_table('badge');
@ -2769,5 +2763,13 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2018110500.01);
}
if ($oldversion < 2018110700.01) {
// This config setting added and then removed.
unset_config('showcourseimages', 'moodlecourse');
// Main savepoint reached.
upgrade_main_savepoint(true, 2018110700.01);
}
return true;
}

View file

@ -4153,7 +4153,7 @@ EOD;
}
public function context_header($headerinfo = null, $headinglevel = 1) {
global $DB, $USER, $CFG, $COURSE;
global $DB, $USER, $CFG;
require_once($CFG->dirroot . '/user/lib.php');
$context = $this->page->context;
$heading = null;
@ -4165,13 +4165,6 @@ EOD;
$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'])) {

View file

@ -1,29 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/course_header_image
Example context (json):
{
"courseimage": "http://domain.name/pluginfile.php/123/course/overviewfiles/kitten.jpg"
}
}}
<div class="course-header-image-wrapper">
<div class="course-header-image rounded w-100 h-100" style='background-image: url("{{{courseimage}}}");'>
<div class="sr-only">{{#str}}courseheaderimage, core{{/str}}</div>
</div>
</div>