ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestQuestionFilterLabelTranslater Class Reference
+ Collaboration diagram for ilTestQuestionFilterLabelTranslater:

Public Member Functions

 __construct (private ilDBInterface $db, private ilLanguage $lng)
 
 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=[])
 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

array $taxonomyTreeIds = []
 
array $taxonomyNodeIds = []
 
array $taxonomyTreeLabels = []
 
array $taxonomyNodeLabels = []
 
array $typeLabels = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionFilterLabelTranslater::__construct ( private ilDBInterface  $db,
private ilLanguage  $lng 
)
Parameters
ilDBInterface$db

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

References loadTypeLabels().

+ Here is the call graph for this function:

Member Function Documentation

◆ getLifecycleFilterLabel()

ilTestQuestionFilterLabelTranslater::getLifecycleFilterLabel (   $filter = [])

Get the label for a lifecycle filter.

Parameters
array$filterlist of lifecycle identifiers

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

References $lifecycle, ilAssQuestionLifecycle\getDraftInstance(), and ILIAS\Repository\lng().

174  : string
175  {
176  $lifecycles = [];
177 
178  $lifecycleTranslations = ilAssQuestionLifecycle::getDraftInstance()->getSelectOptions($this->lng);
179 
180  foreach ($filter as $lifecycle) {
181  $lifecycles[] = $lifecycleTranslations[$lifecycle];
182  }
183  asort($lifecycles);
184  return implode(', ', $lifecycles);
185  }
$lifecycle
+ Here is the call graph for this function:

◆ getTaxonomyFilterLabel()

ilTestQuestionFilterLabelTranslater::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 157 of file class.ilTestQuestionFilterLabelTranslater.php.

References getTaxonomyNodeLabel(), and getTaxonomyTreeLabel().

Referenced by ilLOUtils\buildQplTitleByDefinition().

157  : ', $nodesDelimiter = ', '): string
158  {
159  $labels = array();
160  foreach ($filter as $taxId => $nodeIds) {
161  $nodes = array();
162  foreach ($nodeIds as $nodeId) {
163  $nodes[] = $this->getTaxonomyNodeLabel($nodeId);
164  }
165  $labels[] .= $this->getTaxonomyTreeLabel($taxId) . $taxNodeDelimiter . implode($nodesDelimiter, $nodes);
166  }
167  return implode($filterDelimiter, $labels);
168  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTaxonomyNodeLabel()

ilTestQuestionFilterLabelTranslater::getTaxonomyNodeLabel (   $taxonomyTreeId)

Definition at line 137 of file class.ilTestQuestionFilterLabelTranslater.php.

Referenced by getTaxonomyFilterLabel().

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

◆ getTaxonomyTreeLabel()

ilTestQuestionFilterLabelTranslater::getTaxonomyTreeLabel (   $taxonomyTreeId)

Definition at line 132 of file class.ilTestQuestionFilterLabelTranslater.php.

Referenced by getTaxonomyFilterLabel().

133  {
134  return $this->taxonomyTreeLabels[$taxonomyTreeId];
135  }
+ Here is the caller graph for this function:

◆ getTypeFilterLabel()

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

Get the label for a type filter.

Parameters
array$filterlist of type ids

Definition at line 191 of file class.ilTestQuestionFilterLabelTranslater.php.

Referenced by ilLOUtils\buildQplTitleByDefinition().

191  : string
192  {
193  $types = array();
194 
195  foreach ($filter as $type_id) {
196  $types[] = $this->typeLabels[$type_id];
197  }
198  asort($types);
199  return implode(', ', $types);
200  }
+ Here is the caller graph for this function:

◆ loadLabels()

ilTestQuestionFilterLabelTranslater::loadLabels ( ilTestRandomQuestionSetSourcePoolDefinitionList  $sourcePoolDefinitionList)

Definition at line 47 of file class.ilTestQuestionFilterLabelTranslater.php.

References loadTaxonomyNodeLabels(), and loadTaxonomyTreeLabels().

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

◆ loadLabelsFromTaxonomyIds()

ilTestQuestionFilterLabelTranslater::loadLabelsFromTaxonomyIds (   $taxonomyIds)

Definition at line 142 of file class.ilTestQuestionFilterLabelTranslater.php.

References loadTaxonomyTreeLabels().

143  {
144  $this->taxonomyTreeIds = $taxonomyIds;
145 
146  $this->loadTaxonomyTreeLabels();
147  }
+ Here is the call graph for this function:

◆ loadTaxonomyNodeLabels()

ilTestQuestionFilterLabelTranslater::loadTaxonomyNodeLabels ( )
private

Definition at line 105 of file class.ilTestQuestionFilterLabelTranslater.php.

References $res.

Referenced by loadLabels().

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

◆ loadTaxonomyTreeLabels()

ilTestQuestionFilterLabelTranslater::loadTaxonomyTreeLabels ( )
private

Definition at line 84 of file class.ilTestQuestionFilterLabelTranslater.php.

References $res.

Referenced by loadLabels(), and loadLabelsFromTaxonomyIds().

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

◆ loadTypeLabels()

ilTestQuestionFilterLabelTranslater::loadTypeLabels ( )
private

Definition at line 125 of file class.ilTestQuestionFilterLabelTranslater.php.

References $data, and ilObjQuestionPool\_getQuestionTypes().

Referenced by __construct().

126  {
127  foreach (ilObjQuestionPool::_getQuestionTypes(true) as $translation => $data) {
128  $this->typeLabels[$data['question_type_id']] = $translation;
129  }
130  }
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

◆ $taxonomyNodeIds

array ilTestQuestionFilterLabelTranslater::$taxonomyNodeIds = []
private

◆ $taxonomyNodeLabels

array ilTestQuestionFilterLabelTranslater::$taxonomyNodeLabels = []
private

◆ $taxonomyTreeIds

array ilTestQuestionFilterLabelTranslater::$taxonomyTreeIds = []
private

◆ $taxonomyTreeLabels

array ilTestQuestionFilterLabelTranslater::$taxonomyTreeLabels = []
private

◆ $typeLabels

array ilTestQuestionFilterLabelTranslater::$typeLabels = []
private

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