fixed missing userid
authorPetr Skoda <skodak@moodle.org>
Sat, 18 Sep 2010 11:40:52 +0000 (11:40 +0000)
committerPetr Skoda <skodak@moodle.org>
Sat, 18 Sep 2010 11:40:52 +0000 (11:40 +0000)
question/type/randomsamatch/questiontype.php

index a774f9b..b26027b 100644 (file)
@@ -80,7 +80,7 @@ class question_randomsamatch_qtype extends question_match_qtype {
         // 1. All questions that are explicitly assigned to the quiz
         // 2. All random questions
         // 3. All questions that are already chosen by an other random question
-        global $QTYPES, $OUTPUT;
+        global $QTYPES, $OUTPUT, $USER;
         if (!isset($cmoptions->questionsinuse)) {
             $cmoptions->questionsinuse = $cmoptions->questions;
         }
@@ -97,7 +97,7 @@ class question_randomsamatch_qtype extends question_match_qtype {
         $count  = count($saquestions);
         $wanted = $question->options->choose;
         $errorstr = '';
-        if ($count < $wanted && has_coursecontact_role()) { //TODO: this teacher test is far from optimal
+        if ($count < $wanted && has_coursecontact_role($USER->id)) { //TODO: this teacher test is far from optimal
             if ($count >= 2) {
                 $errorstr =  "Error: could not get enough Short-Answer questions!
                  Got $count Short-Answer questions, but wanted $wanted.