[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/ -> timezone.php (source)

   1  <?php
   2  
   3      require_once('../config.php');
   4  
   5      $zone = optional_param('zone', '', PARAM_RAW);
   6  
   7      if (!is_numeric($zone)) {
   8           //not a path, but it looks like it anyway
   9           $zone = clean_param($zone, PARAM_PATH);
  10      }
  11  
  12      $PAGE->set_url('/admin/timezone.php');
  13      $PAGE->set_context(context_system::instance());
  14  
  15      require_login();
  16  
  17      require_capability('moodle/site:config', context_system::instance());
  18  
  19      $strtimezone = get_string("timezone");
  20      $strsavechanges = get_string("savechanges");
  21      $strusers = get_string("users");
  22      $strall = get_string("all");
  23  
  24      $PAGE->set_title($strtimezone);
  25      $PAGE->set_heading($strtimezone);
  26      $PAGE->navbar->add($strtimezone);
  27      echo $OUTPUT->header();
  28  
  29      echo $OUTPUT->heading("");
  30  
  31      if (data_submitted() and !empty($zone) and confirm_sesskey()) {
  32          echo "<center>";
  33          $DB->execute("UPDATE {user} SET timezone = ?", array($zone));
  34          echo "</center>";
  35  
  36          $USER->timezone = $zone;
  37          $current = $zone;
  38          echo $OUTPUT->notification('Timezone of all users changed', 'notifysuccess');
  39      } else {
  40          $current = 99;
  41      }
  42  
  43      require_once($CFG->dirroot.'/calendar/lib.php');
  44      $timezones = core_date::get_list_of_timezones(null, true);
  45  
  46      echo '<center><form action="timezone.php" method="post">';
  47      echo html_writer::label($strusers . ' (' . $strall . '): ', 'menuzone');
  48      echo html_writer::select($timezones, "zone", $current);
  49      echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
  50      echo '<input type="submit" value="'.s($strsavechanges).'" />';
  51      echo "</form></center>";
  52  
  53      echo $OUTPUT->footer();
  54  
  55  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1