]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18004 Redirecting report preference forms to their respective reports when submit...
authornicolasconnault <nicolasconnault>
Tue, 17 Feb 2009 09:12:25 +0000 (09:12 +0000)
committernicolasconnault <nicolasconnault>
Tue, 17 Feb 2009 09:12:25 +0000 (09:12 +0000)
grade/report/grader/preferences.php
grade/report/visual/preferences.php

index fa34afa982ab2f16778ee277571c216a9a22847a..e37a168615ad9ef01732f4172cdd1aee9068c2fa 100644 (file)
@@ -44,12 +44,8 @@ require_capability('gradereport/grader:view', $context);
 require('preferences_form.php');
 $mform = new grader_report_preferences_form('preferences.php', compact('course'));
 
-if ($mform->is_cancelled()){
-    redirect($CFG->wwwroot . '/grade/report/grader/index.php?id='.$courseid);
-}
-
 // If data submitted, then process and store.
-if ($data = $mform->get_data()) {
+if (!$mform->is_cancelled() && $data = $mform->get_data()) {
     foreach ($data as $preference => $value) {
         if (substr($preference, 0, 6) !== 'grade_') {
             continue;
@@ -66,6 +62,11 @@ if ($data = $mform->get_data()) {
     exit;
 }
 
+if ($mform->is_cancelled()){
+    redirect($CFG->wwwroot . '/grade/report/grader/index.php?id='.$courseid);
+}
+
+
 print_grade_page_head($courseid, 'preferences', 'grader', get_string('preferences', 'gradereport_grader'));
 
 // If USER has admin capability, print a link to the site config page for this report
index da78e1dcad32afea75aa152c1f02bdf02fcc8284..dcf95948f9d79e73b41be06b4de7d2ddd907e50f 100755 (executable)
@@ -69,24 +69,27 @@ if ($data = $mform->get_data()) {
             set_user_preference($preference, $value);
         }
     }
+
+    redirect($CFG->wwwroot . '/grade/report/visual/index.php?id='.$courseid); // message here breaks accessability and is sloooowww
+    exit;
 }
 
 /// If cancelled go back to report
 if ($mform->is_cancelled()){
     redirect($CFG->wwwroot . '/grade/report/visual/index.php?id='.$courseid);
 }
+$strvisualreport = get_string('modulename', 'gradereport_visual');
+
 
-print_grade_page_head($courseid, 'preferences', 'visual', get_string('preferences', 'gradereport_visual'));
+print_grade_page_head($COURSE->id, 'settings', 'visual', $strvisualreport . ' ' . get_string('preferences'));
 
 /// If USER has admin capability, print a link to the site config page for this report
 /// TODO: Add admin config page for this report
-/*
 if (has_capability('moodle/site:config', $systemcontext)) {
     echo '<div id="siteconfiglink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=gradereportvisual">';
     echo get_string('changereportdefaults', 'grades');
     echo "</a></div>\n";
 }
-*/
 
 print_simple_box_start("center");