|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 require_once('../config.php'); 00004 00005 $zone = optional_param('zone', '', PARAM_RAW); 00006 00007 if (!is_numeric($zone)) { 00008 //not a path, but it looks like it anyway 00009 $zone = clean_param($zone, PARAM_PATH); 00010 } 00011 00012 require_login(); 00013 00014 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); 00015 00016 $strtimezone = get_string("timezone"); 00017 $strsavechanges = get_string("savechanges"); 00018 $strusers = get_string("users"); 00019 $strall = get_string("all"); 00020 00021 $PAGE->set_url('/admin/timezone.php'); 00022 $PAGE->set_title($strtimezone); 00023 $PAGE->set_heading($strtimezone); 00024 $PAGE->navbar->add($strtimezone); 00025 echo $OUTPUT->header(); 00026 00027 echo $OUTPUT->heading(""); 00028 00029 if (data_submitted() and !empty($zone) and confirm_sesskey()) { 00030 echo "<center>"; 00031 $DB->execute("UPDATE {user} SET timezone = ?", array($zone)); 00032 echo "</center>"; 00033 00034 $USER->timezone = $zone; 00035 $current = $zone; 00036 echo $OUTPUT->notification('Timezone of all users changed', 'notifysuccess'); 00037 } else { 00038 $current = 99; 00039 } 00040 00041 require_once($CFG->dirroot.'/calendar/lib.php'); 00042 $timezones = get_list_of_timezones(); 00043 00044 echo '<center><form action="timezone.php" method="post">'; 00045 echo "$strusers ($strall): "; 00046 echo html_writer::select($timezones, "zone", $current, array('99'=>get_string("serverlocaltime"))); 00047 echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />"; 00048 echo '<input type="submit" value="'.s($strsavechanges).'" />'; 00049 echo "</form></center>"; 00050 00051 echo $OUTPUT->footer(); 00052 00053