3 require_once("../config.php");
5 $choose = optional_param("choose",'',PARAM_FILE
); // set this theme as default
7 if (! $site = get_site()) {
8 error("Site doesn't exist!");
14 error("You must be an administrator to change themes.");
17 unset($SESSION->theme
);
19 $stradministration = get_string("administration");
20 $strconfiguration = get_string("configuration");
21 $strthemes = get_string("themes");
22 $strpreview = get_string("preview");
23 $strchoose = get_string("choose");
24 $strinfo = get_string("info");
25 $strtheme = get_string("theme");
26 $strthemesaved = get_string("themesaved");
27 $strscreenshot = get_string("screenshot");
28 $stroldtheme = get_string("oldtheme");
31 if ($choose and confirm_sesskey()) {
32 if (!is_dir($choose)) {
33 error("This theme is not installed!");
35 if (set_config("theme", $choose)) {
38 print_header("$site->shortname: $strthemes", $site->fullname
,
39 "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
40 "<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $strthemes");
41 print_heading(get_string("themesaved"));
42 print_continue("$CFG->wwwroot/");
44 if (file_exists("$choose/README.html")) {
45 print_simple_box_start("center");
46 readfile("$choose/README.html");
47 print_simple_box_end();
49 } else if (file_exists("$choose/README.txt")) {
50 print_simple_box_start("center");
51 $file = file("$choose/README.txt");
52 echo format_text(implode('', $file), FORMAT_MOODLE
);
53 print_simple_box_end();
58 error("Could not set the theme!");
62 print_header("$site->shortname: $strthemes", $site->fullname
,
63 "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
64 "<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $strthemes");
67 print_heading($strthemes);
69 $themes = get_list_of_plugins("theme");
70 $sesskey = !empty($USER->id
) ?
$USER->sesskey
: '';
72 echo "<table align=\"center\" cellpadding=\"7\" cellspacing=\"5\">";
73 echo "<tr class=\"generaltableheader\"><th>$strtheme</th><th>$strinfo</th></tr>";
74 foreach ($themes as $theme) {
78 if (!file_exists($CFG->themedir
.$theme.'/config.php')) { // bad folder
82 include($CFG->themedir
.$theme.'/config.php');
88 if (file_exists("$theme/README.html")) {
90 link_to_popup_window('/theme/'.$theme.'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
91 } else if (file_exists("$theme/README.txt")) {
93 link_to_popup_window('/theme/'.$theme.'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
95 if (file_exists("$theme/screenshot.png")) {
96 $screenshotpath = "$theme/screenshot.png";
97 } else if (file_exists("$theme/screenshot.jpg")) {
98 $screenshotpath = "$theme/screenshot.jpg";
102 echo "<td align=\"center\">";
104 if ($screenshotpath) {
105 $screenshot = "<li><a target=\"$theme\" href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>";
106 echo "<iframe name=\"$theme\" src=\"$screenshotpath\" height=\"200\" width=\"400\"></iframe></td>";
108 echo "<iframe name=\"$theme\" src=\"preview.php?preview=$theme\" height=\"200\" width=\"400\"></iframe></td>";
112 if ($CFG->theme
== $theme) {
113 echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
115 echo '<td valign="top">';
118 if (isset($THEME->sheets
)) {
119 echo '<p style="font-size:1.5em;font-style:bold;">'.$theme.'</p>';
121 echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
126 if ($screenshot or $readme) {
127 echo "<li><a target=\"$theme\" href=\"preview.php?preview=$theme\">$strpreview</a></li>";
129 echo $screenshot.$readme;
133 $options['choose'] = $theme;
134 $options['sesskey'] = $sesskey;
135 print_single_button('index.php', $options, $strchoose);
141 echo "<br /><div align=\"center\">";
142 $options["frame"] = "developer.html";
143 $options["sub"] = "themes";
144 print_single_button("$CFG->wwwroot/doc/index.php", $options, get_string("howtomakethemes"));