moodle/admin/timezone.php

54 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2003-11-22 09:00:15 +00:00
require_once('../config.php');
$zone = optional_param('zone', '', PARAM_RAW);
if (!is_numeric($zone)) {
//not a path, but it looks like it anyway
$zone = clean_param($zone, PARAM_PATH);
}
2003-11-22 09:00:15 +00:00
$PAGE->set_url('/admin/timezone.php');
$PAGE->set_context(context_system::instance());
require_admin();
2003-11-22 09:00:15 +00:00
$strtimezone = get_string("timezone");
$strsavechanges = get_string("savechanges");
$strusers = get_string("users");
$strall = get_string("all");
$PAGE->set_title($strtimezone);
$PAGE->set_heading($strtimezone);
$PAGE->navbar->add($strtimezone);
echo $OUTPUT->header();
echo $OUTPUT->heading("");
2003-11-22 09:00:15 +00:00
if (data_submitted() and !empty($zone) and confirm_sesskey()) {
2003-11-22 09:00:15 +00:00
echo "<center>";
$DB->execute("UPDATE {user} SET timezone = ?", array($zone));
2003-11-22 09:00:15 +00:00
echo "</center>";
$USER->timezone = $zone;
$current = $zone;
echo $OUTPUT->notification('Timezone of all users changed', 'notifysuccess');
} else {
$current = 99;
2003-11-22 09:00:15 +00:00
}
require_once($CFG->dirroot.'/calendar/lib.php');
$timezones = core_date::get_list_of_timezones(null, true);
2003-11-22 09:00:15 +00:00
echo '<center><form action="timezone.php" method="post">';
echo html_writer::label($strusers . ' (' . $strall . '): ', 'menuzone');
echo html_writer::select($timezones, "zone", $current);
2009-01-02 10:51:26 +00:00
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
echo '<input type="submit" value="'.s($strsavechanges).'" />';
2004-10-04 13:50:37 +00:00
echo "</form></center>";
2003-11-22 09:00:15 +00:00
echo $OUTPUT->footer();
2003-11-22 09:00:15 +00:00