ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestQuestionFilterLabelTranslator Class Reference
+ Collaboration diagram for ilTestQuestionFilterLabelTranslator:

Public Member Functions

 __construct (private ilDBInterface $db, private ilLanguage $lng)
 
 loadLabels (ilTestRandomQuestionSetSourcePoolDefinitionList $source_pool_definition_list)
 
 getTaxonomyTreeLabel (int $taxonomy_tree_id)
 
 getTaxonomyNodeLabel (int $taxonomy_node_id)
 
 loadLabelsFromTaxonomyIds (array $taxonomy_ids)
 
 getTaxonomyFilterLabel (array $filter=[], string $filter_delimiter='+', string $tax_node_delimiter=':', string $nodes_delimiter=', ')
 
 getLifecycleFilterLabel (array $filter=[])
 
 getTypeFilterLabel (array $filter=[])
 

Private Member Functions

 collectIds (ilTestRandomQuestionSetSourcePoolDefinitionList $source_pool_definition_list)
 
 loadTaxonomyTreeLabels ()
 
 loadTaxonomyNodeLabels ()
 
 loadTypeLabels ()
 

Private Attributes

array $taxonomy_tree_ids = []
 
array $taxonomy_node_ids = []
 
array $taxonomy_tree_labels = []
 
array $taxonomy_node_labels = []
 
array $type_labels = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionFilterLabelTranslator::__construct ( private ilDBInterface  $db,
private ilLanguage  $lng 
)

Definition at line 37 of file class.ilTestQuestionFilterLabelTranslator.php.

References loadTypeLabels().

+ Here is the call graph for this function:

Member Function Documentation

◆ collectIds()

ilTestQuestionFilterLabelTranslator::collectIds ( ilTestRandomQuestionSetSourcePoolDefinitionList  $source_pool_definition_list)
private

Definition at line 53 of file class.ilTestQuestionFilterLabelTranslator.php.

55 : void {
56 foreach ($source_pool_definition_list as $definition) {
57 foreach ($definition->getOriginalTaxonomyFilter() as $tax_id => $node_ids) {
58 $this->taxonomy_tree_ids[] = $tax_id;
59 $this->taxonomy_node_ids = array_merge($this->taxonomy_node_ids, $node_ids);
60 }
61
62 // mapped filter will be shown after synchronisation
63 foreach ($definition->getMappedTaxonomyFilter() as $tax_id => $node_ids) {
64 $this->taxonomy_tree_ids[] = $tax_id;
65 $this->taxonomy_node_ids = array_merge($this->taxonomy_node_ids, $node_ids);
66 }
67 }
68 }

◆ getLifecycleFilterLabel()

ilTestQuestionFilterLabelTranslator::getLifecycleFilterLabel ( array  $filter = [])

Definition at line 150 of file class.ilTestQuestionFilterLabelTranslator.php.

150 : string
151 {
152 $lifecycle_translations = ilAssQuestionLifecycle::getDraftInstance()->getSelectOptions($this->lng);
153
154 $lifecycles = [];
155 foreach ($filter as $lifecycle) {
156 $lifecycles[] = $lifecycle_translations[$lifecycle];
157 }
158 asort($lifecycles);
159 return implode(', ', $lifecycles);
160 }
$lifecycle

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

+ Here is the call graph for this function:

◆ getTaxonomyFilterLabel()

ilTestQuestionFilterLabelTranslator::getTaxonomyFilterLabel ( array  $filter = [],
string  $filter_delimiter = ' + ',
string  $tax_node_delimiter = ': ',
string  $nodes_delimiter = ',
 
)

Definition at line 131 of file class.ilTestQuestionFilterLabelTranslator.php.

134 : ',
135 string $nodes_delimiter = ', '
136 ): string {
137 $labels = [];
138 foreach ($filter as $tax_id => $node_ids) {
139 $nodes = [];
140 foreach ($node_ids as $node_id) {
141 $nodes[] = $this->getTaxonomyNodeLabel((int) $node_id);
142 }
143 $labels[] = $this->getTaxonomyTreeLabel($tax_id)
144 . $tax_node_delimiter
145 . implode($nodes_delimiter, $nodes);
146 }
147 return implode($filter_delimiter, $labels);
148 }

◆ getTaxonomyNodeLabel()

ilTestQuestionFilterLabelTranslator::getTaxonomyNodeLabel ( int  $taxonomy_node_id)

Definition at line 119 of file class.ilTestQuestionFilterLabelTranslator.php.

