]> git.mjollnir.org Git - moodle.git/commitdiff
removed use of session for reordertool and show page breaks. Reordertool and show...
authorjamiesensei <jamiesensei>
Thu, 3 May 2007 10:38:35 +0000 (10:38 +0000)
committerjamiesensei <jamiesensei>
Thu, 3 May 2007 10:38:35 +0000 (10:38 +0000)
mod/quiz/edit.php
mod/quiz/editlib.php

index 47d904168e50914bd02e812cd38d3e0bc0e3af83..d30b6b3f5fba368b986d72c64a1bd7140d528300 100644 (file)
 
     list($thispageurl, $courseid, $cmid, $cm, $quiz, $pagevars) = question_edit_setup(true);
 
-    
+    //these params are only passed from page request to request while we stay on this page
+    //otherwise they would go in question_edit_setup
+    $quiz_showbreaks = optional_param('showbreaks', -1, PARAM_BOOL);
+    $quiz_reordertool = optional_param('reordertool', 0, PARAM_BOOL);
+    if ($quiz_showbreaks > -1) {
+        $thispageurl->param('showbreaks', $quiz_showbreaks);
+    } else {
+        $quiz_showbreaks = ($CFG->quiz_questionsperpage < 2) ? 0 : 1;
+    }
+    if ($quiz_reordertool != 0) {
+        $thispageurl->param('reordertool', $quiz_reordertool);
+    }
+        
     $strquizzes = get_string('modulenameplural', 'quiz');
     $strquiz = get_string('modulename', 'quiz');
     $streditingquestions = get_string('editquestions', "quiz");
         }
     }
 
-    if(isset($_REQUEST['showbreaks'])) {
-        $SESSION->quiz_showbreaks = optional_param('showbreaks', 0, PARAM_BOOL);
-        $SESSION->quiz_reordertool = optional_param('reordertool', 0, PARAM_BOOL);
-    }
-
 /// Delete any teacher preview attempts if the quiz has been modified
     if (isset($_REQUEST['savechanges']) or isset($_REQUEST['delete']) or isset($_REQUEST['repaginate']) or isset($_REQUEST['addrandom']) or isset($_REQUEST['addquestion']) or isset($_REQUEST['up']) or isset($_REQUEST['down']) or isset($_REQUEST['add'])) {
         delete_records('quiz_attempts', 'preview', '1', 'quiz', $quiz->id);
         $category = get_default_question_category($course->id);
         $quiz->category = $category->id;
     }
-    if (!isset($SESSION->quiz_showbreaks)) {
-        $SESSION->quiz_showbreaks = ($CFG->quiz_questionsperpage < 2) ? 0 : 1;
-    }
-    if (!isset($SESSION->quiz_reordertool)) {
-        $SESSION->quiz_reordertool = 0;
-    }
-
 
     // Print basic page layout.
 
         echo "<a href=\"report.php?mode=overview&amp;id=$cm->id\">".get_string('numattempts', 'quiz', $a)."</a><br />".get_string("attemptsexist","quiz");
         echo "</div><br />\n";
 
-        $sumgrades = quiz_print_question_list($quiz,  $thispageurl, false, $SESSION->quiz_showbreaks, $SESSION->quiz_reordertool);
+        $sumgrades = quiz_print_question_list($quiz,  $thispageurl, false, $quiz_showbreaks, $quiz_reordertool);
         if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $quiz->instance)) {
             error('Failed to set sumgrades');
         }
     print_box_start('generalbox quizquestions');
     print_heading(get_string('questionsinthisquiz', 'quiz'), '', 2);
 
-    $sumgrades = quiz_print_question_list($quiz, $thispageurl, true, $SESSION->quiz_showbreaks, $SESSION->quiz_reordertool);
+    $sumgrades = quiz_print_question_list($quiz, $thispageurl, true, $quiz_showbreaks, $quiz_reordertool);
     if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $quiz->instance)) {
         error('Failed to set sumgrades');
     }
index c23156bd5c464e21235070540cb593c8870fe2c2..a46b8021d7ea902adecc78e9ae647c6436ba762f 100644 (file)
@@ -320,7 +320,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, $showbreak
 /// Form to choose to show pagebreaks and to repaginate quiz
     echo '<form method="post" action="edit.php" id="showbreaks">';
     echo '<fieldset class="invisiblefieldset">';
-    echo $pageurl->hidden_params_out();
+    echo $pageurl->hidden_params_out(array('showbreaks', 'reordertool'));
     echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
     echo '<input type="hidden" name="showbreaks" value="0" />';
     echo '<input type="checkbox" name="showbreaks" value="1"';