file includeteachersgrade.html was added on branch MOODLE_15_STABLE on 2005-07-07...
[moodle.git] / admin / timezone.php
blob028e6080e57eecf032379adb4cfd24e2a91848f5
1 <?php // $Id$
3 include("../config.php");
5 require_login();
7 if (!isadmin()) {
8 error("You must be an admin");
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, $strtimezone);
18 print_heading("");
20 if (isset($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 $user = $USER;
32 if (abs($user->timezone) > 13) {
33 $user->timezone = 99;
35 $timenow = time();
36 $timeformat = get_string('strftimedaytime');
38 for ($tz = -26; $tz <= 26; $tz++) {
39 $zone = (float)$tz/2.0;
40 $usertime = $timenow + ($tz * 1800);
41 if ($tz == 0) {
42 $timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT)";
43 } else if ($tz < 0) {
44 $timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT$zone)";
45 } else {
46 $timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT+$zone)";
50 echo '<center><form action="timezone.php" method="get">';
51 echo "$strusers ($strall): ";
52 choose_from_menu ($timezones, "zone", $user->timezone, get_string("serverlocaltime"), "", "99");
53 echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
54 echo "<input type=\"submit\" value=\"$strsavechanges\">";
55 echo "</form></center>";
57 print_footer();