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

@ -121,9 +121,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0,
array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
$temp->add(new admin_setting_configcheckbox('moodlecourse/showcourseimages', get_string('showcourseimages'),
get_string('showcourseimages_desc'), 1));
// Files and uploads.
$temp->add(new admin_setting_heading('filesanduploadshdr', new lang_string('filesanduploads'), ''));

View file

@ -327,7 +327,6 @@ $string['courseformatdata'] = 'Course format data';
$string['courseformats'] = 'Course formats';
$string['courseformatoptions'] = 'Formatting options for {$a}';
$string['courseformatudpate'] = 'Update format';
$string['courseheaderimage'] = 'Course header image';
$string['courseprofiles'] = 'Course profiles';
$string['coursepreferences'] = 'Course preferences';
$string['coursegrades'] = 'Course grades';
@ -1823,8 +1822,6 @@ $string['showallusers'] = 'Show all users';
$string['showblockcourse'] = 'Show list of courses containing block';
$string['showcategory'] = 'Show {$a}';
$string['showchartdata'] = 'Show chart data';
$string['showcourseimages'] = 'Show course images';
$string['showcourseimages_desc'] = 'Show the course image or image placeholder in the course header.';
$string['showcomments'] = 'Show/hide comments';
$string['showcommentsnonjs'] = 'Show comments';
$string['showdescription'] = 'Display description on course page';

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>

View file

@ -1139,15 +1139,6 @@ span.editinstructions {
opacity: 0.5;
}
.course-header-image-wrapper {
width: 100px;
height: 100px;
.course-header-image {
background-size: cover;
background-position: center;
}
}
/**
* Display sizes:
* Large displays 1200 +

View file

@ -12434,13 +12434,6 @@ span.editinstructions {
.course-being-dragged {
opacity: 0.5; }
.course-header-image-wrapper {
width: 100px;
height: 100px; }
.course-header-image-wrapper .course-header-image {
background-size: cover;
background-position: center; }
/**
* Display sizes:
* Large displays 1200 +

View file

@ -1124,17 +1124,6 @@ span.editinstructions {
.opacity(50);
}
.course-header-image-wrapper {
width: 100px;
height: 100px;
.course-header-image {
width: 100%;
height: 100%;
background-size: cover;
background-position: center;
}
}
/**
* Display sizes:
* Large displays 1200 +

View file

@ -7004,16 +7004,6 @@ span.editinstructions {
opacity: 0.5;
filter: alpha(opacity=50);
}
.course-header-image-wrapper {
width: 100px;
height: 100px;
}
.course-header-image-wrapper .course-header-image {
width: 100%;
height: 100%;
background-size: cover;
background-position: center;
}
/**
* Display sizes:
* Large displays 1200 +

View file

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2018110700.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2018110700.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.