ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestRandomQuestionSetSourcePoolDefinition Class Reference
+ Collaboration diagram for ilTestRandomQuestionSetSourcePoolDefinition:

Public Member Functions

 __construct (ilDBInterface $db, ilObjTest $testOBJ)
 
 setId ($id)
 
 getId ()
 
 setPoolId ($poolId)
 
 getPoolId ()
 
 setPoolTitle ($poolTitle)
 
 getPoolTitle ()
 
 setPoolPath ($poolPath)
 
 getPoolPath ()
 
 setPoolQuestionCount ($poolQuestionCount)
 
 getPoolQuestionCount ()
 
 getOriginalTaxonomyFilter ()
 get the original taxonomy filter conditions More...
 
 setOriginalTaxonomyFilter ($filter=array())
 set the original taxonomy filter condition More...
 
 getMappedTaxonomyFilter ()
 get the mapped taxonomy filter conditions More...
 
 setMappedTaxonomyFilter ($filter=array())
 set the original taxonomy filter condition More...
 
 mapTaxonomyFilter (ilQuestionPoolDuplicatedTaxonomiesKeysMap $taxonomiesKeysMap)
 set the mapped taxonomy filter from original by applying a keys map More...
 
 setTypeFilter ($typeFilter=array())
 
 getTypeFilter ()
 
 setQuestionAmount ($questionAmount)
 
 getQuestionAmount ()
 
 setSequencePosition ($sequencePosition)
 
 getSequencePosition ()
 
 initFromArray ($dataArray)
 
 loadFromDb ($id)
 
 saveToDb ()
 
 cloneToDbForTestId ($testId)
 
 deleteFromDb ()
 
 getPoolInfoLabel (ilLanguage $lng)
 

Protected Attributes

 $db = null
 
 $testOBJ = null
 

Private Member Functions

 getOriginalTaxonomyFilterForDbValue ()
 get the original taxonomy filter for insert into the database More...
 
 setOriginalTaxonomyFilterFromDbValue ($value)
 get the original taxonomy filter from database value More...
 
 getMappedTaxonomyFilterForDbValue ()
 get the original taxonomy filter for insert into the database More...
 
 setMappedTaxonomyFilterFromDbValue ($value)
 get the original taxonomy filter from database value More...
 
 getTypeFilterForDbValue ()
 get the question type filter for insert into the database More...
 
 setTypeFilterFromDbValue ($value)
 get the question type filter from database value More...
 
 updateDbRecord ($testId)
 
 insertDbRecord ($testId)
 

Private Attributes

 $id = null
 
 $poolId = null
 
 $poolTitle = null
 
 $poolPath = null
 
 $poolQuestionCount = null
 
 $originalTaxonomyFilter = array()
 
 $mappedTaxonomyFilter = array()
 
 $typeFilter = array()
 
 $questionAmount = null
 
 $sequencePosition = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionSetSourcePoolDefinition::__construct ( ilDBInterface  $db,
ilObjTest  $testOBJ 
)

Member Function Documentation

◆ cloneToDbForTestId()

ilTestRandomQuestionSetSourcePoolDefinition::cloneToDbForTestId (   $testId)

Definition at line 363 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References insertDbRecord().

+ Here is the call graph for this function:

◆ deleteFromDb()

ilTestRandomQuestionSetSourcePoolDefinition::deleteFromDb ( )

Definition at line 368 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array, and getId().

