2 // Allows the admin to configure services for remote hosts
4 require_once(dirname(dirname(dirname(__FILE__
))) . '/config.php');
5 require_once($CFG->libdir
.'/adminlib.php');
6 include_once($CFG->dirroot
.'/mnet/lib.php');
8 admin_externalpage_setup('mnetpeers');
10 $context = get_context_instance(CONTEXT_SYSTEM
);
12 require_capability('moodle/site:config', $context, $USER->id
, true, "nopermissions");
14 if (!$site = get_site()) {
15 print_error('nosite', '', '', NULL, true);
18 /// Initialize variables.
20 $hostid = required_param('hostid', PARAM_INT
);
22 $stradministration = get_string('administration');
23 $strconfiguration = get_string('configuration');
25 $strmnetedithost = get_string('reviewhostdetails', 'mnet');
26 $strmnetsettings = get_string('mnetsettings', 'mnet');
27 $strmnetservices = get_string('mnetservices', 'mnet');
28 $strmnetthemes = get_string('mnetthemes', 'mnet');
29 $strmnetlog = get_string('mnetlog', 'mnet');
32 $mnet_peer = new mnet_peer();
33 if (is_int($hostid)) {
34 $mnet_peer->set_id($hostid);
37 $choose = optional_param("choose",'',PARAM_FILE
); // set this theme as default
38 $stradministration = get_string("administration");
39 $strconfiguration = get_string("configuration");
40 $strthemes = get_string("themes");
41 $strpreview = get_string("preview");
42 $strchoose = get_string("choose");
43 $strinfo = get_string("info");
44 $strtheme = get_string("theme");
45 $strthemesaved = get_string("themesaved");
46 $strscreenshot = get_string("screenshot");
47 $stroldtheme = get_string("oldtheme");
49 $unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
52 if (confirm_sesskey()) {
53 if ($choose == $unlikely_name) {
54 $mnet_peer->force_theme
= 1;
55 $mnet_peer->updateparams
->force_theme
= 1;
56 $mnet_peer->theme
= '';
57 $mnet_peer->updateparams
->theme
= '';
58 if ($mnet_peer->commit()) {
59 $report = array(get_string('themesaved'), 'informationbox');
61 $report = array(get_string('themesavederror', 'mnet'), 'errorbox');
63 } elseif (!is_dir($CFG->themedir
.'/'. $choose) ||
!file_exists($CFG->themedir
.'/'. $choose .'/config.php')) {
64 echo 'CHOOSE -'.$choose.' '. $CFG->themedir
.'/'. $choose .'/config.php' ;
65 $report = array('This theme is not installed!'.'3', 'errorbox');
67 $mnet_peer->force_theme
= 1;
68 $mnet_peer->theme
= $choose;
69 $mnet_peer->updateparams
->theme
= addslashes($choose);
70 if ($mnet_peer->commit()) {
71 $report = array(get_string('themesaved').'1', 'informationbox');
73 $report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
79 $adminroot = admin_get_root();
80 require('./mnet_themes.html');