--- /dev/null
+<?php
+admin_externalpage_print_header($adminroot);
+
+$logurl = $CFG->wwwroot.
+ '/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
+ '%2F1&user='.'0'.
+ '&date=0'.
+ '&modid=&modaction=0&logformat=showashtml';
+
+$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
+$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
+$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
+if ($mnet_peer->id != $CFG->mnet_all_hosts_id) $tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
+print_tabs(array($tabs), 'mnetthemes');
+print_simple_box_start("center", "");
+
+ print_heading($strthemes);
+
+
+
+ $themes = get_list_of_plugins("theme");
+ $sesskey = !empty($USER->id) ? $USER->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;
+ print_single_button('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_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
+ } else if (file_exists($CFG->themedir.'/'.$theme.'/README.txt')) {
+ $readme = '<li>'.
+ link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
+ }
+ 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;
+ print_single_button('mnet_themes.php', $options, $strchoose);
+ echo '</td>';
+ echo "</tr>";
+ }
+ echo "</table>";
+
+print_simple_box_end();
+admin_externalpage_print_footer($adminroot);
+?>
--- /dev/null
+<?php
+ // Allows the admin to configure services for remote hosts
+
+ require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
+ require_once($CFG->libdir.'/adminlib.php');
+ include_once($CFG->dirroot.'/mnet/lib.php');
+error_reporting(E_ALL);
+ini_set('display_errors', true);
+ require_login();
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('mnetpeers', $adminroot);
+
+ $context = get_context_instance(CONTEXT_SYSTEM);
+
+ require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
+
+ if (!$site = get_site()) {
+ print_error('nosite', '', '', NULL, true);
+ }
+
+/// Initialize variables.
+
+ $hostid = required_param('hostid', PARAM_INT);
+
+ $stradministration = get_string('administration');
+ $strconfiguration = get_string('configuration');
+
+ $strmnetedithost = get_string('reviewhostdetails', 'mnet');
+ $strmnetsettings = get_string('mnetsettings', 'mnet');
+ $strmnetservices = get_string('mnetservices', 'mnet');
+ $strmnetthemes = get_string('mnetthemes', 'mnet');
+ $strmnetlog = get_string('mnetlog', 'mnet');
+
+
+ $mnet_peer = new mnet_peer();
+ if (is_int($hostid)) {
+ $mnet_peer->set_id($hostid);
+ }
+
+ $choose = optional_param("choose",'',PARAM_FILE); // set this theme as default
+ $stradministration = get_string("administration");
+ $strconfiguration = get_string("configuration");
+ $strthemes = get_string("themes");
+ $strpreview = get_string("preview");
+ $strchoose = get_string("choose");
+ $strinfo = get_string("info");
+ $strtheme = get_string("theme");
+ $strthemesaved = get_string("themesaved");
+ $strscreenshot = get_string("screenshot");
+ $stroldtheme = get_string("oldtheme");
+ $report = array();
+ $unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
+
+ if ($choose) {
+ if (confirm_sesskey()) {
+ if ($choose == $unlikely_name) {
+ $mnet_peer->force_theme = 1;
+ $mnet_peer->theme = '';
+ if ($mnet_peer->commit()) {
+ $report = array(get_string('themesaved'), 'informationbox');
+ } else {
+ $report = array(get_string('themesavederror', 'mnet'), 'errorbox');
+ }
+ } elseif (!is_dir($CFG->themedir .'/'. $choose) || !file_exists($CFG->themedir .'/'. $choose .'/config.php')) {
+ echo 'CHOOSE -'.$choose.' '. $CFG->themedir .'/'. $choose .'/config.php' ;
+ $report = array('This theme is not installed!'.'3', 'errorbox');
+ } else {
+ $mnet_peer->force_theme = 1;
+ $mnet_peer->theme = addslashes($choose);
+ if ($mnet_peer->commit()) {
+ $report = array(get_string('themesaved').'1', 'informationbox');
+ } else {
+ $report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
+ }
+ }
+ }
+ }
+
+ include('./mnet_themes.html');
+?>