369  {
370  $this->db->manipulateF(
371  "DELETE FROM tst_rnd_quest_set_qpls WHERE def_id = %s",
372  array('integer'),
373  array($this->getId())
374  );
375  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getId()

◆ getMappedTaxonomyFilter()

ilTestRandomQuestionSetSourcePoolDefinition::getMappedTaxonomyFilter ( )

◆ getMappedTaxonomyFilterForDbValue()

ilTestRandomQuestionSetSourcePoolDefinition::getMappedTaxonomyFilterForDbValue ( )
private

get the original taxonomy filter for insert into the database

Returns
null|string serialized taxonomy filter

Definition at line 183 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by insertDbRecord(), and updateDbRecord().

184  {
185  return empty($this->mappedTaxonomyFilter) ? null : serialize($this->mappedTaxonomyFilter);
186  }
+ Here is the caller graph for this function:

◆ getOriginalTaxonomyFilter()

ilTestRandomQuestionSetSourcePoolDefinition::getOriginalTaxonomyFilter ( )

get the original taxonomy filter conditions

Returns
array taxId => [nodeId, ...]

Definition at line 127 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $originalTaxonomyFilter.

Referenced by ilTestRandomQuestionSetPoolDefinitionFormGUI\build().

+ Here is the caller graph for this function:

◆ getOriginalTaxonomyFilterForDbValue()

ilTestRandomQuestionSetSourcePoolDefinition::getOriginalTaxonomyFilterForDbValue ( )
private

get the original taxonomy filter for insert into the database

Returns
null|string serialized taxonomy filter

Definition at line 145 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by insertDbRecord(), and updateDbRecord().

146  {
147  // TODO-RND2017: migrate to separate table for common selections by e.g. statistics
148  return empty($this->originalTaxonomyFilter) ? null : serialize($this->originalTaxonomyFilter);
149  }
+ Here is the caller graph for this function:

◆ getPoolId()

◆ getPoolInfoLabel()

ilTestRandomQuestionSetSourcePoolDefinition::getPoolInfoLabel ( ilLanguage  $lng)

Definition at line 440 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References getPoolPath(), getPoolQuestionCount(), getPoolTitle(), and ilLanguage\txt().

Referenced by ilTestRandomQuestionSetPoolDefinitionFormGUI\build().

441  {
442  $poolInfoLabel = sprintf(
443  $lng->txt('tst_dynamic_question_set_source_questionpool_summary_string'),
444  $this->getPoolTitle(),
445  $this->getPoolPath(),
446  $this->getPoolQuestionCount()
447  );
448 
449  return $poolInfoLabel;
450  }
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPoolPath()

ilTestRandomQuestionSetSourcePoolDefinition::getPoolPath ( )

Definition at line 107 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $poolPath.

Referenced by getPoolInfoLabel(), insertDbRecord(), and updateDbRecord().

+ Here is the caller graph for this function:

◆ getPoolQuestionCount()

ilTestRandomQuestionSetSourcePoolDefinition::getPoolQuestionCount ( )

◆ getPoolTitle()

ilTestRandomQuestionSetSourcePoolDefinition::getPoolTitle ( )

◆ getQuestionAmount()

◆ getSequencePosition()

ilTestRandomQuestionSetSourcePoolDefinition::getSequencePosition ( )

Definition at line 299 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $sequencePosition.

Referenced by insertDbRecord(), and updateDbRecord().

+ Here is the caller graph for this function:

◆ getTypeFilter()

◆ getTypeFilterForDbValue()

ilTestRandomQuestionSetSourcePoolDefinition::getTypeFilterForDbValue ( )
private

get the question type filter for insert into the database

Returns
null|string serialized type filter

Definition at line 228 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by insertDbRecord(), and updateDbRecord().

229  {
230  return empty($this->typeFilter) ? null : serialize($this->typeFilter);
231  }
+ Here is the caller graph for this function:

◆ initFromArray()

ilTestRandomQuestionSetSourcePoolDefinition::initFromArray (   $dataArray)
Parameters
array$dataArray

Definition at line 309 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $dataArray, setId(), setMappedTaxonomyFilterFromDbValue(), setOriginalTaxonomyFilterFromDbValue(), setPoolId(), setPoolPath(), setPoolQuestionCount(), setPoolTitle(), setQuestionAmount(), setSequencePosition(), and setTypeFilterFromDbValue().

Referenced by loadFromDb().

310  {
311  foreach ($dataArray as $field => $value) {
312  switch ($field) {
313  case 'def_id': $this->setId($value); break;
314  case 'pool_fi': $this->setPoolId($value); break;
315  case 'pool_title': $this->setPoolTitle($value); break;
316  case 'pool_path': $this->setPoolPath($value); break;
317  case 'pool_quest_count': $this->setPoolQuestionCount($value); break;
318  // fau: taxFilter - use new db fields
319  #case 'origin_tax_fi': $this->setOriginalFilterTaxId($value); break;
320  #case 'origin_node_fi': $this->setOriginalFilterTaxNodeId($value); break;
321  #case 'mapped_tax_fi': $this->setMappedFilterTaxId($value); break;
322  #case 'mapped_node_fi': $this->setMappedFilterTaxNodeId($value); break;
323  case 'origin_tax_filter': $this->setOriginalTaxonomyFilterFromDbValue($value); break;
324  case 'mapped_tax_filter': $this->setMappedTaxonomyFilterFromDbValue($value); break;
325  case 'type_filter': $this->setTypeFilterFromDbValue($value); break;
326  // fau.
327  case 'quest_amount': $this->setQuestionAmount($value); break;
328  case 'sequence_pos': $this->setSequencePosition($value); break;
329  }
330  }
331  }
setOriginalTaxonomyFilterFromDbValue($value)
get the original taxonomy filter from database value
setMappedTaxonomyFilterFromDbValue($value)
get the original taxonomy filter from database value
$dataArray
setTypeFilterFromDbValue($value)
get the question type filter from database value
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertDbRecord()

ilTestRandomQuestionSetSourcePoolDefinition::insertDbRecord (   $testId)
private
Parameters
$testId

Definition at line 411 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array, getMappedTaxonomyFilterForDbValue(), getOriginalTaxonomyFilterForDbValue(), getPoolId(), getPoolPath(), getPoolQuestionCount(), getPoolTitle(), getQuestionAmount(), getSequencePosition(), getTypeFilterForDbValue(), and setId().

Referenced by cloneToDbForTestId(), and saveToDb().

412  {
413  $nextId = $this->db->nextId('tst_rnd_quest_set_qpls');
414 
415  $this->db->insert('tst_rnd_quest_set_qpls', array(
416  'def_id' => array('integer', $nextId),
417  'test_fi' => array('integer', $testId),
418  'pool_fi' => array('integer', $this->getPoolId()),
419  'pool_title' => array('text', $this->getPoolTitle()),
420  'pool_path' => array('text', $this->getPoolPath()),
421  'pool_quest_count' => array('integer', $this->getPoolQuestionCount()),
422  // fau: taxFilter/typeFilter - use new db fields
423  #'origin_tax_fi' => array('integer', $this->getOriginalFilterTaxId()),
424  #'origin_node_fi' => array('integer', $this->getOriginalFilterTaxNodeId()),
425  #'mapped_tax_fi' => array('integer', $this->getMappedFilterTaxId()),
426  #'mapped_node_fi' => array('integer', $this->getMappedFilterTaxNodeId()),
427  'origin_tax_filter' => array('text', $this->getOriginalTaxonomyFilterForDbValue()),
428  'mapped_tax_filter' => array('text', $this->getMappedTaxonomyFilterForDbValue()),
429  'type_filter' => array('text', $this->getTypeFilterForDbValue()),
430  // fau.
431  'quest_amount' => array('integer', $this->getQuestionAmount()),
432  'sequence_pos' => array('integer', $this->getSequencePosition())
433  ));
434 
435  $this->setId($nextId);
436  }
getOriginalTaxonomyFilterForDbValue()
get the original taxonomy filter for insert into the database
Create styles array
The data for the language used.
getTypeFilterForDbValue()
get the question type filter for insert into the database
getMappedTaxonomyFilterForDbValue()
get the original taxonomy filter for insert into the database
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromDb()

ilTestRandomQuestionSetSourcePoolDefinition::loadFromDb (   $id)
Parameters
integer$poolId
Returns
boolean

Definition at line 337 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $id, $res, $row, array, and initFromArray().

338  {
339  $res = $this->db->queryF(
340  "SELECT * FROM tst_rnd_quest_set_qpls WHERE def_id = %s",
341  array('integer'),
342  array($id)
343  );
344 
345  while ($row = $this->db->fetchAssoc($res)) {
346  $this->initFromArray($row);
347 
348  return true;
349  }
350 
351  return false;
352  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ mapTaxonomyFilter()

ilTestRandomQuestionSetSourcePoolDefinition::mapTaxonomyFilter ( ilQuestionPoolDuplicatedTaxonomiesKeysMap  $taxonomiesKeysMap)

set the mapped taxonomy filter from original by applying a keys map

Parameters
ilQuestionPoolDuplicatedTaxonomiesKeysMap$taxonomiesKeysMap

Definition at line 202 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array, ilQuestionPoolDuplicatedTaxonomiesKeysMap\getMappedTaxNodeId(), and ilQuestionPoolDuplicatedTaxonomiesKeysMap\getMappedTaxonomyId().

203  {
204  $this->mappedTaxonomyFilter = array();
205  foreach ($this->originalTaxonomyFilter as $taxId => $nodeIds) {
206  $mappedNodeIds = array();
207  foreach ($nodeIds as $nodeId) {
208  $mappedNodeIds[] = $taxonomiesKeysMap->getMappedTaxNodeId($nodeId);
209  }
210  $this->mappedTaxonomyFilter[$taxonomiesKeysMap->getMappedTaxonomyId($taxId)] = $mappedNodeIds;
211  }
212  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ saveToDb()

ilTestRandomQuestionSetSourcePoolDefinition::saveToDb ( )

Definition at line 354 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References getId(), insertDbRecord(), and updateDbRecord().

+ Here is the call graph for this function:

◆ setId()

ilTestRandomQuestionSetSourcePoolDefinition::setId (   $id)

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

References $id.

Referenced by initFromArray(), and insertDbRecord().

+ Here is the caller graph for this function:

◆ setMappedTaxonomyFilter()

ilTestRandomQuestionSetSourcePoolDefinition::setMappedTaxonomyFilter (   $filter = array())

set the original taxonomy filter condition

Parameters
arraytaxId => [nodeId, ...]

Definition at line 174 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by ilObjTestXMLParser\importRandomQuestionSourcePoolDefinition().

175  {
176  $this->mappedTaxonomyFilter = $filter;
177  }
+ Here is the caller graph for this function:

◆ setMappedTaxonomyFilterFromDbValue()

ilTestRandomQuestionSetSourcePoolDefinition::setMappedTaxonomyFilterFromDbValue (   $value)
private

get the original taxonomy filter from database value

Parameters
null|stringserialized taxonomy filter

Definition at line 192 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array.

Referenced by initFromArray().

193  {
194  $this->mappedTaxonomyFilter = empty($value) ? array() : unserialize($value);
195  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setOriginalTaxonomyFilter()

ilTestRandomQuestionSetSourcePoolDefinition::setOriginalTaxonomyFilter (   $filter = array())

set the original taxonomy filter condition

Parameters
arraytaxId => [nodeId, ...]

Definition at line 136 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by ilTestRandomQuestionSetPoolDefinitionFormGUI\applySubmit().

137  {
138  $this->originalTaxonomyFilter = $filter;
139  }
+ Here is the caller graph for this function:

◆ setOriginalTaxonomyFilterFromDbValue()

ilTestRandomQuestionSetSourcePoolDefinition::setOriginalTaxonomyFilterFromDbValue (   $value)
private

get the original taxonomy filter from database value

Parameters
null|stringserialized taxonomy filter

Definition at line 155 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array.

Referenced by initFromArray().

156  {
157  // TODO-RND2017: migrate to separate table for common selections by e.g. statistics
158  $this->originalTaxonomyFilter = empty($value) ? array() : unserialize($value);
159  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setPoolId()

ilTestRandomQuestionSetSourcePoolDefinition::setPoolId (   $poolId)

◆ setPoolPath()

ilTestRandomQuestionSetSourcePoolDefinition::setPoolPath (   $poolPath)

Definition at line 102 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $poolPath.

Referenced by initFromArray().

+ Here is the caller graph for this function:

◆ setPoolQuestionCount()

ilTestRandomQuestionSetSourcePoolDefinition::setPoolQuestionCount (   $poolQuestionCount)

Definition at line 112 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $poolQuestionCount.

Referenced by ilObjTestXMLParser\importRandomQuestionSourcePoolDefinition(), and initFromArray().

+ Here is the caller graph for this function:

◆ setPoolTitle()

ilTestRandomQuestionSetSourcePoolDefinition::setPoolTitle (   $poolTitle)

Definition at line 92 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $poolTitle.

Referenced by initFromArray().

+ Here is the caller graph for this function:

◆ setQuestionAmount()

ilTestRandomQuestionSetSourcePoolDefinition::setQuestionAmount (   $questionAmount)

◆ setSequencePosition()

ilTestRandomQuestionSetSourcePoolDefinition::setSequencePosition (   $sequencePosition)

Definition at line 294 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $sequencePosition.

Referenced by ilObjTestXMLParser\importRandomQuestionSourcePoolDefinition(), and initFromArray().

+ Here is the caller graph for this function:

◆ setTypeFilter()

ilTestRandomQuestionSetSourcePoolDefinition::setTypeFilter (   $typeFilter = array())

Definition at line 214 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References $typeFilter.

Referenced by ilTestRandomQuestionSetPoolDefinitionFormGUI\applySubmit().

+ Here is the caller graph for this function:

◆ setTypeFilterFromDbValue()

ilTestRandomQuestionSetSourcePoolDefinition::setTypeFilterFromDbValue (   $value)
private

get the question type filter from database value

Parameters
null|stringserialized type filter

Definition at line 237 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array.

Referenced by initFromArray().

238  {
239  $this->typeFilter = empty($value) ? array() : unserialize($value);
240  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ updateDbRecord()

ilTestRandomQuestionSetSourcePoolDefinition::updateDbRecord (   $testId)
private
Parameters
$testId

Definition at line 380 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

References array, getId(), getMappedTaxonomyFilterForDbValue(), getOriginalTaxonomyFilterForDbValue(), getPoolId(), getPoolPath(), getPoolQuestionCount(), getPoolTitle(), getQuestionAmount(), getSequencePosition(), and getTypeFilterForDbValue().

Referenced by saveToDb().

381  {
382  $this->db->update(
383  'tst_rnd_quest_set_qpls',
384  array(
385  'test_fi' => array('integer', $testId),
386  'pool_fi' => array('integer', $this->getPoolId()),
387  'pool_title' => array('text', $this->getPoolTitle()),
388  'pool_path' => array('text', $this->getPoolPath()),
389  'pool_quest_count' => array('integer', $this->getPoolQuestionCount()),
390  // fau: taxFilter/typeFilter - use new db fields
391  #'origin_tax_fi' => array('integer', $this->getOriginalFilterTaxId()),
392  #'origin_node_fi' => array('integer', $this->getOriginalFilterTaxNodeId()),
393  #'mapped_tax_fi' => array('integer', $this->getMappedFilterTaxId()),
394  #'mapped_node_fi' => array('integer', $this->getMappedFilterTaxNodeId()),
395  'origin_tax_filter' => array('text', $this->getOriginalTaxonomyFilterForDbValue()),
396  'mapped_tax_filter' => array('text', $this->getMappedTaxonomyFilterForDbValue()),
397  'type_filter' => array('text', $this->getTypeFilterForDbValue()),
398  // fau.
399  'quest_amount' => array('integer', $this->getQuestionAmount()),
400  'sequence_pos' => array('integer', $this->getSequencePosition())
401  ),
402  array(
403  'def_id' => array('integer', $this->getId())
404  )
405  );
406  }
getOriginalTaxonomyFilterForDbValue()
get the original taxonomy filter for insert into the database
Create styles array
The data for the language used.
getTypeFilterForDbValue()
get the question type filter for insert into the database
getMappedTaxonomyFilterForDbValue()
get the original taxonomy filter for insert into the database
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTestRandomQuestionSetSourcePoolDefinition::$db = null
protected

Definition at line 17 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by __construct().

◆ $id

ilTestRandomQuestionSetSourcePoolDefinition::$id = null
private

Definition at line 26 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by getId(), loadFromDb(), and setId().

◆ $mappedTaxonomyFilter

ilTestRandomQuestionSetSourcePoolDefinition::$mappedTaxonomyFilter = array()
private

◆ $originalTaxonomyFilter

ilTestRandomQuestionSetSourcePoolDefinition::$originalTaxonomyFilter = array()
private

◆ $poolId

ilTestRandomQuestionSetSourcePoolDefinition::$poolId = null
private

Definition at line 28 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by getPoolId(), and setPoolId().

◆ $poolPath

ilTestRandomQuestionSetSourcePoolDefinition::$poolPath = null
private

◆ $poolQuestionCount

ilTestRandomQuestionSetSourcePoolDefinition::$poolQuestionCount = null
private

◆ $poolTitle

ilTestRandomQuestionSetSourcePoolDefinition::$poolTitle = null
private

◆ $questionAmount

ilTestRandomQuestionSetSourcePoolDefinition::$questionAmount = null
private

◆ $sequencePosition

ilTestRandomQuestionSetSourcePoolDefinition::$sequencePosition = null
private

◆ $testOBJ

ilTestRandomQuestionSetSourcePoolDefinition::$testOBJ = null
protected

Definition at line 24 of file class.ilTestRandomQuestionSetSourcePoolDefinition.php.

Referenced by __construct().

◆ $typeFilter

ilTestRandomQuestionSetSourcePoolDefinition::$typeFilter = array()
private

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