adding some strings
[moodle-linuxchix.git] / theme / index.php
blobac6d6fd552b4e1426a10b36eaae4d77b8d40f9eb
1 <?php // $Id$
3 require_once("../config.php");
4 require_once($CFG->libdir.'/adminlib.php');
6 $choose = optional_param("choose",'',PARAM_FILE); // set this theme as default
8 admin_externalpage_setup('themeselector');
10 unset($SESSION->theme);
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");
24 if ($choose and confirm_sesskey()) {
25 if (!is_dir($CFG->themedir .'/'. $choose)) {
26 error("This theme is not installed!");
28 if (set_config("theme", $choose)) {
29 theme_setup($choose);
30 admin_externalpage_print_header();
31 print_heading(get_string("themesaved"));
32 print_continue("$CFG->wwwroot/");
34 if (file_exists("$choose/README.html")) {
35 print_simple_box_start("center");
36 readfile("$choose/README.html");
37 print_simple_box_end();
39 } else if (file_exists("$choose/README.txt")) {
40 print_simple_box_start("center");
41 $file = file("$choose/README.txt");
42 echo format_text(implode('', $file), FORMAT_MOODLE);
43 print_simple_box_end();
45 admin_externalpage_print_footer();
46 exit;
47 } else {
48 error("Could not set the theme!");
52 admin_externalpage_print_header('themeselector');
55 print_heading($strthemes);
57 $themes = get_list_of_plugins("theme");
58 $sesskey = !empty($USER->id) ? $USER->sesskey : '';
60 echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">";
62 if (!$USER->screenreader) {
63 echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th>";
64 echo "<th scope=\"col\">$strinfo</th></tr>";
66 foreach ($themes as $theme) {
68 unset($THEME);
70 if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder
71 continue;
74 include($CFG->themedir.'/'.$theme.'/config.php');
76 $readme = '';
77 $screenshot = '';
78 $screenshotpath = '';
80 if (file_exists("$theme/README.html")) {
81 $readme = '<li>'.
82 link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
83 } else if (file_exists("$theme/README.txt")) {
84 $readme = '<li>'.
85 link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
87 if (file_exists("$theme/screenshot.png")) {
88 $screenshotpath = "$theme/screenshot.png";
89 } else if (file_exists("$theme/screenshot.jpg")) {
90 $screenshotpath = "$theme/screenshot.jpg";
93 echo "<tr>";
95 // no point showing this if user is using screen reader
96 if (!$USER->screenreader) {
97 echo "<td align=\"center\">";
98 if ($screenshotpath) {
99 $screenshot = "<li><a href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>";
100 echo "<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object></td>";
101 } else {
102 echo "<object type=\"text/html\" data=\"preview.php?preview=$theme\" height=\"200\" width=\"400\">$theme</object></td>";
106 if ($CFG->theme == $theme) {
107 echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
108 } else {
109 echo '<td valign="top">';
112 if (isset($THEME->sheets)) {
113 echo '<p style="font-size:1.5em;font-style:bold;">'.$theme.'</p>';
114 } else {
115 echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
118 if ($screenshot or $readme) {
119 echo '<ul>';
120 if (!$USER->screenreader) {
121 echo "<li><a href=\"preview.php?preview=$theme\">$strpreview</a></li>";
123 echo $screenshot.$readme;
124 echo '</ul>';
127 $options = null;
128 $options['choose'] = $theme;
129 $options['sesskey'] = $sesskey;
130 print_single_button('index.php', $options, $strchoose);
131 echo '</td>';
132 echo "</tr>";
134 echo "</table>";
136 admin_externalpage_print_footer();