2002-09-27 14:19:59 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("../config.php");
|
2002-09-27 14:19:59 +00:00
|
|
|
|
|
|
|
optional_variable($preview); // which theme to show
|
|
|
|
optional_variable($choose); // set this theme as default
|
|
|
|
|
2003-05-09 02:32:43 +00:00
|
|
|
if (! $site = get_site()) {
|
|
|
|
error("Site doesn't exist!");
|
|
|
|
}
|
|
|
|
|
|
|
|
require_login();
|
|
|
|
|
|
|
|
if (!isadmin()) {
|
|
|
|
error("You must be an administrator to change themes.");
|
|
|
|
}
|
|
|
|
|
2002-09-27 14:19:59 +00:00
|
|
|
if ($choose) {
|
2003-05-09 02:32:43 +00:00
|
|
|
if (!is_dir($choose)) {
|
|
|
|
error("This theme is not installed!");
|
|
|
|
}
|
2002-09-27 14:19:59 +00:00
|
|
|
$preview = $choose;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($preview) {
|
|
|
|
$CFG->theme = $preview;
|
2002-12-09 16:10:57 +00:00
|
|
|
$CFG->stylesheet = "$CFG->wwwroot/theme/$CFG->theme/styles.php?themename=$preview";
|
2002-09-27 14:19:59 +00:00
|
|
|
$CFG->header = "$CFG->dirroot/theme/$CFG->theme/header.html";
|
|
|
|
$CFG->footer = "$CFG->dirroot/theme/$CFG->theme/footer.html";
|
|
|
|
include ("$CFG->theme/config.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
$stradministration = get_string("administration");
|
2003-08-18 16:40:27 +00:00
|
|
|
$strconfiguration = get_string("configuration");
|
2003-08-10 14:37:52 +00:00
|
|
|
$strthemes = get_string("themes");
|
2002-09-27 14:19:59 +00:00
|
|
|
$strpreview = get_string("preview");
|
|
|
|
$strsavechanges = get_string("savechanges");
|
|
|
|
$strtheme = get_string("theme");
|
|
|
|
$strthemesaved = get_string("themesaved");
|
|
|
|
|
2003-08-10 14:37:52 +00:00
|
|
|
print_header("$site->shortname: $strthemes", $site->fullname,
|
2003-08-18 16:40:27 +00:00
|
|
|
"<a href=\"$CFG->wwwroot/admin/index.php\">$stradministration</a> -> ".
|
|
|
|
"<a href=\"$CFG->wwwroot/admin/configure.php\">$strconfiguration</a> -> $strthemes");
|
2002-09-27 14:19:59 +00:00
|
|
|
|
|
|
|
if ($choose) {
|
|
|
|
if (set_config("theme", $choose)) {
|
|
|
|
print_heading(get_string("themesaved"));
|
2004-06-01 17:53:39 +00:00
|
|
|
print_continue("$CFG->wwwroot/");
|
2004-05-22 08:53:58 +00:00
|
|
|
|
|
|
|
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")) {
|
2004-05-22 08:04:10 +00:00
|
|
|
print_simple_box_start("center");
|
|
|
|
$file = file("$choose/README.txt");
|
|
|
|
echo format_text(implode('', $file), FORMAT_MOODLE);
|
|
|
|
print_simple_box_end();
|
|
|
|
}
|
2002-09-27 14:19:59 +00:00
|
|
|
print_footer();
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
error("Could not set the theme!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print_heading(get_string("previeworchoose"));
|
|
|
|
|
|
|
|
$themes = get_list_of_plugins("theme");
|
|
|
|
|
2004-09-12 21:43:59 +00:00
|
|
|
echo "<table align=\"center\" cellpadding=\"7\" cellspacing=\"5\">";
|
|
|
|
echo "<tr><th class=\"generaltableheader\">$strtheme<th class=\"generaltableheader\"> </tr>";
|
2002-09-27 14:19:59 +00:00
|
|
|
foreach ($themes as $theme) {
|
2004-08-31 13:37:24 +00:00
|
|
|
|
|
|
|
if (!file_exists("$CFG->dirroot/theme/$theme/config.php")) { // bad folder
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
include ("$CFG->dirroot/theme/$theme/config.php");
|
|
|
|
|
2004-09-12 21:43:59 +00:00
|
|
|
echo "<tr>";
|
2002-09-27 14:19:59 +00:00
|
|
|
if ($CFG->theme == $theme) {
|
2004-09-12 21:43:59 +00:00
|
|
|
echo "<td align=\"center\" bgcolor=\"$THEME->body\">$theme</td>";
|
|
|
|
echo "<td align=\"center\"><a href=\"index.php?choose=$theme\">$strsavechanges</a></td>";
|
2002-09-27 14:19:59 +00:00
|
|
|
} else {
|
2004-09-12 21:43:59 +00:00
|
|
|
echo "<td align=\"center\" bgcolor=\"$THEME->body\">";
|
|
|
|
echo "<a title=\"$strpreview\" href=\"index.php?preview=$theme\">$theme</a>";
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td> </td>";
|
2002-09-27 14:19:59 +00:00
|
|
|
}
|
2004-05-22 08:04:10 +00:00
|
|
|
echo "</tr>";
|
2002-09-27 14:19:59 +00:00
|
|
|
}
|
2004-05-22 08:04:10 +00:00
|
|
|
echo "</table>";
|
2002-09-27 14:19:59 +00:00
|
|
|
|
2004-09-12 21:43:59 +00:00
|
|
|
echo "<br /><div align=\"center\">";
|
2003-01-06 08:22:49 +00:00
|
|
|
$options["frame"] = "developer.html";
|
|
|
|
$options["sub"] = "themes";
|
|
|
|
print_single_button("$CFG->wwwroot/doc/index.php", $options, get_string("howtomakethemes"));
|
2004-05-22 08:04:10 +00:00
|
|
|
echo "</div>";
|
2002-09-27 14:19:59 +00:00
|
|
|
print_footer();
|
|
|
|
|
|
|
|
?>
|