MDL-10689:
[moodle-linuxchix.git] / admin / timezone.php
blob73a9d24e6cb87ea15a3fffd031535d8ea6182579
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, SITEID));
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();