Skip to content

Commit 54bdc73

Browse files
committed
Remove redundant icbc.
1 parent 5743208 commit 54bdc73

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

classes/toolbox.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,7 @@ public static function create_section_image($tempfile, $storedfilerecord, $secti
722722
// Set up the displayed image:...
723723
$sectionimage->newimage = $storedfilerecord['filename'];
724724
$settings = $courseformat->get_settings();
725-
$icbc = self::hex2rgb($settings['imagecontainerbackgroundcolour']);
726-
self::setup_displayed_image($sectionimage, $storedfilerecord['contextid'], $courseformat->get_courseid(), $settings, $icbc, $mime);
725+
self::setup_displayed_image($sectionimage, $storedfilerecord['contextid'], $courseformat->get_courseid(), $settings, $mime);
727726
} else {
728727
print_error('imagecannotbeused', 'format_grid', $CFG->wwwroot . "/course/view.php?id=" . $courseformat->get_courseid());
729728
}
@@ -743,11 +742,10 @@ public static function create_section_image($tempfile, $storedfilerecord, $secti
743742
* @param int $contextid The context id to which the image relates.
744743
* @param int $courseid The course id to which the image relates.
745744
* @param array $settings The course settings to apply.
746-
* @param array $icbc The 'imagecontainerbackgroundcolour' as an RGB array.
747745
* @param string $mime The mime type if already known.
748746
* @return array The updated $sectionimage data.
749747
*/
750-
public static function setup_displayed_image($sectionimage, $contextid, $courseid, $settings, $icbc, $mime = null) {
748+
public static function setup_displayed_image($sectionimage, $contextid, $courseid, $settings, $mime = null) {
751749
global $CFG, $DB;
752750
require_once($CFG->dirroot . '/repository/lib.php');
753751
require_once($CFG->libdir . '/gdlib.php');
@@ -786,7 +784,7 @@ public static function setup_displayed_image($sectionimage, $contextid, $coursei
786784
'sectionimage_displayedimageindex' => $sectionimage->displayedimageindex,
787785
'sectionimage_newimage' => $sectionimage->newimage
788786
);
789-
$data = self::generate_image($tmpfilepath, $displayedimageinfo['width'], $displayedimageinfo['height'], $crop, $icbc, $newmime, $debugdata);
787+
$data = self::generate_image($tmpfilepath, $displayedimageinfo['width'], $displayedimageinfo['height'], $crop, $newmime, $debugdata);
790788
if (!empty($data)) {
791789
// Updated image.
792790
$sectionimage->displayedimageindex++;
@@ -976,12 +974,11 @@ public static function update_displayed_images($courseid, $contextid, $settings,
976974

977975
$sectionimages = self::get_images($courseid);
978976
if (is_array($sectionimages)) {
979-
$icbc = self::hex2rgb($settings['imagecontainerbackgroundcolour']);
980977
$t = $DB->start_delegated_transaction();
981978
foreach ($sectionimages as $sectionimage) {
982979
if ($sectionimage->displayedimageindex > 0) {
983980
$sectionimage->newimage = $sectionimage->image;
984-
$sectionimage = self::setup_displayed_image($sectionimage, $contextid, $courseid, $settings, $icbc);
981+
$sectionimage = self::setup_displayed_image($sectionimage, $contextid, $courseid, $settings);
985982
}
986983
}
987984
$t->allow_commit();
@@ -1001,13 +998,12 @@ public static function update_displayed_images($courseid, $contextid, $settings,
1001998
* @param int $requestedwidth the width of the requested image.
1002999
* @param int $requestedheight the height of the requested image.
10031000
* @param bool $crop false = scale, true = crop.
1004-
* @param array $icbc The 'imagecontainerbackgroundcolour' as an RGB array.
10051001
* @param string $mime The mime type.
10061002
* @param array $debugdata Debug data if the image generation fails.
10071003
*
10081004
* @return string|bool false if a problem occurs or the image data.
10091005
*/
1010-
private static function generate_image($filepath, $requestedwidth, $requestedheight, $crop, $icbc, $mime, $debugdata) {
1006+
private static function generate_image($filepath, $requestedwidth, $requestedheight, $crop, $mime, $debugdata) {
10111007
if (empty($filepath) or empty($requestedwidth) or empty($requestedheight)) {
10121008
return false;
10131009
}

renderer.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,8 @@ protected function single_section_page_summary($section, $sectionname, $course)
304304
if (isset($sectionimage->image) && ($sectionimage->displayedimageindex < 1)) {
305305
// Set up the displayed image:...
306306
$sectionimage->newimage = $sectionimage->image;
307-
$icbc = \format_grid\toolbox::hex2rgb($this->settings['imagecontainerbackgroundcolour']);
308307
$sectionimage = \format_grid\toolbox::setup_displayed_image($sectionimage, $coursecontext->id,
309-
$course->id, $this->settings, $icbc);
308+
$course->id, $this->settings);
310309
}
311310

312311
$gridimagepath = \format_grid\toolbox::get_image_path();
@@ -938,9 +937,8 @@ private function make_block_icon_topics($contextid, $sections, $course, $editing
938937
if (isset($sectionimage->image) && ($sectionimage->displayedimageindex < 1)) {
939938
// Set up the displayed image:...
940939
$sectionimage->newimage = $sectionimage->image;
941-
$icbc = \format_grid\toolbox::hex2rgb($this->settings['imagecontainerbackgroundcolour']);
942940
$sectionimage = \format_grid\toolbox::setup_displayed_image($sectionimage, $contextid,
943-
$course->id, $this->settings, $icbc);
941+
$course->id, $this->settings);
944942
}
945943

946944
if ($course->coursedisplay != COURSE_DISPLAY_MULTIPAGE) {

0 commit comments

Comments
 (0)