Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / admin / timezone.php
blob94993cc644ecc97b2f09bd07083958838851f370
1 <?php // $Id$
3 require_once('../config.php');
5 $zone = optional_param('zone', '', PARAM_PATH); //not a path, but it looks like it anyway
7 require_login();
9 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
11 $strtimezone = get_string("timezone");
12 $strsavechanges = get_string("savechanges");
13 $strusers = get_string("users");
14 $strall = get_string("all");
16 print_header($strtimezone, $strtimezone, build_navigation(array(array('name' => $strtimezone, 'link' => null, 'type' => 'misc'))));
18 print_heading("");
20 if (!empty($zone) and confirm_sesskey()) {
21 $db->debug = true;
22 echo "<center>";
23 execute_sql("UPDATE {$CFG->prefix}user SET timezone = '$zone'");
24 $db->debug = false;
25 echo "</center>";
27 $USER->timezone = $zone;
30 require_once($CFG->dirroot.'/calendar/lib.php');
31 $timezones = get_list_of_timezones();
33 echo '<center><form action="timezone.php" method="get">';
34 echo "$strusers ($strall): ";
35 choose_from_menu ($timezones, "zone", 99, get_string("serverlocaltime"), "", "99");
36 echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
37 echo "<input type=\"submit\" value=\"$strsavechanges\" />";
38 echo "</form></center>";
40 print_footer();