From: moodler Date: Sat, 22 Nov 2003 09:00:15 +0000 (+0000) Subject: Quick script to slam timezones X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4708a37266b90811d1c11618a6926a510427d789;p=moodle.git Quick script to slam timezones --- diff --git a/admin/timezone.php b/admin/timezone.php new file mode 100644 index 0000000000..0821d18f62 --- /dev/null +++ b/admin/timezone.php @@ -0,0 +1,57 @@ +debug = true; + echo "
"; + execute_sql("UPDATE {$CFG->prefix}user SET timezone = '$zone'"); + $db->debug = false; + echo "
"; + + $USER->timezone = $zone; + } + + $user = $USER; + + if (abs($user->timezone) > 13) { + $user->timezone = 99; + } + $timenow = time(); + + for ($tz = -26; $tz <= 26; $tz++) { + $zone = (float)$tz/2.0; + $usertime = $timenow + ($tz * 1800); + if ($tz == 0) { + $timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT)"; + } else if ($tz < 0) { + $timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT$zone)"; + } else { + $timezones["$zone"] = gmstrftime("%a, %I:%M %p", $usertime)." (GMT+$zone)"; + } + } + + echo "
"; + echo "$strusers ($strall): "; + choose_from_menu ($timezones, "zone", $user->timezone, get_string("serverlocaltime"), "", "99"); + echo ""; + echo "
"; + + print_footer(); + +?>