ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestDynamicQuestionSet Class Reference
+ Collaboration diagram for ilTestDynamicQuestionSet:

Public Member Functions

 __construct (ilDBInterface $db, ilLanguage $lng, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
 Constructor. More...
 
 load (ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
 
 initSelectionQuestionList (ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
 
 getActualQuestionSequence ()
 
 questionExists ($questionId)
 
 getQuestionData ($questionId)
 
 getAllQuestionsData ()
 
 getCompleteQuestionList ()
 
 getSelectionQuestionList ()
 
 getFilteredQuestionList ()
 

Private Member Functions

 initCompleteQuestionList (ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, $answerStatusActiveId)
 
 initFilteredQuestionList (ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
 
 initActualQuestionSequence (ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilAssQuestionList $questionList)
 
 getQuestionSequenceStructuredByTaxonomy (ilAssQuestionList $questionList, $orderingTaxId)
 
 getQuestionSequenceStructuredByUpdateDate (ilAssQuestionList $questionList)
 
 buildQuestionList ($sourceQuestionPoolId, $answerStatusActiveId)
 

Private Attributes

 $db = null
 
 $lng = null
 
 $pluginAdmin = null
 
 $testOBJ = null
 
 $completeQuestionList = null
 
 $selectionQuestionList = null
 
 $filteredQuestionList = null
 
 $actualQuestionSequence = array()
 

Detailed Description

Definition at line 15 of file class.ilTestDynamicQuestionSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestDynamicQuestionSet::__construct ( ilDBInterface  $db,
ilLanguage  $lng,
ilPluginAdmin  $pluginAdmin,
ilObjTest  $testOBJ 
)

Constructor.

Parameters
ilObjTest$testOBJ

Definition at line 62 of file class.ilTestDynamicQuestionSet.php.

References $db, $lng, $pluginAdmin, and $testOBJ.

Member Function Documentation

◆ buildQuestionList()

ilTestDynamicQuestionSet::buildQuestionList (   $sourceQuestionPoolId,
  $answerStatusActiveId 
)
private
Parameters
integer$sourceQuestionPoolId
string$answerStatusActiveId
Returns
ilAssQuestionList

Definition at line 324 of file class.ilTestDynamicQuestionSet.php.

Referenced by initCompleteQuestionList(), initFilteredQuestionList(), and initSelectionQuestionList().

325  {
326  $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
327  $questionList->setParentObjId($sourceQuestionPoolId);
328  $questionList->setAnswerStatusActiveId($answerStatusActiveId);
329  return $questionList;
330  }
+ Here is the caller graph for this function:

◆ getActualQuestionSequence()

ilTestDynamicQuestionSet::getActualQuestionSequence ( )

◆ getAllQuestionsData()

ilTestDynamicQuestionSet::getAllQuestionsData ( )

Definition at line 288 of file class.ilTestDynamicQuestionSet.php.

289  {
290  return $this->completeQuestionList->getQuestionDataArray();
291  }

◆ getCompleteQuestionList()

ilTestDynamicQuestionSet::getCompleteQuestionList ( )

◆ getFilteredQuestionList()

ilTestDynamicQuestionSet::getFilteredQuestionList ( )

◆ getQuestionData()

ilTestDynamicQuestionSet::getQuestionData (   $questionId)

Definition at line 282 of file class.ilTestDynamicQuestionSet.php.

283  {
284  $questionData = $this->completeQuestionList->getQuestionDataArray();
285  return $questionData[$questionId];
286  }

◆ getQuestionSequenceStructuredByTaxonomy()

ilTestDynamicQuestionSet::getQuestionSequenceStructuredByTaxonomy ( ilAssQuestionList  $questionList,
  $orderingTaxId 
)
private

Definition at line 190 of file class.ilTestDynamicQuestionSet.php.

References $path, array, ilAssQuestionList\getQuestionDataArray(), and ilObjTaxonomy\SORT_MANUAL.

Referenced by initActualQuestionSequence().

191  {
192  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
193  $tax = new ilObjTaxonomy($orderingTaxId);
194 
195  require_once 'Modules/Test/classes/class.ilTestTaxonomyTree.php';
196  $tree = new ilTestTaxonomyTree($orderingTaxId);
197  $tree->initOrderedTreeIndex($tax);
198 
199  $questionsByNode = array();
200  $nodelessQuestions = array();
201 
202  foreach($questionList->getQuestionDataArray() as $qId => $qData)
203  {
204  if( isset($qData['taxonomies'][$orderingTaxId]) && count($qData['taxonomies'][$orderingTaxId]) )
205  {
206  foreach($qData['taxonomies'][$orderingTaxId] as $nodeId => $itemData)
207  {
208  $nodeOrderingPath = $tree->getNodeOrderingPathString($itemData['node_id']);
209 
210  if( !isset($questionsByNode[ $nodeOrderingPath ]) )
211  {
212  $questionsByNode[ $nodeOrderingPath ] = array();
213  }
214 
215  if($tax->getItemSorting() == ilObjTaxonomy::SORT_MANUAL)
216  {
217  $questionsByNode[ $nodeOrderingPath ][$itemData['order_nr']] = $qId;
218  }
219  else
220  {
221  $questionsByNode[ $nodeOrderingPath ][$qData['title'].'::'.$qId] = $qId;
222  }
223  }
224  }
225  else
226  {
227  $nodelessQuestions[$qData['tstamp'].'::'.$qId] = $qId;
228  }
229  }
230 
231  foreach($questionsByNode as $path => $questions)
232  {
233  if($tax->getItemSorting() == ilObjTaxonomy::SORT_MANUAL)
234  {
235  ksort($questions, SORT_NUMERIC);
236  }
237  else
238  {
239  ksort($questions, SORT_STRING);
240  }
241 
242  $questionsByNode[$path] = array_values($questions);
243  }
244 
245  ksort($questionsByNode, SORT_STRING);
246  $sequence = array_values($questionsByNode);
247 
248  ksort($nodelessQuestions);
249  $sequence[] = array_values($nodelessQuestions);
250 
251  return $sequence;
252  }
$path
Definition: aliased.php:25
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionSequenceStructuredByUpdateDate()

ilTestDynamicQuestionSet::getQuestionSequenceStructuredByUpdateDate ( ilAssQuestionList  $questionList)
private

Definition at line 254 of file class.ilTestDynamicQuestionSet.php.

References array, and ilAssQuestionList\getQuestionDataArray().

Referenced by initActualQuestionSequence().

255  {
256  $sequence = array();
257 
258  foreach($questionList->getQuestionDataArray() as $qId => $qData)
259  {
260  $sequence[ $qData['tstamp'].'::'.$qId ] = $qId;
261  }
262 
263  ksort($sequence);
264  $sequence = array_values($sequence);
265 
266  return array($sequence);
267  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectionQuestionList()

ilTestDynamicQuestionSet::getSelectionQuestionList ( )

◆ initActualQuestionSequence()

ilTestDynamicQuestionSet::initActualQuestionSequence ( ilObjTestDynamicQuestionSetConfig  $dynamicQuestionSetConfig,
ilAssQuestionList  $questionList 
)
private

Definition at line 176 of file class.ilTestDynamicQuestionSet.php.

References ilObjTestDynamicQuestionSetConfig\getOrderingTaxonomyId(), getQuestionSequenceStructuredByTaxonomy(), and getQuestionSequenceStructuredByUpdateDate().

Referenced by load().

177  {
178  if( $dynamicQuestionSetConfig->getOrderingTaxonomyId() )
179  {
181  $questionList, $dynamicQuestionSetConfig->getOrderingTaxonomyId()
182  );
183  }
184 
185  return $this->getQuestionSequenceStructuredByUpdateDate($questionList);
186  }
getQuestionSequenceStructuredByUpdateDate(ilAssQuestionList $questionList)
getQuestionSequenceStructuredByTaxonomy(ilAssQuestionList $questionList, $orderingTaxId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCompleteQuestionList()

ilTestDynamicQuestionSet::initCompleteQuestionList ( ilObjTestDynamicQuestionSetConfig  $dynamicQuestionSetConfig,
  $answerStatusActiveId 
)
private

Definition at line 93 of file class.ilTestDynamicQuestionSet.php.

References buildQuestionList(), and ilObjTestDynamicQuestionSetConfig\getSourceQuestionPoolId().

Referenced by load().

94  {
95  $questionList = $this->buildQuestionList(
96  $dynamicQuestionSetConfig->getSourceQuestionPoolId(), $answerStatusActiveId
97  );
98 
99  $questionList->load();
100 
101  return $questionList;
102  }
buildQuestionList($sourceQuestionPoolId, $answerStatusActiveId)
getSourceQuestionPoolId()
getter for source question pool id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilteredQuestionList()

ilTestDynamicQuestionSet::initFilteredQuestionList ( ilObjTestDynamicQuestionSetConfig  $dynamicQuestionSetConfig,
ilTestDynamicQuestionSetFilterSelection  $filterSelection 
)
private

Definition at line 104 of file class.ilTestDynamicQuestionSet.php.

References array, buildQuestionList(), ilTestDynamicQuestionSetFilterSelection\getAnswerStatusActiveId(), ilTestDynamicQuestionSetFilterSelection\getAnswerStatusSelection(), ilTestDynamicQuestionSetFilterSelection\getForcedQuestionIds(), ilObjTestDynamicQuestionSetConfig\getOrderingTaxonomyId(), ilObjTestDynamicQuestionSetConfig\getSourceQuestionPoolId(), ilTestDynamicQuestionSetFilterSelection\getTaxonomySelection(), ilObjTaxonomy\getUsageOfObject(), ilObjTestDynamicQuestionSetConfig\isAnswerStatusFilterEnabled(), and ilObjTestDynamicQuestionSetConfig\isTaxonomyFilterEnabled().

Referenced by load().

105  {
106  $questionList = $this->buildQuestionList(
107  $dynamicQuestionSetConfig->getSourceQuestionPoolId(), $filterSelection->getAnswerStatusActiveId()
108  );
109 
110  if( $dynamicQuestionSetConfig->isAnswerStatusFilterEnabled() )
111  {
112  $questionList->setAnswerStatusFilter($filterSelection->getAnswerStatusSelection());
113  }
114 
115  if( $dynamicQuestionSetConfig->isTaxonomyFilterEnabled() )
116  {
117  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
118 
119  $questionList->setAvailableTaxonomyIds( ilObjTaxonomy::getUsageOfObject(
120  $dynamicQuestionSetConfig->getSourceQuestionPoolId()
121  ));
122 
123  foreach($filterSelection->getTaxonomySelection() as $taxId => $taxNodes)
124  {
125  $questionList->addTaxonomyFilter(
126  $taxId, $taxNodes, $this->testOBJ->getId(), $this->testOBJ->getType()
127  );
128  }
129  }
130  elseif( $dynamicQuestionSetConfig->getOrderingTaxonomyId() )
131  {
132  $questionList->setAvailableTaxonomyIds( array(
133  $dynamicQuestionSetConfig->getOrderingTaxonomyId()
134  ));
135  }
136 
137  $questionList->setForcedQuestionIds($filterSelection->getForcedQuestionIds());
138 
139  $questionList->load();
140 
141  return $questionList;
142  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
isTaxonomyFilterEnabled()
isser for taxonomie filter enabled
Create styles array
The data for the language used.
buildQuestionList($sourceQuestionPoolId, $answerStatusActiveId)
getSourceQuestionPoolId()
getter for source question pool id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSelectionQuestionList()

ilTestDynamicQuestionSet::initSelectionQuestionList ( ilObjTestDynamicQuestionSetConfig  $dynamicQuestionSetConfig,
ilTestDynamicQuestionSetFilterSelection  $filterSelection 
)
Parameters
ilObjTestDynamicQuestionSetConfig$dynamicQuestionSetConfig
ilTestDynamicQuestionSetFilterSelection$filterSelection
Returns
ilAssQuestionList

Definition at line 149 of file class.ilTestDynamicQuestionSet.php.

References buildQuestionList(), ilTestDynamicQuestionSetFilterSelection\getAnswerStatusActiveId(), ilObjTestDynamicQuestionSetConfig\getSourceQuestionPoolId(), ilTestDynamicQuestionSetFilterSelection\getTaxonomySelection(), ilObjTaxonomy\getUsageOfObject(), and ilObjTestDynamicQuestionSetConfig\isTaxonomyFilterEnabled().

Referenced by load().

150  {
151  $questionList = $this->buildQuestionList(
152  $dynamicQuestionSetConfig->getSourceQuestionPoolId(), $filterSelection->getAnswerStatusActiveId()
153  );
154 
155  if( $dynamicQuestionSetConfig->isTaxonomyFilterEnabled() )
156  {
157  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
158 
159  $questionList->setAvailableTaxonomyIds( ilObjTaxonomy::getUsageOfObject(
160  $dynamicQuestionSetConfig->getSourceQuestionPoolId()
161  ));
162 
163  foreach($filterSelection->getTaxonomySelection() as $taxId => $taxNodes)
164  {
165  $questionList->addTaxonomyFilter(
166  $taxId, $taxNodes, $this->testOBJ->getId(), $this->testOBJ->getType()
167  );
168  }
169  }
170 
171  $questionList->load();
172 
173  return $questionList;
174  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
isTaxonomyFilterEnabled()
isser for taxonomie filter enabled
buildQuestionList($sourceQuestionPoolId, $answerStatusActiveId)
getSourceQuestionPoolId()
getter for source question pool id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

ilTestDynamicQuestionSet::load ( ilObjTestDynamicQuestionSetConfig  $dynamicQuestionSetConfig,
ilTestDynamicQuestionSetFilterSelection  $filterSelection 
)

Definition at line 72 of file class.ilTestDynamicQuestionSet.php.

References ilTestDynamicQuestionSetFilterSelection\getAnswerStatusActiveId(), initActualQuestionSequence(), initCompleteQuestionList(), initFilteredQuestionList(), and initSelectionQuestionList().

73  {
74  $this->completeQuestionList = $this->initCompleteQuestionList(
75  $dynamicQuestionSetConfig, $filterSelection->getAnswerStatusActiveId()
76  );
77 
78  $this->selectionQuestionList = $this->initSelectionQuestionList(
79  $dynamicQuestionSetConfig, $filterSelection
80  );
81 
82  $this->filteredQuestionList = $this->initFilteredQuestionList(
83  $dynamicQuestionSetConfig, $filterSelection
84  );
85 
86  $this->actualQuestionSequence = $this->initActualQuestionSequence(
87  $dynamicQuestionSetConfig, $this->filteredQuestionList
88  );
89  }
initFilteredQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
initActualQuestionSequence(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilAssQuestionList $questionList)
initSelectionQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection)
initCompleteQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, $answerStatusActiveId)
+ Here is the call graph for this function:

◆ questionExists()

ilTestDynamicQuestionSet::questionExists (   $questionId)

Definition at line 276 of file class.ilTestDynamicQuestionSet.php.

277  {
278  $questionData = $this->completeQuestionList->getQuestionDataArray();
279  return isset($questionData[$questionId]);
280  }

Field Documentation

◆ $actualQuestionSequence

ilTestDynamicQuestionSet::$actualQuestionSequence = array()
private

Definition at line 55 of file class.ilTestDynamicQuestionSet.php.

Referenced by getActualQuestionSequence().

◆ $completeQuestionList

ilTestDynamicQuestionSet::$completeQuestionList = null
private

Definition at line 40 of file class.ilTestDynamicQuestionSet.php.

Referenced by getCompleteQuestionList().

◆ $db

ilTestDynamicQuestionSet::$db = null
private

Definition at line 20 of file class.ilTestDynamicQuestionSet.php.

Referenced by __construct().

◆ $filteredQuestionList

ilTestDynamicQuestionSet::$filteredQuestionList = null
private

Definition at line 50 of file class.ilTestDynamicQuestionSet.php.

Referenced by getFilteredQuestionList().

◆ $lng

ilTestDynamicQuestionSet::$lng = null
private

Definition at line 25 of file class.ilTestDynamicQuestionSet.php.

Referenced by __construct().

◆ $pluginAdmin

ilTestDynamicQuestionSet::$pluginAdmin = null
private

Definition at line 30 of file class.ilTestDynamicQuestionSet.php.

Referenced by __construct().

◆ $selectionQuestionList

ilTestDynamicQuestionSet::$selectionQuestionList = null
private

Definition at line 45 of file class.ilTestDynamicQuestionSet.php.

Referenced by getSelectionQuestionList().

◆ $testOBJ

ilTestDynamicQuestionSet::$testOBJ = null
private

Definition at line 35 of file class.ilTestDynamicQuestionSet.php.

Referenced by __construct().


The documentation for this class was generated from the following file: