| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php // $Id: index.php,v 1.38.2.2 2008/03/26 03:00:42 scyrma Exp $ 2 3 require_once("../config.php"); 4 require_once($CFG->libdir.'/adminlib.php'); 5 6 $choose = optional_param("choose",'',PARAM_FILE); // set this theme as default 7 8 admin_externalpage_setup('themeselector'); 9 10 unset($SESSION->theme); 11 12 $stradministration = get_string("administration"); 13 $strconfiguration = get_string("configuration"); 14 $strthemes = get_string("themes"); 15 $strpreview = get_string("preview"); 16 $strchoose = get_string("choose"); 17 $strinfo = get_string("info"); 18 $strtheme = get_string("theme"); 19 $strthemesaved = get_string("themesaved"); 20 $strscreenshot = get_string("screenshot"); 21 $stroldtheme = get_string("oldtheme"); 22 23 24 if ($choose and confirm_sesskey()) { 25 if (!is_dir($CFG->themedir .'/'. $choose)) { 26 error("This theme is not installed!"); 27 } 28 if (set_config("theme", $choose)) { 29 theme_setup($choose); 30 admin_externalpage_print_header(); 31 print_heading(get_string("themesaved")); 32 33 if (file_exists("$choose/README.html")) { 34 print_simple_box_start("center"); 35 readfile("$choose/README.html"); 36 print_simple_box_end(); 37 38 } else if (file_exists("$choose/README.txt")) { 39 print_simple_box_start("center"); 40 $file = file("$choose/README.txt"); 41 echo format_text(implode('', $file), FORMAT_MOODLE); 42 print_simple_box_end(); 43 } 44 45 print_continue("$CFG->wwwroot/"); 46 47 admin_externalpage_print_footer(); 48 exit; 49 } else { 50 error("Could not set the theme!"); 51 } 52 } 53 54 admin_externalpage_print_header('themeselector'); 55 56 57 print_heading($strthemes); 58 59 $themes = get_list_of_plugins("theme"); 60 $sesskey = !empty($USER->id) ? $USER->sesskey : ''; 61 62 echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">\n"; 63 64 if (!$USER->screenreader) { 65 echo "\t<tr class=\"generaltableheader\">\n\t\t<th scope=\"col\">$strtheme</th>\n"; 66 echo "\t\t<th scope=\"col\">$strinfo</th>\n\t</tr>\n"; 67 } 68 69 $original_theme = fullclone($THEME); 70 71 foreach ($themes as $theme) { 72 73 unset($THEME); 74 75 if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder 76 continue; 77 } 78 79 include($CFG->themedir.'/'.$theme.'/config.php'); 80 81 $readme = ''; 82 $screenshot = ''; 83 $screenshotpath = ''; 84 85 if (file_exists("$theme/README.html")) { 86 $readme = "\t\t\t\t<li>". 87 link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true)."</li>\n"; 88 } else if (file_exists("$theme/README.txt")) { 89 $readme = "\t\t\t\t<li>". 90 link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true)."</li>\n"; 91 } 92 if (file_exists("$theme/screenshot.png")) { 93 $screenshotpath = "$theme/screenshot.png"; 94 } else if (file_exists("$theme/screenshot.jpg")) { 95 $screenshotpath = "$theme/screenshot.jpg"; 96 } 97 98 echo "\t<tr>\n"; 99 100 // no point showing this if user is using screen reader 101 if (!$USER->screenreader) { 102 echo "\t\t<td align=\"center\">\n"; 103 if ($screenshotpath) { 104 $screenshot = "\t\t\t\t<li><a href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>\n"; 105 echo "\t\t\t<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object>\n\t\t</td>\n"; 106 } else { 107 echo "\t\t\t<object type=\"text/html\" data=\"preview.php?preview=$theme\" height=\"200\" width=\"400\">$theme</object>\n\t\t</td>\n"; 108 } 109 } 110 111 if ($CFG->theme == $theme) { 112 echo "\t\t" . '<td valign="top" style="border-style:solid; border-width:1px; border-color:#555555">'."\n"; 113 } else { 114 echo "\t\t" . '<td valign="top">'."\n"; 115 } 116 117 if (isset($THEME->sheets)) { 118 echo "\t\t\t" . '<p style="font-size:1.5em;font-weight:bold;">'.$theme.'</p>'."\n"; 119 } else { 120 echo "\t\t\t" . '<p style="font-size:1.5em;font-weight:bold;color:red;">'.$theme.' (Moodle 1.4)</p>'."\n"; 121 } 122 123 if ($screenshot or $readme) { 124 echo "\t\t\t<ul>\n"; 125 if (!$USER->screenreader) { 126 echo "\t\t\t\t<li><a href=\"preview.php?preview=$theme\">$strpreview</a></li>\n"; 127 } 128 echo $screenshot.$readme; 129 echo "\t\t\t</ul>\n"; 130 } 131 132 $options = null; 133 $options['choose'] = $theme; 134 $options['sesskey'] = $sesskey; 135 echo "\t\t\t" . print_single_button('index.php', $options, $strchoose, 'get', null, true) . "\n"; 136 echo "\t\t</td>\n"; 137 echo "\t</tr>\n"; 138 } 139 echo "</table>\n"; 140 141 $THEME = $original_theme; 142 143 admin_externalpage_print_footer(); 144 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |