ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTestSequenceFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
13{
19 private $testSequences = array();
20
26 private $db = null;
27
33 private $lng = null;
34
40 private $pluginAdmin = null;
41
47 private $testOBJ = null;
48
55 {
56 $this->db = $db;
57 $this->lng = $lng;
58 $this->pluginAdmin = $pluginAdmin;
59 $this->testOBJ = $testOBJ;
60 }
61
69 public function getSequenceByTestSession($testSession)
70 {
71 return $this->getSequenceByActiveIdAndPass($testSession->getActiveId(), $testSession->getPass());
72 }
73
82 public function getSequenceByActiveIdAndPass($activeId, $pass)
83 {
84 if ($this->testSequences[$activeId][$pass] === null) {
85 switch ($this->testOBJ->getQuestionSetType()) {
87
88 require_once 'Modules/Test/classes/class.ilTestSequenceFixedQuestionSet.php';
89 $this->testSequences[$activeId][$pass] = new ilTestSequenceFixedQuestionSet(
90 $activeId,
91 $pass,
92 $this->testOBJ->isRandomTest()
93 );
94 break;
95
97
98 require_once 'Modules/Test/classes/class.ilTestSequenceRandomQuestionSet.php';
99 $this->testSequences[$activeId][$pass] = new ilTestSequenceRandomQuestionSet(
100 $activeId,
101 $pass,
102 $this->testOBJ->isRandomTest()
103 );
104 break;
105
107
108 require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php';
109 require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php';
110 $questionSet = new ilTestDynamicQuestionSet(
111 $this->db,
112 $this->lng,
113 $this->pluginAdmin,
114 $this->testOBJ
115 );
116 $this->testSequences[$activeId][$pass] = new ilTestSequenceDynamicQuestionSet(
117 $this->db,
118 $questionSet,
119 $activeId
120 );
121
122 #$this->testSequence->setPreventCheckedQuestionsFromComingUpEnabled(
123 # $this->testOBJ->isInstantFeedbackAnswerFixationEnabled()
124 #); // checked questions now has to come up any time, so they can be set to unchecked right at this moment
125
126 break;
127 }
128 }
129
130 return $this->testSequences[$activeId][$pass];
131 }
132}
An exception for terminatinating execution or to throw for unit testing.
language handling
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
Administration class for plugins.
getSequenceByActiveIdAndPass($activeId, $pass)
creates and returns an instance of a test sequence that corresponds to the current test mode and give...
getSequenceByTestSession($testSession)
creates and returns an instance of a test sequence that corresponds to the current test mode and the ...
__construct(ilDBInterface $db, ilLanguage $lng, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
constructor
Interface ilDBInterface.