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

Public Member Functions

 __construct (ilDBInterface $db, ilComponentRepository $component_repository)
 
 setTestObjId ($testObjId)
 
 getTestObjId ()
 
 setTestId ($testId)
 
 getTestId ()
 
 setPoolId ($poolId)
 
 getPoolId ()
 
 addTaxonomyFilter ($taxId, $taxNodes)
 
 getTaxonomyFilters ()
 
 getTypeFilter ()
 
 setTypeFilter ($typeFilter)
 
 getLifecycleFilter ()
 
 setLifecycleFilter (array $lifecycleFilter)
 
 loadQuestions ()
 
 resetQuestionList ()
 
 getQuestions ()
 
 rewind ()
 
 current ()
 
 key ()
 
 next ()
 
 valid ()
 

Static Public Member Functions

static updateSourceQuestionPoolId ($testId, $oldPoolId, $newPoolId)
 

Private Member Functions

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

Private Attributes

ilDBInterface $db
 
ilComponentRepository $component_repository
 
 $testObjId = -1
 
 $testId = -1
 
 $poolId = -1
 
 $taxFilters = []
 
 $typeFilter = []
 
 $lifecycleFilter = []
 
 $questions = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ addTaxonomyFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::addTaxonomyFilter (   $taxId,
  $taxNodes 
)

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

110 {
111 $this->taxFilters[$taxId] = $taxNodes;
112 }

◆ current()

ilTestRandomQuestionSetStagingPoolQuestionList::current ( )

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

311 : ?int
312 {
313 $current = current($this->questions);
314 return $current !== false ? $current : null;
315 }

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 188 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

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

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

+ Here is the call graph for this function:

◆ getLifecycleFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::getLifecycleFilter ( )

◆ getLifecycleFilterExpressions()

ilTestRandomQuestionSetStagingPoolQuestionList::getLifecycleFilterExpressions ( )
private

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

237 : array
238 {
239 if (count($this->lifecycleFilter)) {
240 return [
241 $this->db->in('lifecycle', $this->lifecycleFilter, false, 'text')
242 ];
243 }
244
245 return [];
246 }

Referenced by getConditionalExpression().

+ Here is the caller graph for this function:

◆ getPoolId()

ilTestRandomQuestionSetStagingPoolQuestionList::getPoolId ( )

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

References $poolId.

Referenced by loadQuestions().

+ Here is the caller graph for this function:

◆ getQuestions()

ilTestRandomQuestionSetStagingPoolQuestionList::getQuestions ( )

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

299 : array
300 {
301 return array_values($this->questions);
302 }

◆ getTaxonomyFilterExpressions()

ilTestRandomQuestionSetStagingPoolQuestionList::getTaxonomyFilterExpressions ( )
private

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

203 : array
204 {
205 $expressions = [];
206
207 foreach ($this->getTaxonomyFilters() as $taxId => $tax_nodes) {
208 $questionIds = [];
209
210 $forceBypass = true;
211
212 foreach ($tax_nodes as $taxNode) {
213 $forceBypass = false;
214
215 $taxTree = new ilTaxonomyTree($taxId);
216
217 $taxNodeAssignment = new ilTaxNodeAssignment('tst', $this->getTestObjId(), 'quest', $taxId);
218
219 $subNodes = $taxTree->getSubTreeIds((int) $taxNode);
220 $subNodes[] = $taxNode;
221
222 $taxItems = $taxNodeAssignment->getAssignmentsOfNode($subNodes);
223
224 foreach ($taxItems as $taxItem) {
225 $questionIds[$taxItem['item_id']] = $taxItem['item_id'];
226 }
227 }
228
229 if (!$forceBypass) {
230 $expressions[] = $this->db->in('question_id', $questionIds, false, 'integer');
231 }
232 }
233
234 return $expressions;
235 }
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 114 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

References $taxFilters.

Referenced by getTaxonomyFilterExpressions().

+ Here is the caller graph for this function:

◆ getTestId()

ilTestRandomQuestionSetStagingPoolQuestionList::getTestId ( )

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

References $testId.

Referenced by loadQuestions().

+ Here is the caller graph for this function:

◆ getTestObjId()

ilTestRandomQuestionSetStagingPoolQuestionList::getTestObjId ( )

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

References $testObjId.

Referenced by getTaxonomyFilterExpressions().

+ Here is the caller graph for this function:

◆ getTypeFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::getTypeFilter ( )

◆ getTypeFilterExpressions()

ilTestRandomQuestionSetStagingPoolQuestionList::getTypeFilterExpressions ( )
private

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

249 : array
250 {
251 if (count($this->typeFilter)) {
252 return [
253 $this->db->in('question_type_fi', $this->typeFilter, false, 'integer')
254 ];
255 }
256
257 return [];
258 }

Referenced by getConditionalExpression().

+ Here is the caller graph for this function:

◆ isActiveQuestionType()

ilTestRandomQuestionSetStagingPoolQuestionList::isActiveQuestionType ( array  $questionData)
private

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

