Open NinaHerrmann opened 1 year ago
This code will display the course image on the My Courses Page.
// Use default image on both dashboard/mycourses and in course pages. public function get_generated_image_for_id($id) { // See if user uploaded a custom header background to the theme. $headerbg = $this->page->theme->setting_file_url('courseheaderimagefallback', 'courseheaderimagefallback'); $hasheaderbg = $this->page->theme->settings->courseheaderimageenabled == THEME_BOOST_UNION_SETTING_SELECT_YES; if (isset($headerbg) && $hasheaderbg) { return $headerbg; } elseif ($hasheaderbg) { // Usefallback image for mycourse regardless. return $this->page->theme->image_url('noimg', 'theme')->out(); } else { $color = $this->get_generated_color_for_id($id); $pattern = new \core_geopattern(); $pattern->setColor($color); $pattern->patternbyid($id); return $pattern->datauri(); } }
We've done a bunch of work on making the Boost Union theme a bit more capable for our needs but I am afraid my coding standards are not on the level of your team. We've added a specialized course dashboard panel, huge styling changes, and a bunch of hacks to better integrate some of our plugins. One such enhancement was matching course header images on both the course and dashboard pages. It's something we've been doing since Fordson theme.
Identified as a good partner issue or extension for the realisation of #298
Follow up issue from #77 -> Pull Request #170:
170 adds a setting to Look->Page to enable showing background images in the course header and to define a default image which is displayed in case the course does not have an image.
The default image is not displayed in the My Courses overview page, which might be confusing.