ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestQuestionSetConfigFactory.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 $testQuestionSetConfig = null;
20 
26  private $tree = null;
27 
33  private $db = null;
34 
40  private $pluginAdmin = null;
41 
47  private $testOBJ = null;
48 
55  {
56  $this->tree = $tree;
57  $this->db = $db;
58  $this->pluginAdmin = $pluginAdmin;
59  $this->testOBJ = $testOBJ;
60  }
61 
68  public function getQuestionSetConfig()
69  {
70  return $this->getQuestionSetConfigByType($this->testOBJ->getQuestionSetType());
71  }
72 
79  public function getQuestionSetConfigByType($questionSetType)
80  {
81  if ($this->testQuestionSetConfig === null) {
82  switch ($questionSetType) {
84 
85  require_once 'Modules/Test/classes/class.ilTestFixedQuestionSetConfig.php';
86  $this->testQuestionSetConfig = new ilTestFixedQuestionSetConfig(
87  $this->tree,
88  $this->db,
89  $this->pluginAdmin,
90  $this->testOBJ
91  );
92  break;
93 
95 
96  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
97  $this->testQuestionSetConfig = new ilTestRandomQuestionSetConfig(
98  $this->tree,
99  $this->db,
100  $this->pluginAdmin,
101  $this->testOBJ
102  );
103  break;
104 
106 
107  require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
108  $this->testQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig(
109  $this->tree,
110  $this->db,
111  $this->pluginAdmin,
112  $this->testOBJ
113  );
114  break;
115  }
116 
117  $this->testQuestionSetConfig->loadFromDb();
118  }
119 
121  }
122 }
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
__construct(ilTree $tree, ilDBInterface $db, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
constructor
Administration class for plugins.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getQuestionSetConfig()
creates and returns an instance of a test question set config that corresponds to the test&#39;s current ...
getQuestionSetConfigByType($questionSetType)
creates and returns an instance of a test question set config that corresponds to the passed question...
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)