261 : bool
262 {
263 if (!isset($questionData['plugin'])) {
264 return false;
265 }
266
267 if (!$questionData['plugin']) {
268 return true;
269 }
270
271 if (!$this->component_repository->getComponentByTypeAndName(
273 'TestQuestionPool'
274 )->getPluginSlotById('qst')->hasPluginName($questionData['plugin_name'])) {
275 return false;
276 }
277
278 return $this->component_repository
279 ->getComponentByTypeAndName(
281 'TestQuestionPool'
282 )
283 ->getPluginSlotById(
284 'qst'
285 )
286 ->getPluginByName(
287 $questionData['plugin_name']
288 )->isActive();
289 }

References ilComponentInfo\TYPE_COMPONENT.

Referenced by loadQuestions().

+ Here is the caller graph for this function:

◆ key()

ilTestRandomQuestionSetStagingPoolQuestionList::key ( )

Definition at line 317 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 147 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

148 {
149 $query = "
150 SELECT qpl_questions.question_id,
151 qpl_qst_type.type_tag,
152 qpl_qst_type.plugin,
153 qpl_qst_type.plugin_name
154
155 FROM tst_rnd_cpy
156
157 INNER JOIN qpl_questions
158 ON qpl_questions.question_id = tst_rnd_cpy.qst_fi
159
160 INNER JOIN qpl_qst_type
161 ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi
162
163 WHERE tst_rnd_cpy.tst_fi = %s
164 AND tst_rnd_cpy.qpl_fi = %s
165
166 {$this->getConditionalExpression()}
167 ";
168
169 $res = $this->db->queryF(
170 $query,
171 ['integer', 'integer'],
172 [$this->getTestId(), $this->getPoolId()]
173 );
174
175 //echo sprintf($query, $this->getTestId(), $this->getPoolId());exit;
176
177 while ($row = $this->db->fetchAssoc($res)) {
179
180 if (!$this->isActiveQuestionType($row)) {
181 continue;
182 }
183
184 $this->questions[] = (int) $row['question_id'];
185 }
186 }
static completeMissingPluginName(array $question_type_data)
$res
Definition: ltiservices.php:69

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 322 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 291 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

292 {
293 $this->questions = [];
294 $this->taxFilters = [];
295 $this->typeFilter = [];
296 $this->poolId = -1;
297 }

◆ rewind()

ilTestRandomQuestionSetStagingPoolQuestionList::rewind ( )

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

306 : void
307 {
308 reset($this->questions);
309 }

◆ setLifecycleFilter()

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

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

143 {
144 $this->lifecycleFilter = $lifecycleFilter;
145 }

References $lifecycleFilter.

◆ setPoolId()

ilTestRandomQuestionSetStagingPoolQuestionList::setPoolId (   $poolId)

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

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

References $poolId.

◆ setTestId()

ilTestRandomQuestionSetStagingPoolQuestionList::setTestId (   $testId)

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

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

References $testId.

◆ setTestObjId()

ilTestRandomQuestionSetStagingPoolQuestionList::setTestObjId (   $testObjId)

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

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

References $testObjId.

◆ setTypeFilter()

ilTestRandomQuestionSetStagingPoolQuestionList::setTypeFilter (   $typeFilter)

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

126 {
127 $this->typeFilter = $typeFilter;
128 }

References $typeFilter.

◆ updateSourceQuestionPoolId()

static ilTestRandomQuestionSetStagingPoolQuestionList::updateSourceQuestionPoolId (   $testId,
  $oldPoolId,
  $newPoolId 
)
static

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

333 {
334 global $DIC;
335 $db = $DIC['ilDB'];
336
337 $query = "UPDATE tst_rnd_cpy SET qpl_fi = %s WHERE tst_fi = %s AND qpl_fi = %s";
338
340 $query,
341 ['integer', 'integer', 'integer'],
342 [$newPoolId, $testId, $oldPoolId]
343 );
344 }
manipulateF(string $query, array $types, array $values)
global $DIC
Definition: shib_login.php:26

References $db, $DIC, $testId, 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 327 of file class.ilTestRandomQuestionSetStagingPoolQuestionList.php.

327 : bool
328 {
329 return key($this->questions) !== null;
330 }

References key().

+ Here is the call graph for this function:

Field Documentation

◆ $component_repository

ilComponentRepository ilTestRandomQuestionSetStagingPoolQuestionList::$component_repository
private

◆ $db

ilDBInterface ilTestRandomQuestionSetStagingPoolQuestionList::$db
private

◆ $lifecycleFilter

ilTestRandomQuestionSetStagingPoolQuestionList::$lifecycleFilter = []
private

◆ $poolId

ilTestRandomQuestionSetStagingPoolQuestionList::$poolId = -1
private

◆ $questions

ilTestRandomQuestionSetStagingPoolQuestionList::$questions = []
private

◆ $taxFilters

ilTestRandomQuestionSetStagingPoolQuestionList::$taxFilters = []
private

◆ $testId

ilTestRandomQuestionSetStagingPoolQuestionList::$testId = -1
private

◆ $testObjId

ilTestRandomQuestionSetStagingPoolQuestionList::$testObjId = -1
private

◆ $typeFilter

ilTestRandomQuestionSetStagingPoolQuestionList::$typeFilter = []
private

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