|
|
@ -23,74 +23,22 @@ |
|
|
|
defined('MOODLE_INTERNAL') || die(); |
|
|
|
|
|
|
|
if ($ADMIN->fulltree) { |
|
|
|
$settings = new theme_ilb_admin_settingspage_tabs('themesettingilb', get_string('configtitle', 'theme_ilb')); |
|
|
|
$page = new admin_settingpage('theme_ilb_general', get_string('generalsettings', 'theme_ilb')); |
|
|
|
|
|
|
|
// Preset. |
|
|
|
$name = 'theme_ilb/preset'; |
|
|
|
$title = get_string('preset', 'theme_ilb'); |
|
|
|
$description = get_string('preset_desc', 'theme_ilb'); |
|
|
|
$default = 'default.scss'; |
|
|
|
|
|
|
|
$context = context_system::instance(); |
|
|
|
$fs = get_file_storage(); |
|
|
|
$files = $fs->get_area_files($context->id, 'theme_ilb', 'preset', 0, 'itemid, filepath, filename', false); |
|
|
|
|
|
|
|
$choices = []; |
|
|
|
foreach ($files as $file) { |
|
|
|
$choices[$file->get_filename()] = $file->get_filename(); |
|
|
|
} |
|
|
|
// These are the built in presets. |
|
|
|
$choices['default.scss'] = 'default.scss'; |
|
|
|
$choices['plain.scss'] = 'plain.scss'; |
|
|
|
|
|
|
|
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices); |
|
|
|
$setting->set_updatedcallback('theme_reset_all_caches'); |
|
|
|
$page->add($setting); |
|
|
|
|
|
|
|
// Preset files setting. |
|
|
|
$name = 'theme_ilb/presetfiles'; |
|
|
|
$title = get_string('presetfiles','theme_ilb'); |
|
|
|
$description = get_string('presetfiles_desc', 'theme_ilb'); |
|
|
|
|
|
|
|
$setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0, |
|
|
|
array('maxfiles' => 20, 'accepted_types' => array('.scss'))); |
|
|
|
$page->add($setting); |
|
|
|
|
|
|
|
// Background image setting. |
|
|
|
$name = 'theme_ilb/backgroundimage'; |
|
|
|
$title = get_string('backgroundimage', 'theme_ilb'); |
|
|
|
$description = get_string('backgroundimage_desc', 'theme_ilb'); |
|
|
|
$setting = new admin_setting_configstoredfile($name, $title, $description, 'backgroundimage'); |
|
|
|
$setting->set_updatedcallback('theme_reset_all_caches'); |
|
|
|
$page->add($setting); |
|
|
|
|
|
|
|
// Variable $body-color. |
|
|
|
// We use an empty default value because the default colour should come from the preset. |
|
|
|
$name = 'theme_ilb/brandcolor'; |
|
|
|
$title = get_string('brandcolor', 'theme_ilb'); |
|
|
|
$description = get_string('brandcolor_desc', 'theme_ilb'); |
|
|
|
$setting = new admin_setting_configcolourpicker($name, $title, $description, ''); |
|
|
|
$setting->set_updatedcallback('theme_reset_all_caches'); |
|
|
|
$page->add($setting); |
|
|
|
|
|
|
|
// Must add the page after definiting all the settings! |
|
|
|
$settings->add($page); |
|
|
|
|
|
|
|
// Advanced settings. |
|
|
|
$page = new admin_settingpage('theme_ilb_advanced', get_string('advancedsettings', 'theme_ilb')); |
|
|
|
|
|
|
|
// Raw SCSS to include before the content. |
|
|
|
$setting = new admin_setting_scsscode('theme_ilb/scsspre', |
|
|
|
get_string('rawscsspre', 'theme_ilb'), get_string('rawscsspre_desc', 'theme_ilb'), '', PARAM_RAW); |
|
|
|
$setting->set_updatedcallback('theme_reset_all_caches'); |
|
|
|
$page->add($setting); |
|
|
|
|
|
|
|
// Raw SCSS to include after the content. |
|
|
|
$setting = new admin_setting_scsscode('theme_ilb/scss', get_string('rawscss', 'theme_ilb'), |
|
|
|
get_string('rawscss_desc', 'theme_ilb'), '', PARAM_RAW); |
|
|
|
$setting->set_updatedcallback('theme_reset_all_caches'); |
|
|
|
$page->add($setting); |
|
|
|
|
|
|
|
$settings->add($page); |
|
|
|
// Habilitar destaque |
|
|
|
$setting = new admin_setting_configcheckbox('theme_ilb/habilitar_destaque', |
|
|
|
'Habilitar destaque', |
|
|
|
'Indica se deve ser exibido destaque na página inicial', 0); |
|
|
|
$settings->add($setting); |
|
|
|
|
|
|
|
// Imagem destaque |
|
|
|
$setting = new admin_setting_configtext('theme_ilb/imagem_destaque', |
|
|
|
'Imagem de destaque', |
|
|
|
'Imagem a ser exibida como destaque', '', PARAM_TEXT, 50); |
|
|
|
$settings->add($setting); |
|
|
|
|
|
|
|
// Curso de destaque |
|
|
|
$setting = new admin_setting_configtext('theme_ilb/curso_destaque', |
|
|
|
'Curso de destaque', |
|
|
|
'ID do curso acessado ao clicar na imagem de destaque', '', PARAM_TEXT, 4); |
|
|
|
$settings->add($setting); |
|
|
|
} |
|
|
|