ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilTestRandomQuestionSetStagingPoolQuestionList Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetStagingPoolQuestionList:
+ Collaboration diagram for ilTestRandomQuestionSetStagingPoolQuestionList:

Public Member Functions

 __construct (ilDBInterface $db, ilComponentRepository $component_repository)
 
 setTestObjId ($test_obj_id)
 
 getTestObjId ()
 
 setTestId ($test_id)
 
 getTestId ()
 
 setPoolId ($pool_id)
 
 getPoolId ()
 
 addTaxonomyFilter ($tax_id, $tax_nodes)
 
 getTaxonomyFilters ()
 
 getTypeFilter ()
 
 setTypeFilter ($type_filter)
 
 getLifecycleFilter ()
 
 setLifecycleFilter (array $lifecycle_filter)
 
 loadQuestions ()
 
 resetQuestionList ()
 
 getQuestions ()
 
 rewind ()
 
 current ()
 
 key ()
 
 next ()
 
 valid ()
 

Static Public Member Functions

static updateSourceQuestionPoolId ($test_id, $old_pool_id, $new_pool_id)
 

Private Member Functions

 getConditionalExpression ()
 
 getTaxonomyFilterExpressions ()
 
 getLifecycleFilterExpressions ()
 
 getTypeFilterExpressions ()
 
 isActiveQuestionType (array $question_data)
 

Private Attributes

ilDBInterface $db
 
ilComponentRepository $component_repository
 
 $test_obj_id = -1
 
 $test_id = -1
 
 $pool_id = -1
 
 $tax_filters = []
 
 $type_filter = []
 
 $lifecycle_filter = []
 
 $questions = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionSetStagingPoolQuestionList::__construct ( ilDBInterface  $db,
ilComponentRepository  $component_repository 
)

Member Function Documentation

◆ addTaxonomyFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::addTaxonomyFilter (   $tax_id,
  $tax_nodes 
)

Definition at line 109 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

