Skip to content
Snippets Groups Projects
Commit eacb3abd authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Setting to be able to upload a favicon.

parent 2dcc3660
Branches
Tags
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2017-03-13 - Setting to be able to upload a favicon.
* 2017-03-10 - Setting to be able to display the title for the first course section (section 0) again.
* 2017-03-09 - Placed course edit on / off button in the course header again like it was displayed before theme_boost.
* 2017-03-08 - Course settings icon will now be displayed on all sites that display the course header.
......
......@@ -44,6 +44,10 @@ This setting is already available in the Moodle core theme Boost. For more infor
This setting is already available in the Moodle core theme Boost. For more information how to use it, please have a look at the official Moodle documentation: http://docs.moodle.org/en/Boost_theme
#### Favicon
This setting allows you to upload an image (.ico or .png format) that your browser will display as a favicon.
### 2. Tab "Advanced Settings"
......
......@@ -67,6 +67,30 @@ class core_renderer extends \theme_boost\output\core_renderer {
ORIGINAL END */
}
/**
* Override to be able to use uploaded images from admin_setting as well.
*
* Returns the URL for the favicon.
*
* @since Moodle 2.5.1 2.6
* @return string The favicon URL
*/
public function favicon() {
global $PAGE;
/* MODIFICATION START */
if (!empty($PAGE->theme->settings->favicon)) {
return $PAGE->theme->setting_file_url('favicon', 'favicon');
}
else {
return $this->pix_url('favicon', 'theme');
}
/* MODIFICATION END */
/* ORIGINAL START
return $this->pix_url('favicon', 'theme');
ORIGINAL END */
}
/**
* Override to display course settings on every course site for permanent access
*
......
......@@ -39,6 +39,9 @@ $string['footerblocks3columnssetting'] = 'Three block columns in footer';
$string['footerblockssetting'] = 'Footer layout';
$string['footerblockssetting_desc'] = 'You can chose if you want to enable the possibility to place blocks into the footer. If enabled, you can choose between one, two or three block columns. These columns are only displayed on large screens. On small screens the columns will be automatically reduced to one column for better readability and layout.';
$string['faviconsetting'] = 'Favicon';
$string['faviconsetting_desc'] = 'You can upload one image (.ico or .png format) that the browser will show as the favicon of your Moodle website.';
$string['region-footer-left'] = 'Footer (left)';
$string['region-footer-middle'] = 'Footer (middle)';
$string['region-footer-right'] = 'Footer (right)';
......
......@@ -94,3 +94,28 @@ function theme_boost_campus_get_pre_scss($theme) {
return $scss;
}
/**
* Implement pluginfile function to deliver files which are uploaded in theme settings
*
* @param stdClass $course course object
* @param stdClass $cm course module
* @param stdClass $context context object
* @param string $filearea file area
* @param array $args extra arguments
* @param bool $forcedownload whether or not force download
* @param array $options additional options affecting the file serving
* @return bool
*/
function theme_boost_campus_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM) {
$theme = theme_config::load('boost_campus');
if ($filearea === 'favicon') {
return $theme->setting_file_serve('favicon', $args, $forcedownload, $options);
} else {
send_file_not_found();
}
} else {
send_file_not_found();
}
}
......@@ -78,6 +78,15 @@ if ($ADMIN->fulltree) {
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Favicon upload.
$name = 'theme_boost_campus/favicon';
$title = get_string('faviconsetting', 'theme_boost_campus');
$description = get_string('faviconsetting_desc', 'theme_boost_campus');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'favicon', 0, array('maxfiles' => 1, 'accepted_types' => array('.ico','.png')));
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Add tab to settings page.
$settings->add($page);
......
......@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'theme_boost_campus';
$plugin->version = '2017022700';
$plugin->version = '2017031300';
$plugin->release = 'v3.2-r1';
$plugin->requires = '2016070700';
$plugin->maturity = MATURITY_STABLE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment