Updated the 19 build version to 20101023
[moodle.git] / admin / mnet / mnet_themes.php
blob178485a9d79a380c38ddca930c111d635cc80342
1 <?php
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');
7 require_login();
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");
48 $report = array();
49 $unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
51 if ($choose) {
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');
60 } else {
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');
66 } else {
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');
72 } else {
73 $report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
79 $adminroot = admin_get_root();
80 require('./mnet_themes.html');