ILIAS  release_8 Revision v8.24
class.ilTestSequenceRandomQuestionSet.php
Go to the documentation of this file.
1<?php
2
26{
28
29 public function loadQuestions(ilTestQuestionSetConfig $testQuestionSetConfig = null, $taxonomyFilterSelection = array())
30 {
31 global $DIC;
32 $ilDB = $DIC['ilDB'];
33
34 $this->questions = array();
35
36 $result = $ilDB->queryF(
37 "SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = %s ORDER BY sequence",
38 array('integer','integer'),
39 array($this->active_id, $this->pass)
40 );
41 // The following is a fix for random tests prior to ILIAS 3.8. If someone started a random test in ILIAS < 3.8, there
42 // is only one test pass (pass = 0) in tst_test_rnd_qst while with ILIAS 3.8 there are questions for every test pass.
43 // To prevent problems with tests started in an older version and continued in ILIAS 3.8, the first pass should be taken if
44 // no questions are present for a newer pass.
45 if ($result->numRows() == 0) {
46 $result = $ilDB->queryF(
47 "SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = 0 ORDER BY sequence",
48 array('integer'),
49 array($this->active_id)
50 );
51 }
52
53 $index = 1;
54
55 while ($data = $ilDB->fetchAssoc($result)) {
56 $this->questions[$index++] = $data["question_fi"];
57
58 $this->responsibleSourcePoolDefinitionByQuestion[$data['question_fi']] = $data['src_pool_def_fi'];
59 }
60 }
61
73 {
74 global $DIC;
75 $ilDB = $DIC['ilDB'];
76 $result = $ilDB->queryF(
77 "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
78 array('integer','integer'),
79 array($active_id, $pass)
80 );
81 return ($result->numRows() > 0) ? true : false;
82 }
83
84 public function getResponsibleSourcePoolDefinitionId($questionId)
85 {
86 if (isset($this->responsibleSourcePoolDefinitionByQuestion[$questionId])) {
87 return $this->responsibleSourcePoolDefinitionByQuestion[$questionId];
88 }
89
90 return null;
91 }
92}
return true
hasRandomQuestionsForPass($active_id, $pass)
!!! LEGACY CODE !!!
loadQuestions(ilTestQuestionSetConfig $testQuestionSetConfig=null, $taxonomyFilterSelection=array())
Loads the question mapping.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$index
Definition: metadata.php:145