119 : string
120 {
121 return $this->taxonomy_node_labels[$taxonomy_node_id];
122 }

◆ getTaxonomyTreeLabel()

ilTestQuestionFilterLabelTranslator::getTaxonomyTreeLabel ( int  $taxonomy_tree_id)

Definition at line 114 of file class.ilTestQuestionFilterLabelTranslator.php.

114 : string
115 {
116 return $this->taxonomy_tree_labels[$taxonomy_tree_id];
117 }

◆ getTypeFilterLabel()

ilTestQuestionFilterLabelTranslator::getTypeFilterLabel ( array  $filter = [])

Definition at line 162 of file class.ilTestQuestionFilterLabelTranslator.php.

162 : string
163 {
164 $types = [];
165 foreach ($filter as $type_id) {
166 $types[] = $this->type_labels[$type_id];
167 }
168 asort($types);
169 return implode(', ', $types);
170 }

◆ loadLabels()

ilTestQuestionFilterLabelTranslator::loadLabels ( ilTestRandomQuestionSetSourcePoolDefinitionList  $source_pool_definition_list)

Definition at line 44 of file class.ilTestQuestionFilterLabelTranslator.php.

46 : void {
47 $this->collectIds($source_pool_definition_list);
48
51 }
collectIds(ilTestRandomQuestionSetSourcePoolDefinitionList $source_pool_definition_list)

◆ loadLabelsFromTaxonomyIds()

ilTestQuestionFilterLabelTranslator::loadLabelsFromTaxonomyIds ( array  $taxonomy_ids)

Definition at line 124 of file class.ilTestQuestionFilterLabelTranslator.php.

124 : void
125 {
126 $this->taxonomy_tree_ids = $taxonomy_ids;
127
128 $this->loadTaxonomyTreeLabels();
129 }

◆ loadTaxonomyNodeLabels()

ilTestQuestionFilterLabelTranslator::loadTaxonomyNodeLabels ( )
private

Definition at line 91 of file class.ilTestQuestionFilterLabelTranslator.php.

92 {
93 $res = $this->db->query("
94 SELECT tax_node.obj_id tax_node_id,
95 tax_node.title tax_node_title
96
97 FROM tax_node
98
99 WHERE {$this->db->in('tax_node.obj_id', $this->taxonomy_node_ids, false, 'integer')}
100 ");
101
102 while ($row = $this->db->fetchAssoc($res)) {
103 $this->taxonomy_node_labels[ $row['tax_node_id'] ] = $row['tax_node_title'];
104 }
105 }
$res
Definition: ltiservices.php:69

References $res.

◆ loadTaxonomyTreeLabels()

ilTestQuestionFilterLabelTranslator::loadTaxonomyTreeLabels ( )
private

Definition at line 70 of file class.ilTestQuestionFilterLabelTranslator.php.

70 : void
71 {
72 $res = $this->db->queryF(
73 "
74 SELECT obj_id tax_tree_id,
75 title tax_tree_title
76
77 FROM object_data
78
79 WHERE {$this->db->in('obj_id', $this->taxonomy_tree_ids, false, 'integer')}
80 AND type = %s
81 ",
82 ['text'],
83 ['tax']
84 );
85
86 while ($row = $this->db->fetchAssoc($res)) {
87 $this->taxonomy_tree_labels[ $row['tax_tree_id'] ] = $row['tax_tree_title'];
88 }
89 }

References $res.

◆ loadTypeLabels()

ilTestQuestionFilterLabelTranslator::loadTypeLabels ( )
private

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

107 : void
108 {
109 foreach (ilObjQuestionPool::_getQuestionTypes(true) as $translation => $data) {
110 $this->type_labels[$data['question_type_id']] = $translation;
111 }
112 }
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)

References $data, and ilObjQuestionPool\_getQuestionTypes().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $taxonomy_node_ids

array ilTestQuestionFilterLabelTranslator::$taxonomy_node_ids = []
private

◆ $taxonomy_node_labels

array ilTestQuestionFilterLabelTranslator::$taxonomy_node_labels = []
private

◆ $taxonomy_tree_ids

array ilTestQuestionFilterLabelTranslator::$taxonomy_tree_ids = []
private

◆ $taxonomy_tree_labels

array ilTestQuestionFilterLabelTranslator::$taxonomy_tree_labels = []
private

◆ $type_labels

array ilTestQuestionFilterLabelTranslator::$type_labels = []
private

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