Commit aaf7c5e9 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1871473: Fixing 'sitedefault' page theme problem



Change-Id: I927fb56ef1a73b2f010ab11f1d026e71781b039b
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent a747728c
...@@ -385,6 +385,7 @@ $string['noaccesstoview'] = 'You do not have permission to access this page.'; ...@@ -385,6 +385,7 @@ $string['noaccesstoview'] = 'You do not have permission to access this page.';
$string['wrongblocktype'] = 'The ID supplied is not for a valid blocktype.'; $string['wrongblocktype'] = 'The ID supplied is not for a valid blocktype.';
$string['changeviewtheme'] = 'The theme you have chosen for this page is no longer available to you. Please select a different theme.'; $string['changeviewtheme'] = 'The theme you have chosen for this page is no longer available to you. Please select a different theme.';
$string['nothemeselected1'] = 'Use institution theme'; $string['nothemeselected1'] = 'Use institution theme';
$string['usesitetheme'] = 'Use site theme';
// Templates // Templates
$string['Template'] = 'Template'; $string['Template'] = 'Template';
......
...@@ -777,7 +777,7 @@ function get_user_accessible_themes() { ...@@ -777,7 +777,7 @@ function get_user_accessible_themes() {
} }
} }
$themes = array_merge(array('sitedefault' => get_string('nothemeselected1', 'view')), $themes); $themes = array_merge(array('sitedefault' => get_string('usesitetheme', 'view')), $themes);
unset($themes['custom']); unset($themes['custom']);
return $themes; return $themes;
......
...@@ -1019,6 +1019,10 @@ class Theme { ...@@ -1019,6 +1019,10 @@ class Theme {
$user->find_by_id($userid); $user->find_by_id($userid);
$themedata = $user->get_themedata(); $themedata = $user->get_themedata();
$themedata->viewbasename = $themedata->basename; $themedata->viewbasename = $themedata->basename;
if (empty($themedata->viewbasename) && !empty($themedata->altname)
&& $themedata->altname == 'sitedefault') {
$themedata->viewbasename = get_config('theme');
}
unset($themedata->basename); unset($themedata->basename);
} }
} }
......
...@@ -387,6 +387,8 @@ function get_advanced_elements() { ...@@ -387,6 +387,8 @@ function get_advanced_elements() {
// Theme dropdown // Theme dropdown
$theme = $view->set_user_theme(); $theme = $view->set_user_theme();
$allowedthemes = get_user_accessible_themes(); $allowedthemes = get_user_accessible_themes();
$allowedthemes = array_merge(array('' => get_string('nothemeselected1', 'view')), $allowedthemes);
if ($theme && !isset($allowedthemes[$theme])) { if ($theme && !isset($allowedthemes[$theme])) {
// We have page set with an unknown theme // We have page set with an unknown theme
// So redirect it to the choose theme page first // So redirect it to the choose theme page first
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment