MDL-23479 scorm restore code - correct time shifting
[moodle.git] / admin / timezone.php
blob34e1fa40fdac9513bf84c3b762c8947d70282ed9
1 <?php
3 require_once('../config.php');
5 $zone = optional_param('zone', '', PARAM_RAW);
7 if (!is_numeric($zone)) {
8 //not a path, but it looks like it anyway
9 $zone = clean_param($zone, PARAM_PATH);
12 require_login();
14 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
16 $strtimezone = get_string("timezone");
17 $strsavechanges = get_string("savechanges");
18 $strusers = get_string("users");
19 $strall = get_string("all");
21 $PAGE->set_url('/admin/timezone.php');
22 $PAGE->set_title($strtimezone);
23 $PAGE->set_heading($strtimezone);
24 $PAGE->navbar->add($strtimezone);
25 echo $OUTPUT->header();
27 echo $OUTPUT->heading("");
29 if (data_submitted() and !empty($zone) and confirm_sesskey()) {
30 echo "<center>";
31 $DB->execute("UPDATE {user} SET timezone = ?", array($zone));
32 echo "</center>";
34 $USER->timezone = $zone;
35 $current = $zone;
36 echo $OUTPUT->notification('Timezone of all users changed', 'notifysuccess');
37 } else {
38 $current = 99;
41 require_once($CFG->dirroot.'/calendar/lib.php');
42 $timezones = get_list_of_timezones();
44 echo '<center><form action="timezone.php" method="post">';
45 echo "$strusers ($strall): ";
46 echo html_writer::select($timezones, "zone", $current, array('99'=>get_string("serverlocaltime")));
47 echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
48 echo '<input type="submit" value="'.s($strsavechanges).'" />';
49 echo "</form></center>";
51 echo $OUTPUT->footer();