110 {
111 $tax_id = (int) $tax_id;
112 if ($tax_id < 1) {
113 return;
114 }
115
116 $this->tax_filters[$tax_id] = $tax_nodes;
117 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ current()

ilTestRandomQuestionSetStagingPoolQuestionList::current ( )

Definition at line 316 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

316 : ?int
317 {
318 $current = current($this->questions);
319 return $current !== false ? $current : null;
320 }

References current().

Referenced by current().

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

◆ getConditionalExpression()

ilTestRandomQuestionSetStagingPoolQuestionList::getConditionalExpression ( )
private

Definition at line 193 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

193 : string
194 {
195 $conditions = $this->getTaxonomyFilterExpressions();
196
197 // fau: taxFilter/typeFilter - add the type filter expression to conditions
198 $conditions = array_merge($conditions, $this->getTypeFilterExpressions());
199 // fau.
200
201 $conditions = array_merge($conditions, $this->getLifecycleFilterExpressions());
202
203 $conditions = implode(' AND ', $conditions);
204
205 return strlen($conditions) ? 'AND ' . $conditions : '';
206 }

References getLifecycleFilterExpressions(), getTaxonomyFilterExpressions(), and getTypeFilterExpressions().

+ Here is the call graph for this function:

◆ getLifecycleFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::getLifecycleFilter ( )

◆ getLifecycleFilterExpressions()

ilTestRandomQuestionSetStagingPoolQuestionList::getLifecycleFilterExpressions ( )
private

Definition at line 242 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

242 : array
243 {
244 if (count($this->lifecycle_filter)) {
245 return [
246 $this->db->in('lifecycle', $this->lifecycle_filter, false, 'text')
247 ];
248 }
249
250 return [];
251 }

Referenced by getConditionalExpression().

+ Here is the caller graph for this function:

◆ getPoolId()

ilTestRandomQuestionSetStagingPoolQuestionList::getPoolId ( )

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

References $pool_id.

Referenced by loadQuestions().

+ Here is the caller graph for this function:

◆ getQuestions()

ilTestRandomQuestionSetStagingPoolQuestionList::getQuestions ( )

Definition at line 304 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

304 : array
305 {
306 return array_values($this->questions);
307 }

◆ getTaxonomyFilterExpressions()

ilTestRandomQuestionSetStagingPoolQuestionList::getTaxonomyFilterExpressions ( )
private

Definition at line 208 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

208 : array
209 {
210 $expressions = [];
211
212 foreach ($this->getTaxonomyFilters() as $tax_id => $tax_nodes) {
213 $question_ids = [];
214
215 $force_bypass = true;
216
217 foreach ($tax_nodes as $tax_node) {
218 $force_bypass = false;
219
220 $tax_tree = new ilTaxonomyTree($tax_id);
221
222 $tax_node_assignment = new ilTaxNodeAssignment('tst', $this->getTestObjId(), 'quest', $tax_id);
223
224 $sub_nodes = $tax_tree->getSubTreeIds((int) $tax_node);
225 $sub_nodes[] = $tax_node;
226
227 $tax_items = $tax_node_assignment->getAssignmentsOfNode($sub_nodes);
228
229 foreach ($tax_items as $tax_item) {
230 $question_ids[$tax_item['item_id']] = $tax_item['item_id'];
231 }
232 }
233
234 if (!$force_bypass) {
235 $expressions[] = $this->db->in('question_id', $question_ids, false, 'integer');
236 }
237 }
238
239 return $expressions;
240 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References getTaxonomyFilters(), and getTestObjId().

Referenced by getConditionalExpression().

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

◆ getTaxonomyFilters()

ilTestRandomQuestionSetStagingPoolQuestionList::getTaxonomyFilters ( )

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

References $tax_filters.

Referenced by getTaxonomyFilterExpressions().

+ Here is the caller graph for this function:

◆ getTestId()

ilTestRandomQuestionSetStagingPoolQuestionList::getTestId ( )

Definition at line 94 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

References $test_id.

Referenced by loadQuestions().

+ Here is the caller graph for this function:

◆ getTestObjId()

ilTestRandomQuestionSetStagingPoolQuestionList::getTestObjId ( )

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

References $test_obj_id.

Referenced by getTaxonomyFilterExpressions().

+ Here is the caller graph for this function:

◆ getTypeFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::getTypeFilter ( )

◆ getTypeFilterExpressions()

ilTestRandomQuestionSetStagingPoolQuestionList::getTypeFilterExpressions ( )
private

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

254 : array
255 {
256 if (count($this->type_filter)) {
257 return [
258 $this->db->in('question_type_fi', $this->type_filter, false, 'integer')
259 ];
260 }
261
262 return [];
263 }

Referenced by getConditionalExpression().

+ Here is the caller graph for this function:

◆ isActiveQuestionType()

ilTestRandomQuestionSetStagingPoolQuestionList::isActiveQuestionType ( array  $question_data)
private

Definition at line 266 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

266 : bool
267 {
268 if (!isset($question_data['plugin'])) {
269 return false;
270 }
271
272 if (!$question_data['plugin']) {
273 return true;
274 }
275
276 if (!$this->component_repository->getComponentByTypeAndName(
278 'TestQuestionPool'
279 )->getPluginSlotById('qst')->hasPluginName($question_data['plugin_name'])) {
280 return false;
281 }
282
283 return $this->component_repository
284 ->getComponentByTypeAndName(
286 'TestQuestionPool'
287 )
288 ->getPluginSlotById(
289 'qst'
290 )
291 ->getPluginByName(
292 $question_data['plugin_name']
293 )->isActive();
294 }

References ilComponentInfo\TYPE_COMPONENT.

Referenced by loadQuestions().

+ Here is the caller graph for this function:

◆ key()

ilTestRandomQuestionSetStagingPoolQuestionList::key ( )

Definition at line 322 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

References key().

Referenced by key(), and valid().

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

◆ loadQuestions()

ilTestRandomQuestionSetStagingPoolQuestionList::loadQuestions ( )

Definition at line 152 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

153 {
154 $query = "
155 SELECT qpl_questions.question_id,
156 qpl_qst_type.type_tag AS question_type,
157 qpl_qst_type.plugin,
158 qpl_qst_type.plugin_name
159
160 FROM tst_rnd_cpy
161
162 INNER JOIN qpl_questions
163 ON qpl_questions.question_id = tst_rnd_cpy.qst_fi
164
165 INNER JOIN qpl_qst_type
166 ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi
167
168 WHERE tst_rnd_cpy.tst_fi = %s
169 AND tst_rnd_cpy.qpl_fi = %s
170
171 {$this->getConditionalExpression()}
172 ";
173
174 $res = $this->db->queryF(
175 $query,
176 ['integer', 'integer'],
177 [$this->getTestId(), $this->getPoolId()]
178 );
179
180 //echo sprintf($query, $this->getTestId(), $this->getPoolId());exit;
181
182 while ($row = $this->db->fetchAssoc($res)) {
184
185 if (!$this->isActiveQuestionType($row)) {
186 continue;
187 }
188
189 $this->questions[] = (int) $row['question_id'];
190 }
191 }
static completeMissingPluginName(array $question_type_data)
foreach($_POST as $key=> $value) $res

References $res, ilAssQuestionType\completeMissingPluginName(), getPoolId(), getTestId(), ILIAS\Repository\int(), and isActiveQuestionType().

+ Here is the call graph for this function:

◆ next()

ilTestRandomQuestionSetStagingPoolQuestionList::next ( )

Definition at line 327 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

References next().

Referenced by next().

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

◆ resetQuestionList()

ilTestRandomQuestionSetStagingPoolQuestionList::resetQuestionList ( )

Definition at line 296 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

297 {
298 $this->questions = [];
299 $this->tax_filters = [];
300 $this->type_filter = [];
301 $this->pool_id = -1;
302 }

◆ rewind()

ilTestRandomQuestionSetStagingPoolQuestionList::rewind ( )

Definition at line 311 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

311 : void
312 {
313 reset($this->questions);
314 }

◆ setLifecycleFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::setLifecycleFilter ( array  $lifecycle_filter)
Parameters
array$lifecycle_filter

Definition at line 147 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

148 {
149 $this->lifecycle_filter = $lifecycle_filter;
150 }

References $lifecycle_filter.

◆ setPoolId()

ilTestRandomQuestionSetStagingPoolQuestionList::setPoolId (   $pool_id)

Definition at line 99 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

100 {
101 $this->pool_id = $pool_id;
102 }

References $pool_id.

◆ setTestId()

ilTestRandomQuestionSetStagingPoolQuestionList::setTestId (   $test_id)

Definition at line 89 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

90 {
91 $this->test_id = $test_id;
92 }

References $test_id.

◆ setTestObjId()

ilTestRandomQuestionSetStagingPoolQuestionList::setTestObjId (   $test_obj_id)

Definition at line 79 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

80 {
81 $this->test_obj_id = $test_obj_id;
82 }

References $test_obj_id.

◆ setTypeFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::setTypeFilter (   $type_filter)

Definition at line 130 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

131 {
132 $this->type_filter = $type_filter;
133 }

References $type_filter.

◆ updateSourceQuestionPoolId()

static ilTestRandomQuestionSetStagingPoolQuestionList::updateSourceQuestionPoolId (   $test_id,
  $old_pool_id,
  $new_pool_id 
)
static

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

338 {
339 global $DIC;
340 $db = $DIC['ilDB'];
341
342 $query = "UPDATE tst_rnd_cpy SET qpl_fi = %s WHERE tst_fi = %s AND qpl_fi = %s";
343
345 $query,
346 ['integer', 'integer', 'integer'],
347 [$new_pool_id, $test_id, $old_pool_id]
348 );
349 }
manipulateF(string $query, array $types, array $values)
global $DIC
Definition: shib_login.php:26

References $db, $DIC, $test_id, and ilDBInterface\manipulateF().

Referenced by ilTestRandomQuestionSetConfigGUI\deriveNewPoolsCmd().

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

◆ valid()

ilTestRandomQuestionSetStagingPoolQuestionList::valid ( )

Definition at line 332 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

332 : bool
333 {
334 return key($this->questions) !== null;
335 }

References key().

+ Here is the call graph for this function:

Field Documentation

◆ $component_repository

ilComponentRepository ilTestRandomQuestionSetStagingPoolQuestionList::$component_repository
private

◆ $db

ilDBInterface ilTestRandomQuestionSetStagingPoolQuestionList::$db
private

◆ $lifecycle_filter

ilTestRandomQuestionSetStagingPoolQuestionList::$lifecycle_filter = []
private

◆ $pool_id

ilTestRandomQuestionSetStagingPoolQuestionList::$pool_id = -1
private

◆ $questions

ilTestRandomQuestionSetStagingPoolQuestionList::$questions = []
private

◆ $tax_filters

ilTestRandomQuestionSetStagingPoolQuestionList::$tax_filters = []
private

◆ $test_id

ilTestRandomQuestionSetStagingPoolQuestionList::$test_id = -1
private

◆ $test_obj_id

ilTestRandomQuestionSetStagingPoolQuestionList::$test_obj_id = -1
private

◆ $type_filter

ilTestRandomQuestionSetStagingPoolQuestionList::$type_filter = []
private

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