ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
86 switch( $this->testOBJ->getQuestionSetType() )
87 {
89
90 require_once 'Modules/Test/classes/class.ilTestSequenceFixedQuestionSet.php';
91 $this->testSequences[$activeId][$pass] = new ilTestSequenceFixedQuestionSet(
92 $activeId, $pass, $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, $pass, $this->testOBJ->isRandomTest()
101 );
102 break;
103
105
106 require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php';
107 require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php';
108 $questionSet = new ilTestDynamicQuestionSet(
109 $this->db, $this->lng, $this->pluginAdmin, $this->testOBJ
110 );
111 $this->testSequences[$activeId][$pass] = new ilTestSequenceDynamicQuestionSet(
112 $this->db, $questionSet, $activeId
113 );
114
115 #$this->testSequence->setPreventCheckedQuestionsFromComingUpEnabled(
116 # $this->testOBJ->isInstantFeedbackAnswerFixationEnabled()
117 #); // checked questions now has to come up any time, so they can be set to unchecked right at this moment
118
119 break;
120 }
121 }
122
123 return $this->testSequences[$activeId][$pass];
124 }
125}
Database Wrapper.
Definition: class.ilDB.php:29
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...
__construct(ilDB $db, ilLanguage $lng, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
constructor
getSequenceByTestSession($testSession)
creates and returns an instance of a test sequence that corresponds to the current test mode and the ...