ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestTaxonomyFilterLabelTranslater Class Reference
+ Collaboration diagram for ilTestTaxonomyFilterLabelTranslater:

Public Member Functions

 __construct (ilDBInterface $db)
 
 loadLabels (ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList)
 
 getTaxonomyTreeLabel ($taxonomyTreeId)
 
 getTaxonomyNodeLabel ($taxonomyTreeId)
 
 loadLabelsFromTaxonomyIds ($taxonomyIds)
 
 getTaxonomyFilterLabel ($filter=array(), $filterDelimiter='+', $taxNodeDelimiter=':', $nodesDelimiter=', ')
 Get the label for a taxonomy filter. More...
 
 getLifecycleFilterLabel ($filter=array())
 Get the label for a lifecycle filter. More...
 
 getTypeFilterLabel ($filter=array())
 Get the label for a type filter. More...
 

Private Member Functions

 loadTaxonomyTreeLabels ()
 
 loadTaxonomyNodeLabels ()
 
 loadTypeLabels ()
 

Private Attributes

 $db = null
 
 $taxonomyTreeIds = null
 
 $taxonomyNodeIds = null
 
 $taxonomyTreeLabels = null
 
 $taxonomyNodeLabels = null
 
 $typeLabels = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestTaxonomyFilterLabelTranslater::__construct ( ilDBInterface  $db)
Parameters
ilDBInterface$db

Definition at line 33 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References $db, and loadTypeLabels().

