Skip to content

Commit

Permalink
MDL-28407 Fixed up calendar preferences form handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Aug 5, 2011
1 parent 3fdc622 commit 683eb07
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions calendar/preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$courseid = required_param('course', PARAM_INT);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);

$PAGE->set_url('/calendar/preferences.php', array('id' => $courseid));
$PAGE->set_url(new moodle_url('/calendar/preferences.php', array('course' => $courseid)));
$PAGE->set_pagelayout('standard');

require_login($course);
Expand Down Expand Up @@ -37,10 +37,13 @@
$prefs->lookahead = get_user_preferences('calendar_lookahead', $defaultlookahead);
$prefs->persistflt = get_user_preferences('calendar_persistflt', 0);

$form = new calendar_preferences_form();
$form = new calendar_preferences_form($PAGE->url);
$form->set_data($prefs);

if ($data = $form->get_data() && confirm_sesskey()) {
if ($form->is_cancelled()) {
redirect($viewurl);
} else if ($form->is_submitted() && $form->is_validated() && confirm_sesskey()) {
$data = $form->get_data();
if ($data->timeformat != CALENDAR_TF_12 && $data->timeformat != CALENDAR_TF_24) {
$data->timeformat = '';
}
Expand Down Expand Up @@ -68,7 +71,7 @@
$strcalendar = get_string('calendar', 'calendar');
$strpreferences = get_string('calendarpreferences', 'calendar');

$PAGE->navbar->add($strpreferences, new moodle_url('/calendar/view.php'));
$PAGE->navbar->add($strpreferences);
$PAGE->set_pagelayout('admin');
$PAGE->set_title("$course->shortname: $strcalendar: $strpreferences");
$PAGE->set_heading($course->fullname);
Expand Down

0 comments on commit 683eb07

Please sign in to comment.