Beispiel #1
0
 public function get_variants_selection_seed()
 {
     if (!empty($this->synchronised) && $this->datasetloader->datasets_are_synchronised($this->category)) {
         return 'category' . $this->category;
     } else {
         return parent::get_variants_selection_seed();
     }
 }
 public function format_text($text, $format, $qa, $component, $filearea, $itemid, $clean = false)
 {
     $text = qtype_omerocommon_question::localize_text($text, $format, $qa, $component, $filearea, $itemid, $clean);
     return parent::format_text($text, $format, $qa, $component, $filearea, $itemid, $clean);
 }
 /**
  *
  *
  * @param array                              $answers The overall answers array that handles the count of answers
  * @param \question_attempt                  $qa
  * @param \qtype_multichoice_single_question $questiondef
  *
  */
 protected function update_answers_single(&$answers, $qa, $questiondef)
 {
     // get the latest step that has an answer
     $lastanswerstep = $qa->get_last_step_with_qt_var('answer');
     if ($lastanswerstep->has_qt_var('answer')) {
         // may not as if the step doesn't exist get last step will return empty read only step
         // get the student answer from the last answer step
         // along with the answers within the
         $answerorder = $questiondef->get_order($qa);
         $response = $lastanswerstep->get_qt_data();
         // make sure the response answer actually exists in the order
         if (array_key_exists($response['answer'], $answerorder)) {
             $studentanswer = $questiondef->answers[$answerorder[$response['answer']]];
             // update the count of the answerid on the answers array
             if (isset($answers[$studentanswer->id])) {
                 $current = (int) $answers[$studentanswer->id];
                 $answers[$studentanswer->id] = $current + 1;
             } else {
                 $answers[$studentanswer->id] = 1;
             }
         }
     }
 }