moodle/admin/mnet/mnet_themes.html
2010-03-31 08:05:53 +00:00

123 lines
4.5 KiB
HTML

<?php
//TODO: this code needs to be redesigned, see MDL-21137
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('themes'));
$original_theme = fullclone($THEME);
$currenttab = 'mnetthemes';
require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php');
$themes = get_list_of_plugins("theme");
$sesskey = sesskey();
echo '<table style="margin-left:auto;margin-right:auto;" cellpadding="7" cellspacing="5">';
if (count($report)) {
echo '<tr>';
echo '<td align="center" colspan="2">';
echo '<span class="'.$report[1].'">'.$report[0].'</span>';
echo '</td>';
echo '</tr>';
}
if (!$USER->screenreader) {
echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th>";
echo "<th scope=\"col\">$strinfo</th></tr>";
}
echo "<tr>";
echo '<td align="center"><span class="informationbox">Choose this option to use your site\'s default theme: <strong>'.$CFG->theme.'</strong>.</span></td>';
if ($mnet_peer->theme == '') {
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
} else {
echo '<td valign="top">';
}
echo '<p style="font-size:1.5em;font-style:bold;">Site Theme</p>';
$options = null;
$options['choose'] = $unlikely_name;// Something unlikely to ever be a theme name... initially $unlikely_name = 'ZoqZoqZ';
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
echo $OUTPUT->single_button(new moodle_url('mnet_themes.php', $options), $strchoose);
echo '</td>';
echo "</tr>";
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($CFG->themedir.'/'.$theme.'/README.html')) {
$readme = '<li>'.
$link = $CFG->themewww .'/'. $theme .'/README.html';
$action = new popup_action('click', $link, $theme, array('height' => 400, 'width' => 500));
echo $OUTPUT->action_link($link, strinfo, $action);
} else if (file_exists($CFG->themedir.'/'.$theme.'/README.txt')) {
$readme = '<li>'.
$link = $CFG->themewww .'/'. $theme .'/README.txt';
$action = new popup_action('click', $link, $theme, array('height' => 400, 'width' => 500));
echo $OUTPUT->action_link($link, $strinfo, $action);
}
if (file_exists("$theme/screenshot.png")) {
$screenshotpath = "$theme/screenshot.png";
} else if (file_exists("$theme/screenshot.jpg")) {
$screenshotpath = "$theme/screenshot.jpg";
}
echo "<tr>";
// no point showing this if user is using screen reader
if (!$USER->screenreader) {
echo "<td align=\"center\">";
if ($screenshotpath) {
$screenshot = '<li><a href='.$CFG->wwwroot .'/theme/'. $theme.'/screenshot.jpg">'.$strscreenshot.'</a></li>';
echo "<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object></td>";
} else {
echo '<object type="text/html" data="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'" height="200" width="400">'.$theme.'</object></td>';
}
}
if ($mnet_peer->theme == $theme) {
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
} else {
echo '<td valign="top">';
}
if (isset($THEME->sheets)) {
echo '<p style="font-size:1.5em;font-style:bold;">'.$theme.'</p>';
} else {
echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
}
if ($screenshot or $readme) {
echo '<ul>';
if (!$USER->screenreader) {
echo '<li><a href="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'">'.$strpreview.'</a></li>';
}
echo $screenshot.$readme;
echo '</ul>';
}
$options = null;
$options['choose'] = $theme;
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
echo $OUTPUT->single_button(new moodle_url('mnet_themes.php', $options), $strchoose);
echo '</td>';
echo "</tr>";
}
echo "</table>";
$THEME = $original_theme;
echo $OUTPUT->footer();