34  {
35  $this->db = $db;
36 
37  $this->taxonomyTreeIds = array();
38  $this->taxonomyNodeIds = array();
39 
40  $this->taxonomyTreeLabels = array();
41  $this->taxonomyNodeLabels = array();
42 
43  // fau: taxFilter/typeFilter - init node descriptions
44  $this->loadTypeLabels();
45  // fau.
46  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getLifecycleFilterLabel()

ilTestTaxonomyFilterLabelTranslater::getLifecycleFilterLabel (   $filter = array())

Get the label for a lifecycle filter.

Parameters
array$filterlist of lifecycle identifiers

Definition at line 180 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References $DIC, and ilAssQuestionLifecycle\getDraftInstance().

181  {
182  global $DIC; /* @var ILIAS\DI\Container $DIC */
183 
184  $lifecycles = array();
185 
186  $lifecycleTranslations = ilAssQuestionLifecycle::getDraftInstance()->getSelectOptions($DIC->language());
187 
188  foreach ($filter as $lifecycle) {
189  $lifecycles[] = $lifecycleTranslations[$lifecycle];
190  }
191  asort($lifecycles);
192  return implode(', ', $lifecycles);
193  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getTaxonomyFilterLabel()

ilTestTaxonomyFilterLabelTranslater::getTaxonomyFilterLabel (   $filter = array(),
  $filterDelimiter = ' + ',
  $taxNodeDelimiter = ': ',
  $nodesDelimiter = ',
 
)

Get the label for a taxonomy filter.

Parameters
arraytaxId => [nodeId, ...]
stringdelimiter for separate taxonomy conditions
stringdelimiter between taxonomy name and node list
stringdelimiter between nodes in the node list

Definition at line 163 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References getTaxonomyNodeLabel(), and getTaxonomyTreeLabel().

Referenced by ilLOUtils\buildQplTitleByDefinition().

163  : ', $nodesDelimiter = ', ')
164  {
165  $labels = array();
166  foreach ($filter as $taxId => $nodeIds) {
167  $nodes = array();
168  foreach ($nodeIds as $nodeId) {
169  $nodes[] = $this->getTaxonomyNodeLabel($nodeId);
170  }
171  $labels[] .= $this->getTaxonomyTreeLabel($taxId) . $taxNodeDelimiter . implode($nodesDelimiter, $nodes);
172  }
173  return implode($filterDelimiter, $labels);
174  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTaxonomyNodeLabel()

ilTestTaxonomyFilterLabelTranslater::getTaxonomyNodeLabel (   $taxonomyTreeId)

Definition at line 143 of file class.ilTestTaxonomyFilterLabelTranslater.php.

Referenced by getTaxonomyFilterLabel().

144  {
145  return $this->taxonomyNodeLabels[$taxonomyTreeId];
146  }
+ Here is the caller graph for this function:

◆ getTaxonomyTreeLabel()

ilTestTaxonomyFilterLabelTranslater::getTaxonomyTreeLabel (   $taxonomyTreeId)

Definition at line 138 of file class.ilTestTaxonomyFilterLabelTranslater.php.

Referenced by getTaxonomyFilterLabel().

139  {
140  return $this->taxonomyTreeLabels[$taxonomyTreeId];
141  }
+ Here is the caller graph for this function:

◆ getTypeFilterLabel()

ilTestTaxonomyFilterLabelTranslater::getTypeFilterLabel (   $filter = array())

Get the label for a type filter.

Parameters
array$filterlist of type ids

Definition at line 199 of file class.ilTestTaxonomyFilterLabelTranslater.php.

Referenced by ilLOUtils\buildQplTitleByDefinition().

200  {
201  $types = array();
202 
203  foreach ($filter as $type_id) {
204  $types[] = $this->typeLabels[$type_id];
205  }
206  asort($types);
207  return implode(', ', $types);
208  }
+ Here is the caller graph for this function:

◆ loadLabels()

ilTestTaxonomyFilterLabelTranslater::loadLabels ( ilTestRandomQuestionSetSourcePoolDefinitionList  $sourcePoolDefinitionList)

Definition at line 48 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References loadTaxonomyNodeLabels(), and loadTaxonomyTreeLabels().

49  {
50  $this->collectIds($sourcePoolDefinitionList);
51 
52  $this->loadTaxonomyTreeLabels();
53  $this->loadTaxonomyNodeLabels();
54  }
+ Here is the call graph for this function:

◆ loadLabelsFromTaxonomyIds()

ilTestTaxonomyFilterLabelTranslater::loadLabelsFromTaxonomyIds (   $taxonomyIds)

Definition at line 148 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References loadTaxonomyTreeLabels().

149  {
150  $this->taxonomyTreeIds = $taxonomyIds;
151 
152  $this->loadTaxonomyTreeLabels();
153  }
+ Here is the call graph for this function:

◆ loadTaxonomyNodeLabels()

ilTestTaxonomyFilterLabelTranslater::loadTaxonomyNodeLabels ( )
private

Definition at line 106 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References $query, and $res.

Referenced by loadLabels().

107  {
108  $IN_nodeIds = $this->db->in('tax_node.obj_id', $this->taxonomyNodeIds, false, 'integer');
109 
110  $query = "
111  SELECT tax_node.obj_id tax_node_id,
112  tax_node.title tax_node_title
113 
114  FROM tax_node
115 
116  WHERE $IN_nodeIds
117  ";
118 
119  $res = $this->db->query($query);
120 
121  while ($row = $this->db->fetchAssoc($res)) {
122  $this->taxonomyNodeLabels[ $row['tax_node_id'] ] = $row['tax_node_title'];
123  }
124  }
foreach($_POST as $key=> $value) $res
$query
+ Here is the caller graph for this function:

◆ loadTaxonomyTreeLabels()

ilTestTaxonomyFilterLabelTranslater::loadTaxonomyTreeLabels ( )
private

Definition at line 85 of file class.ilTestTaxonomyFilterLabelTranslater.php.

References $query, and $res.

Referenced by loadLabels(), and loadLabelsFromTaxonomyIds().

86  {
87  $IN_taxIds = $this->db->in('obj_id', $this->taxonomyTreeIds, false, 'integer');
88 
89  $query = "
90  SELECT obj_id tax_tree_id,
91  title tax_tree_title
92 
93  FROM object_data
94 
95  WHERE $IN_taxIds
96  AND type = %s
97  ";
98 
99  $res = $this->db->queryF($query, array('text'), array('tax'));
100 
101  while ($row = $this->db->fetchAssoc($res)) {
102  $this->taxonomyTreeLabels[ $row['tax_tree_id'] ] = $row['tax_tree_title'];
103  }
104  }
foreach($_POST as $key=> $value) $res
$query
+ Here is the caller graph for this function:

◆ loadTypeLabels()

ilTestTaxonomyFilterLabelTranslater::loadTypeLabels ( )
private

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

References $data, and ilObjQuestionPool\_getQuestionTypes().

Referenced by __construct().

128  {
129  $this->typeLabels = array();
130 
131  require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
132  foreach (ilObjQuestionPool::_getQuestionTypes(true) as $translation => $data) {
133  $this->typeLabels[$data['question_type_id']] = $translation;
134  }
135  }
$data
Definition: storeScorm.php:23
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTestTaxonomyFilterLabelTranslater::$db = null
private

Definition at line 18 of file class.ilTestTaxonomyFilterLabelTranslater.php.

Referenced by __construct().

◆ $taxonomyNodeIds

ilTestTaxonomyFilterLabelTranslater::$taxonomyNodeIds = null
private

◆ $taxonomyNodeLabels

ilTestTaxonomyFilterLabelTranslater::$taxonomyNodeLabels = null
private

◆ $taxonomyTreeIds

ilTestTaxonomyFilterLabelTranslater::$taxonomyTreeIds = null
private

◆ $taxonomyTreeLabels

ilTestTaxonomyFilterLabelTranslater::$taxonomyTreeLabels = null
private

◆ $typeLabels

ilTestTaxonomyFilterLabelTranslater::$typeLabels = null
private

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