From 2d2b3c39b3285967e4f064437474392dcfc2aa8c Mon Sep 17 00:00:00 2001 From: Gareth J Barnard Date: Wed, 17 Jul 2013 17:35:22 +0100 Subject: [PATCH] MDL-37333 theme: Fix 'Clear theme caches' redirect. --- theme/index.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/theme/index.php b/theme/index.php index ce2a3d10fd1..e8f6b020b86 100644 --- a/theme/index.php +++ b/theme/index.php @@ -95,11 +95,11 @@ if (!empty($CFG->enabledevicedetection) && empty($device)) { $table->head = array(get_string('devicetype', 'admin'), get_string('currenttheme', 'admin'), get_string('info')); $devices = get_device_type_list(); - foreach ($devices as $device) { + foreach ($devices as $thedevice) { $headingthemename = ''; // To output the picked theme name when needed - $themename = get_selected_theme_for_device_type($device); - if (!$themename && $device == 'default') { + $themename = get_selected_theme_for_device_type($thedevice); + if (!$themename && $thedevice == 'default') { $themename = theme_config::DEFAULT_THEME; } @@ -110,7 +110,7 @@ if (!empty($CFG->enabledevicedetection) && empty($device)) { $themename = clean_param($themename, PARAM_THEME); if (empty($themename)) { // Likely the theme has been deleted - unset_config(get_device_cfg_var_name($device)); + unset_config(get_device_cfg_var_name($thedevice)); } else { $strthemename = get_string('pluginname', 'theme_'.$themename); // link to the screenshot, now mandatory - the image path is hardcoded because we need image from other themes, not the current one @@ -121,19 +121,19 @@ if (!empty($CFG->enabledevicedetection) && empty($device)) { $headingthemename = $OUTPUT->heading($strthemename, 3); } // If not default device then show option to unset theme. - if ($device != 'default') { + if ($thedevice != 'default') { $unsetthemestr = get_string('unsettheme', 'admin'); - $unsetthemeurl = new moodle_url('/theme/index.php', array('device' => $device, 'sesskey' => sesskey(), 'unsettheme' => true)); + $unsetthemeurl = new moodle_url('/theme/index.php', array('device' => $thedevice, 'sesskey' => sesskey(), 'unsettheme' => true)); $unsetthemebutton = new single_button($unsetthemeurl, $unsetthemestr, 'get'); $unsetthemebutton = $OUTPUT->render($unsetthemebutton); } } - $deviceurl = new moodle_url('/theme/index.php', array('device' => $device, 'sesskey' => sesskey())); + $deviceurl = new moodle_url('/theme/index.php', array('device' => $thedevice, 'sesskey' => sesskey())); $select = new single_button($deviceurl, $strthemeselect, 'get'); $table->data[] = array( - $OUTPUT->heading(ucfirst($device), 3), + $OUTPUT->heading(ucfirst($thedevice), 3), $screenshotcell, $headingthemename . $OUTPUT->render($select) . $unsetthemebutton ); @@ -215,7 +215,11 @@ if (!empty($CFG->enabledevicedetection) && empty($device)) { echo $OUTPUT->header('themeselector'); echo $OUTPUT->heading($heading); -echo $OUTPUT->single_button(new moodle_url('index.php', array('sesskey' => sesskey(), 'reset' => 1, 'device' => $device)), get_string('themeresetcaches', 'admin')); +$params = array('sesskey' => sesskey(), 'reset' => 1); +if (!empty($device)) { + $params['device'] = $device; +} +echo $OUTPUT->single_button(new moodle_url('index.php', $params), get_string('themeresetcaches', 'admin')); echo html_writer::table($table);