Skip to content
Browse files

MDL-28407 Fixed up calendar preferences form handling

  • Loading branch information...
1 parent 4b85dc1 commit 3b7127a9b7bfef4c7ed810953c28a965d73a45f6 @samhemelryk samhemelryk committed
Showing with 6 additions and 3 deletions.
  1. +6 −3 calendar/preferences.php
View
9 calendar/preferences.php
@@ -30,10 +30,13 @@
$prefs->lookahead = get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS);
$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 = '';
}
@@ -61,7 +64,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("$site->shortname: $strcalendar: $strpreferences");
$PAGE->set_heading($COURSE->fullname);

0 comments on commit 3b7127a

Please sign in to comment.
Something went wrong with that request. Please try again.