[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/admin/mnet/ -> mnet_themes.php (source)

   1  <?php
   2      // Allows the admin to configure services for remote hosts
   3  
   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');
   9  
  10      $context = get_context_instance(CONTEXT_SYSTEM);
  11  
  12      require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
  13  
  14      if (!$site = get_site()) {
  15          print_error('nosite', '', '', NULL, true);
  16      }
  17  
  18  /// Initialize variables.
  19  
  20      $hostid = required_param('hostid', PARAM_INT);
  21  
  22      $stradministration   = get_string('administration');
  23      $strconfiguration    = get_string('configuration');
  24  
  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');
  30  
  31  
  32      $mnet_peer = new mnet_peer();
  33      if (is_int($hostid)) {
  34          $mnet_peer->set_id($hostid);
  35      }
  36  
  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
  50  
  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');
  62                  }
  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');
  74                  }
  75              }
  76          }
  77      }
  78  
  79      $adminroot = admin_get_root();
  80      require ('./mnet_themes.html');
  81  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7