Permalink
Browse files

MDL-29108: support for returnurl in rubriceditor

  • Loading branch information...
1 parent 5060997 commit ed709412c23fe21ba428955b1ba41cd637b28a06 @marinaglancy marinaglancy committed Oct 24, 2011
Showing with 10 additions and 5 deletions.
  1. +8 −5 grade/grading/form/rubric/edit.php
  2. +2 −0 grade/grading/form/rubric/edit_form.php
@@ -47,14 +47,17 @@
//TODO freeze rubric editor if needed
$mform = new gradingform_rubric_editrubric(null, array('areaid' => $areaid, 'context' => $context, 'freezerubric' => optional_param('freeze', 0, PARAM_INT)));
-$mform->set_data($controller->get_definition_for_editing());
+$data = $controller->get_definition_for_editing();
+$returnurl = optional_param('returnurl', $manager->get_management_url(), PARAM_LOCALURL);
+$data->returnurl = $returnurl;
+$mform->set_data($data);
if ($mform->is_cancelled()) {
// todo process editing cancel in a better way
- redirect($manager->get_management_url());
-
-} else if ($data = $mform->get_data()) {
+ redirect($returnurl);
+} else if ($mform->is_submitted() && $mform->is_validated()) {
+ $data = $mform->get_data();
$controller->update_definition($data);
- redirect($PAGE->url);
+ redirect($returnurl);
}
echo $OUTPUT->header();
@@ -44,6 +44,8 @@ public function definition() {
$form->addElement('hidden', 'areaid');
$form->setType('areaid', PARAM_INT);
+ $form->addElement('hidden', 'returnurl');
+
// name
$form->addElement('text', 'name', get_string('name', 'gradingform_rubric'), array('size'=>52));
$form->addRule('name', get_string('required'), 'required');

0 comments on commit ed70941

Please sign in to comment.