]> git.mjollnir.org Git - moodle.git/commitdiff
made multiple.php save to database in addition to $SESSION->modform and also introduc...
authorgustav_delius <gustav_delius>
Sat, 22 Jan 2005 19:14:35 +0000 (19:14 +0000)
committergustav_delius <gustav_delius>
Sat, 22 Jan 2005 19:14:35 +0000 (19:14 +0000)
mod/quiz/locallib.php
mod/quiz/multiple.php

index d3c458be2db3403902342bcebc6b34973220fa59..4dae361e3efd10fe1203b68d780e6097e0bf748a 100644 (file)
@@ -1350,6 +1350,7 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
             $randomcount[$i] = $i;
         }
         echo '<form method="post" action="multiple.php">';
+        echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
         print_string('addrandom1', 'quiz');
         choose_from_menu($randomcount, 'randomcreate', '10', '');
         print_string('addrandom2', 'quiz');
index 13e4cfa7da895d53caed4e2b7cdb6375df2e1f92..b9ceb1b164f2ea72f82f583337418a048f674667 100644 (file)
@@ -4,7 +4,7 @@
     require_once('../../config.php');
     require_once('locallib.php');
 
-    require_variable($category);
+    $category = required_param('category');
 
     // This script can only be called while editing a quiz
 
     }
 
 
-
 /// If data submitted, then process and store.
 
-    if ($form = data_submitted()) {
+    if ($form = data_submitted() and confirm_sesskey()) {
         if ($form->randomcreate > 0) {
             $newquestionids = array(); // this will hold the ids of the random questions
             
             $newquestionids = array_merge($questionids, $newquestionids);
             $modform->questions = implode(',', $newquestionids);
             $SESSION->modform = $modform;
+            if (!set_field('quiz', 'questions', $modform->questions, 'id', $modform->instance)) {
+                error('Could not save question list');
+            }
+            quiz_questiongrades_update($modform->grades, $modform->instance);
         }
         redirect('edit.php');
     }
 
     print_simple_box_start('center', '', $THEME->cellheading);
     echo '<form method="POST" action="multiple.php">';
+    echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
     echo '<table cellpadding="5">';
     echo '<tr><td align="right">';
     print_string('category', 'quiz');