libdir.'/adminlib.php'); $choose = optional_param("choose",'',PARAM_FILE); // set this theme as default admin_externalpage_setup('themeselector'); unset($SESSION->theme); $stradministration = get_string("administration"); $strconfiguration = get_string("configuration"); $strthemes = get_string("themes"); $strpreview = get_string("preview"); $strchoose = get_string("choose"); $strinfo = get_string("info"); $strtheme = get_string("theme"); $strthemesaved = get_string("themesaved"); $strscreenshot = get_string("screenshot"); $stroldtheme = get_string("oldtheme"); if ($choose and confirm_sesskey()) { if (!is_dir($CFG->themedir .'/'. $choose)) { error("This theme is not installed!"); } if (set_config("theme", $choose)) { theme_setup($choose); admin_externalpage_print_header(); print_heading(get_string("themesaved")); if (file_exists("$choose/README.html")) { print_simple_box_start("center"); readfile("$choose/README.html"); print_simple_box_end(); } else if (file_exists("$choose/README.txt")) { print_simple_box_start("center"); $file = file("$choose/README.txt"); echo format_text(implode('', $file), FORMAT_MOODLE); print_simple_box_end(); } print_continue("$CFG->wwwroot/"); admin_externalpage_print_footer(); exit; } else { error("Could not set the theme!"); } } admin_externalpage_print_header('themeselector'); print_heading($strthemes); $themes = get_list_of_plugins("theme"); $sesskey = !empty($USER->id) ? $USER->sesskey : ''; echo "\n"; if (!$USER->screenreader) { echo "\t\n\t\t\n"; echo "\t\t\n\t\n"; } $original_theme = fullclone($THEME); foreach ($themes as $theme) { unset($THEME); if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder continue; } include($CFG->themedir.'/'.$theme.'/config.php'); $readme = ''; $screenshot = ''; $screenshotpath = ''; if (file_exists("$theme/README.html")) { $readme = "\t\t\t\t
  • ". link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true)."
  • \n"; } else if (file_exists("$theme/README.txt")) { $readme = "\t\t\t\t
  • ". link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true)."
  • \n"; } if (file_exists("$theme/screenshot.png")) { $screenshotpath = "$theme/screenshot.png"; } else if (file_exists("$theme/screenshot.jpg")) { $screenshotpath = "$theme/screenshot.jpg"; } echo "\t\n"; // no point showing this if user is using screen reader if (!$USER->screenreader) { echo "\t\t\n"; } else { echo "\t\t\t$theme\n\t\t\n"; } } if ($CFG->theme == $theme) { echo "\t\t" . '\n"; echo "\t\n"; } echo "
    $strtheme$strinfo
    \n"; if ($screenshotpath) { $screenshot = "\t\t\t\t
  • $strscreenshot
  • \n"; echo "\t\t\t$theme\n\t\t
    '."\n"; } else { echo "\t\t" . ''."\n"; } if (isset($THEME->sheets)) { echo "\t\t\t" . '

    '.$theme.'

    '."\n"; } else { echo "\t\t\t" . '

    '.$theme.' (Moodle 1.4)

    '."\n"; } if ($screenshot or $readme) { echo "\t\t\t
      \n"; if (!$USER->screenreader) { echo "\t\t\t\t
    • $strpreview
    • \n"; } echo $screenshot.$readme; echo "\t\t\t
    \n"; } $options = null; $options['choose'] = $theme; $options['sesskey'] = $sesskey; echo "\t\t\t" . print_single_button('index.php', $options, $strchoose, 'get', null, true) . "\n"; echo "\t\t
    \n"; $THEME = $original_theme; admin_externalpage_print_footer(); ?>