ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssQuestionList Class Reference
+ Inheritance diagram for ilAssQuestionList:
+ Collaboration diagram for ilAssQuestionList:

Public Member Functions

 __construct (ilDBInterface $db, ilLanguage $lng, Refinery $refinery, ilComponentRepository $component_repository)
 
 getParentObjId ()
 
 setParentObjId ($parentObjId)
 
 getParentObjectType ()
 
 setParentObjectType ($parentObjType)
 
 getParentObjIdsFilter ()
 
 setParentObjIdsFilter ($parentObjIdsFilter)
 
 setQuestionInstanceTypeFilter ($questionInstanceTypeFilter)
 
 getQuestionInstanceTypeFilter ()
 
 setIncludeQuestionIdsFilter ($questionIdsFilter)
 
 getIncludeQuestionIdsFilter ()
 
 getExcludeQuestionIdsFilter ()
 
 setExcludeQuestionIdsFilter ($excludeQuestionIdsFilter)
 
 getQuestionCompletionStatusFilter ()
 
 setQuestionCompletionStatusFilter ($questionCompletionStatusFilter)
 
 addFieldFilter ($fieldName, $fieldValue)
 
 addTaxonomyFilter ($taxId, $taxNodes, $parentObjId, $parentObjType)
 
 setAvailableTaxonomyIds ($availableTaxonomyIds)
 
 getAvailableTaxonomyIds ()
 
 setAnswerStatusActiveId ($answerStatusActiveId)
 
 getAnswerStatusActiveId ()
 
 setAnswerStatusFilter ($answerStatusFilter)
 
 getAnswerStatusFilter ()
 
 setJoinObjectData ($a_val)
 Set if object data table should be joined. More...
 
 getJoinObjectData ()
 Get if object data table should be joined. More...
 
 setForcedQuestionIds ($forcedQuestionIds)
 
 getForcedQuestionIds ()
 
 load ()
 
 getDataArrayForQuestionId ($questionId)
 
 getQuestionDataArray ()
 
 isInList ($questionId)
 
 getTitle (string $a_comp_id, string $a_item_type, int $a_item_id)
 Get title of an assigned item. More...
 

Data Fields

const QUESTION_ANSWER_STATUS_NON_ANSWERED = 'nonAnswered'
 answer status domain for single questions More...
 
const QUESTION_ANSWER_STATUS_WRONG_ANSWERED = 'wrongAnswered'
 
const QUESTION_ANSWER_STATUS_CORRECT_ANSWERED = 'correctAnswered'
 
const ANSWER_STATUS_FILTER_ALL_NON_CORRECT = 'allNonCorrect'
 answer status filter value domain More...
 
const ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY = 'nonAnswered'
 
const ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY = 'wrongAnswered'
 
const QUESTION_INSTANCE_TYPE_ORIGINALS = 'QST_INSTANCE_TYPE_ORIGINALS'
 
const QUESTION_INSTANCE_TYPE_DUPLICATES = 'QST_INSTANCE_TYPE_DUPLICATES'
 
const QUESTION_INSTANCE_TYPE_ALL = 'QST_INSTANCE_TYPE_ALL'
 
const QUESTION_COMPLETION_STATUS_COMPLETE = 'complete'
 
const QUESTION_COMPLETION_STATUS_INCOMPLETE = 'incomplete'
 
const QUESTION_COMPLETION_STATUS_BOTH = 'complete/incomplete'
 

Protected Member Functions

 getTaxItems ($parentType, $parentObjId, $taxId, $taxNode)
 

Protected Attributes

 $join_obj_data = true
 
 $questions = array()
 

Private Member Functions

 getParentObjFilterExpression ()
 
 getFieldFilterExpressions ()
 
 getTaxonomyFilterExpressions ()
 
 getQuestionInstanceTypeFilterExpression ()
 
 getQuestionIdsFilterExpressions ()
 
 getParentObjectIdFilterExpression ()
 
 getAnswerStatusFilterExpressions ()
 
 getTableJoinExpression ()
 
 getConditionalFilterExpression ()
 
 getSelectFieldsExpression ()
 
 buildBasicQuery ()
 
 buildQuery ()
 
 loadTaxonomyAssignmentData ($parentObjId, $questionId)
 
 isActiveQuestionType (array $questionData)
 
 checkFilters ()
 

Private Attributes

ilDBInterface $db
 
ilLanguage $lng
 
Refinery $refinery
 
ilComponentRepository $component_repository
 
 $parentObjIdsFilter = array()
 
 $parentObjId = null
 
 $parentObjType = 'qpl'
 
 $availableTaxonomyIds = array()
 
 $fieldFilters = array()
 
 $taxFilters = array()
 
 $taxParentIds = array()
 
 $taxParentTypes = array()
 
 $answerStatusActiveId = null
 
 $forcedQuestionIds = array()
 
 $answerStatusFilter = null
 
 $questionInstanceTypeFilter = self::QUESTION_INSTANCE_TYPE_ORIGINALS
 
 $includeQuestionIdsFilter = null
 
 $excludeQuestionIdsFilter = null
 
 $questionCompletionStatusFilter = self::QUESTION_COMPLETION_STATUS_BOTH
 

Detailed Description

Definition at line 27 of file class.ilAssQuestionList.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionList::__construct ( ilDBInterface  $db,
ilLanguage  $lng,
Refinery  $refinery,
ilComponentRepository  $component_repository 
)

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

References $component_repository, $db, $lng, $refinery, ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

155  {
156  $this->db = $db;
157  $this->lng = $lng;
158  $this->refinery = $refinery;
159  $this->component_repository = $component_repository;
160  }
ilComponentRepository $component_repository
+ Here is the call graph for this function:

Member Function Documentation

◆ addFieldFilter()

ilAssQuestionList::addFieldFilter (   $fieldName,
  $fieldValue 
)

Definition at line 238 of file class.ilAssQuestionList.php.

238  : void
239  {
240  $this->fieldFilters[$fieldName] = $fieldValue;
241  }

◆ addTaxonomyFilter()

ilAssQuestionList::addTaxonomyFilter (   $taxId,
  $taxNodes,
  $parentObjId,
  $parentObjType 
)

Definition at line 243 of file class.ilAssQuestionList.php.

References $parentObjId, and $parentObjType.

243  : void
244  {
245  $this->taxFilters[$taxId] = $taxNodes;
246  $this->taxParentIds[$taxId] = $parentObjId;
247  $this->taxParentTypes[$taxId] = $parentObjType;
248  }

◆ buildBasicQuery()

ilAssQuestionList::buildBasicQuery ( )
private

Definition at line 608 of file class.ilAssQuestionList.php.

Referenced by buildQuery().

608  : string
609  {
610  return "
611  {$this->getSelectFieldsExpression()}
612 
613  FROM qpl_questions
614 
615  {$this->getTableJoinExpression()}
616 
617  WHERE qpl_questions.tstamp > 0
618  ";
619  }
+ Here is the caller graph for this function:

◆ buildQuery()

ilAssQuestionList::buildQuery ( )
private

Definition at line 621 of file class.ilAssQuestionList.php.

References $query, buildBasicQuery(), and getForcedQuestionIds().

Referenced by load().

621  : string
622  {
623  $query = $this->buildBasicQuery() . "
624  {$this->getConditionalFilterExpression()}
625  ";
626 
627  if (count($this->getForcedQuestionIds())) {
628  $query .= "
629  UNION {$this->buildBasicQuery()}
630  AND {$this->db->in('qpl_questions.question_id', $this->getForcedQuestionIds(), false, 'integer')}
631  ";
632  }
633 
634  return $query;
635  }
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkFilters()

ilAssQuestionList::checkFilters ( )
private

Definition at line 761 of file class.ilAssQuestionList.php.

References getAnswerStatusActiveId(), and getAnswerStatusFilter().

Referenced by load().

761  : void
762  {
763  if (strlen($this->getAnswerStatusFilter()) && !$this->getAnswerStatusActiveId()) {
764  require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
765 
766  throw new ilTestQuestionPoolException(
767  'No active id given! You cannot use the answer status filter without giving an active id.'
768  );
769  }
770  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswerStatusActiveId()

ilAssQuestionList::getAnswerStatusActiveId ( )

Definition at line 265 of file class.ilAssQuestionList.php.

References $answerStatusActiveId.

Referenced by checkFilters(), getSelectFieldsExpression(), and getTableJoinExpression().

265  : ?int
266  {
268  }
+ Here is the caller graph for this function:

◆ getAnswerStatusFilter()

ilAssQuestionList::getAnswerStatusFilter ( )

Definition at line 275 of file class.ilAssQuestionList.php.

References $answerStatusFilter.

Referenced by checkFilters(), and getAnswerStatusFilterExpressions().

275  : ?string
276  {
278  }
+ Here is the caller graph for this function:

◆ getAnswerStatusFilterExpressions()

ilAssQuestionList::getAnswerStatusFilterExpressions ( )
private

Definition at line 488 of file class.ilAssQuestionList.php.

References getAnswerStatusFilter().

Referenced by getConditionalFilterExpression().

488  : array
489  {
490  $expressions = array();
491 
492  switch ($this->getAnswerStatusFilter()) {
493  case self::ANSWER_STATUS_FILTER_ALL_NON_CORRECT:
494 
495  $expressions[] = '
496  (tst_test_result.question_fi IS NULL OR tst_test_result.points < qpl_questions.points)
497  ';
498  break;
499 
500  case self::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY:
501 
502  $expressions[] = 'tst_test_result.question_fi IS NULL';
503  break;
504 
505  case self::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY:
506 
507  $expressions[] = 'tst_test_result.question_fi IS NOT NULL';
508  $expressions[] = 'tst_test_result.points < qpl_questions.points';
509  break;
510  }
511 
512  return $expressions;
513  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableTaxonomyIds()

ilAssQuestionList::getAvailableTaxonomyIds ( )

Definition at line 255 of file class.ilAssQuestionList.php.

References $availableTaxonomyIds.

Referenced by loadTaxonomyAssignmentData().

255  : array
256  {
258  }
+ Here is the caller graph for this function:

◆ getConditionalFilterExpression()

ilAssQuestionList::getConditionalFilterExpression ( )
private

Definition at line 548 of file class.ilAssQuestionList.php.

References getAnswerStatusFilterExpressions(), getFieldFilterExpressions(), getParentObjectIdFilterExpression(), getParentObjFilterExpression(), getQuestionIdsFilterExpressions(), getQuestionInstanceTypeFilterExpression(), and getTaxonomyFilterExpressions().

548  : string
549  {
550  $CONDITIONS = array();
551 
552  if ($this->getQuestionInstanceTypeFilterExpression() !== null) {
553  $CONDITIONS[] = $this->getQuestionInstanceTypeFilterExpression();
554  }
555 
556  if ($this->getParentObjFilterExpression() !== null) {
557  $CONDITIONS[] = $this->getParentObjFilterExpression();
558  }
559 
560  if ($this->getParentObjectIdFilterExpression() !== null) {
561  $CONDITIONS[] = $this->getParentObjectIdFilterExpression();
562  }
563 
564  $CONDITIONS = array_merge(
565  $CONDITIONS,
567  $this->getFieldFilterExpressions(),
570  );
571 
572  $CONDITIONS = implode(' AND ', $CONDITIONS);
573 
574  return strlen($CONDITIONS) ? 'AND ' . $CONDITIONS : '';
575  }
+ Here is the call graph for this function:

◆ getDataArrayForQuestionId()

ilAssQuestionList::getDataArrayForQuestionId (   $questionId)

Definition at line 724 of file class.ilAssQuestionList.php.

725  {
726  return $this->questions[$questionId];
727  }

◆ getExcludeQuestionIdsFilter()

ilAssQuestionList::getExcludeQuestionIdsFilter ( )

Definition at line 218 of file class.ilAssQuestionList.php.

References $excludeQuestionIdsFilter.

Referenced by getQuestionIdsFilterExpressions().

+ Here is the caller graph for this function:

◆ getFieldFilterExpressions()

ilAssQuestionList::getFieldFilterExpressions ( )
private

Definition at line 329 of file class.ilAssQuestionList.php.

Referenced by getConditionalFilterExpression().

329  : array
330  {
331  $expressions = array();
332 
333  foreach ($this->fieldFilters as $fieldName => $fieldValue) {
334  switch ($fieldName) {
335  case 'title':
336  case 'description':
337  case 'author':
338  case 'lifecycle':
339 
340  $expressions[] = $this->db->like('qpl_questions.' . $fieldName, 'text', "%%$fieldValue%%");
341  break;
342 
343  case 'type':
344 
345  $expressions[] = "qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
346  break;
347 
348  case 'question_id':
349  if ($fieldValue != "" && !is_array($fieldValue)) {
350  $fieldValue = array($fieldValue);
351  }
352  $expressions[] = $this->db->in("qpl_questions.question_id", $fieldValue, false, "integer");
353  break;
354 
355  case 'parent_title':
356  if ($this->join_obj_data) {
357  $expressions[] = $this->db->like('object_data.title', 'text', "%%$fieldValue%%");
358  }
359  break;
360  }
361  }
362 
363  return $expressions;
364  }
+ Here is the caller graph for this function:

◆ getForcedQuestionIds()

ilAssQuestionList::getForcedQuestionIds ( )
Returns
array

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

References $forcedQuestionIds.

Referenced by buildQuery().

311  : array
312  {
314  }
+ Here is the caller graph for this function:

◆ getIncludeQuestionIdsFilter()

ilAssQuestionList::getIncludeQuestionIdsFilter ( )

Definition at line 213 of file class.ilAssQuestionList.php.

References $includeQuestionIdsFilter.

Referenced by getQuestionIdsFilterExpressions().

+ Here is the caller graph for this function:

◆ getJoinObjectData()

ilAssQuestionList::getJoinObjectData ( )

Get if object data table should be joined.

Returns
bool join object_data

Definition at line 295 of file class.ilAssQuestionList.php.

References $join_obj_data.

295  : bool
296  {
297  return $this->join_obj_data;
298  }

◆ getParentObjectIdFilterExpression()

ilAssQuestionList::getParentObjectIdFilterExpression ( )
private

Definition at line 479 of file class.ilAssQuestionList.php.

Referenced by getConditionalFilterExpression().

479  : ?string
480  {
481  if ($this->parentObjId) {
482  return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
483  }
484 
485  return null;
486  }
+ Here is the caller graph for this function:

◆ getParentObjectType()

ilAssQuestionList::getParentObjectType ( )

Definition at line 172 of file class.ilAssQuestionList.php.

References $parentObjType.

Referenced by getTableJoinExpression().

172  : string
173  {
174  return $this->parentObjType;
175  }
+ Here is the caller graph for this function:

◆ getParentObjFilterExpression()

ilAssQuestionList::getParentObjFilterExpression ( )
private

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

References getParentObjId(), and getParentObjIdsFilter().

Referenced by getConditionalFilterExpression().

316  : ?string
317  {
318  if ($this->getParentObjId()) {
319  return 'qpl_questions.obj_fi = ' . $this->db->quote($this->getParentObjId(), 'integer');
320  }
321 
322  if (count($this->getParentObjIdsFilter())) {
323  return $this->db->in('qpl_questions.obj_fi', $this->getParentObjIdsFilter(), false, 'integer');
324  }
325 
326  return null;
327  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObjId()

ilAssQuestionList::getParentObjId ( )

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

References $parentObjId.

Referenced by getParentObjFilterExpression(), and ilTestSkillEvaluation\init().

162  : ?int
163  {
164  return $this->parentObjId;
165  }
+ Here is the caller graph for this function:

◆ getParentObjIdsFilter()

ilAssQuestionList::getParentObjIdsFilter ( )
Returns
array

Definition at line 185 of file class.ilAssQuestionList.php.

References $parentObjIdsFilter.

Referenced by getParentObjFilterExpression().

185  : array
186  {
188  }
+ Here is the caller graph for this function:

◆ getQuestionCompletionStatusFilter()

ilAssQuestionList::getQuestionCompletionStatusFilter ( )

Definition at line 228 of file class.ilAssQuestionList.php.

References $questionCompletionStatusFilter.

228  : string
229  {
231  }

◆ getQuestionDataArray()

ilAssQuestionList::getQuestionDataArray ( )

◆ getQuestionIdsFilterExpressions()

ilAssQuestionList::getQuestionIdsFilterExpressions ( )
private

Definition at line 448 of file class.ilAssQuestionList.php.

References getExcludeQuestionIdsFilter(), and getIncludeQuestionIdsFilter().

Referenced by getConditionalFilterExpression().

448  : array
449  {
450  $expressions = array();
451 
452  if (is_array($this->getIncludeQuestionIdsFilter())) {
453  $expressions[] = $this->db->in(
454  'qpl_questions.question_id',
456  false,
457  'integer'
458  );
459  }
460 
461  if (is_array($this->getExcludeQuestionIdsFilter())) {
462  $IN = $this->db->in(
463  'qpl_questions.question_id',
465  true,
466  'integer'
467  );
468 
469  if ($IN == ' 1=2 ') {
470  $IN = ' 1=1 ';
471  } // required for ILIAS < 5.0
472 
473  $expressions[] = $IN;
474  }
475 
476  return $expressions;
477  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionInstanceTypeFilter()

ilAssQuestionList::getQuestionInstanceTypeFilter ( )

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

References $questionInstanceTypeFilter.

Referenced by getQuestionInstanceTypeFilterExpression(), and getTableJoinExpression().

+ Here is the caller graph for this function:

◆ getQuestionInstanceTypeFilterExpression()

ilAssQuestionList::getQuestionInstanceTypeFilterExpression ( )
private

Definition at line 433 of file class.ilAssQuestionList.php.

References getQuestionInstanceTypeFilter().

Referenced by getConditionalFilterExpression().

433  : ?string
434  {
435  switch ($this->getQuestionInstanceTypeFilter()) {
436  case self::QUESTION_INSTANCE_TYPE_ORIGINALS:
437  return 'qpl_questions.original_id IS NULL';
438  case self::QUESTION_INSTANCE_TYPE_DUPLICATES:
439  return 'qpl_questions.original_id IS NOT NULL';
440  case self::QUESTION_INSTANCE_TYPE_ALL:
441  default:
442  return null;
443  }
444 
445  return null;
446  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectFieldsExpression()

ilAssQuestionList::getSelectFieldsExpression ( )
private

Definition at line 577 of file class.ilAssQuestionList.php.

References getAnswerStatusActiveId().

577  : string
578  {
579  $selectFields = array(
580  'qpl_questions.*',
581  'qpl_qst_type.type_tag',
582  'qpl_qst_type.plugin',
583  'qpl_qst_type.plugin_name',
584  'qpl_questions.points max_points'
585  );
586 
587  if ($this->join_obj_data) {
588  $selectFields[] = 'object_data.title parent_title';
589  }
590 
591  if ($this->getAnswerStatusActiveId()) {
592  $selectFields[] = 'tst_test_result.points reached_points';
593  $selectFields[] = "CASE
594  WHEN tst_test_result.points IS NULL THEN '" . self::QUESTION_ANSWER_STATUS_NON_ANSWERED . "'
595  WHEN tst_test_result.points < qpl_questions.points THEN '" . self::QUESTION_ANSWER_STATUS_WRONG_ANSWERED . "'
596  ELSE '" . self::QUESTION_ANSWER_STATUS_CORRECT_ANSWERED . "'
597  END question_answer_status
598  ";
599  }
600 
601  $selectFields = implode(",\n\t\t\t\t", $selectFields);
602 
603  return "
604  SELECT {$selectFields}
605  ";
606  }
+ Here is the call graph for this function:

◆ getTableJoinExpression()

ilAssQuestionList::getTableJoinExpression ( )
private

Definition at line 515 of file class.ilAssQuestionList.php.

References getAnswerStatusActiveId(), getParentObjectType(), and getQuestionInstanceTypeFilter().

515  : string
516  {
517  $tableJoin = "
518  INNER JOIN qpl_qst_type
519  ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi
520  ";
521 
522  if ($this->join_obj_data) {
523  $tableJoin .= "
524  INNER JOIN object_data
525  ON object_data.obj_id = qpl_questions.obj_fi
526  ";
527  }
528 
529  if ($this->getParentObjectType() === 'tst'
530  && $this->getQuestionInstanceTypeFilter() === self::QUESTION_INSTANCE_TYPE_ALL) {
531  $tableJoin .= "
532  INNER JOIN tst_test_question tstquest
533  ON tstquest.question_fi = qpl_questions.question_id
534  ";
535  }
536 
537  if ($this->getAnswerStatusActiveId()) {
538  $tableJoin .= "
539  LEFT JOIN tst_test_result
540  ON tst_test_result.question_fi = qpl_questions.question_id
541  AND tst_test_result.active_fi = {$this->db->quote($this->getAnswerStatusActiveId(), 'integer')}
542  ";
543  }
544 
545  return $tableJoin;
546  }
+ Here is the call graph for this function:

◆ getTaxItems()

ilAssQuestionList::getTaxItems (   $parentType,
  $parentObjId,
  $taxId,
  $taxNode 
)
protected
Parameters
string$parentType
int$parentObjId
int$taxId
int$taxNode
Returns
array

Definition at line 416 of file class.ilAssQuestionList.php.

References $parentObjId.

Referenced by getTaxonomyFilterExpressions().

416  : array
417  {
418  $taxTree = new ilTaxonomyTree($taxId);
419 
420  $taxNodeAssignment = new ilTaxNodeAssignment(
421  $parentType,
422  $parentObjId,
423  'quest',
424  $taxId
425  );
426 
427  $subNodes = $taxTree->getSubTreeIds($taxNode);
428  $subNodes[] = $taxNode;
429 
430  return $taxNodeAssignment->getAssignmentsOfNode($subNodes);
431  }
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...
+ Here is the caller graph for this function:

◆ getTaxonomyFilterExpressions()

ilAssQuestionList::getTaxonomyFilterExpressions ( )
private

Definition at line 366 of file class.ilAssQuestionList.php.

References getTaxItems().

Referenced by getConditionalFilterExpression().

366  : array
367  {
368  $expressions = array();
369 
370  require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
371  require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
372 
373  foreach ($this->taxFilters as $taxId => $taxNodes) {
374  $questionIds = array();
375 
376  $forceBypass = true;
377 
378  foreach ($taxNodes as $taxNode) {
379  $forceBypass = false;
380 
381  $taxItemsByTaxParent = $this->getTaxItems(
382  $this->taxParentTypes[$taxId],
383  $this->taxParentIds[$taxId],
384  $taxId,
385  $taxNode
386  );
387 
388  $taxItemsByParent = $this->getTaxItems(
389  $this->parentObjType,
390  $this->parentObjId,
391  $taxId,
392  $taxNode
393  );
394 
395  $taxItems = array_merge($taxItemsByTaxParent, $taxItemsByParent);
396  foreach ($taxItems as $taxItem) {
397  $questionIds[$taxItem['item_id']] = $taxItem['item_id'];
398  }
399  }
400 
401  if (!$forceBypass) {
402  $expressions[] = $this->db->in('question_id', $questionIds, false, 'integer');
403  }
404  }
405 
406  return $expressions;
407  }
getTaxItems($parentType, $parentObjId, $taxId, $taxNode)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilAssQuestionList::getTitle ( string  $a_comp_id,
string  $a_item_type,
int  $a_item_id 
)

Get title of an assigned item.

(is used from ilObjTaxonomyGUI when item sorting is activated)

Parameters
string$a_comp_id('qpl' in our context)
string$a_item_type('quest' in our context)
integer$a_item_id(questionId in our context)

Implements ilTaxAssignedItemInfo.

Definition at line 748 of file class.ilAssQuestionList.php.

748  : string
749  {
750  if ($a_comp_id != 'qpl' || $a_item_type != 'quest' || !$a_item_id) {
751  return '';
752  }
753 
754  if (!isset($this->questions[$a_item_id])) {
755  return '';
756  }
757 
758  return $this->questions[$a_item_id]['title'];
759  }

◆ isActiveQuestionType()

ilAssQuestionList::isActiveQuestionType ( array  $questionData)
private

Definition at line 694 of file class.ilAssQuestionList.php.

References ilComponentInfo\TYPE_MODULES.

Referenced by load().

694  : bool
695  {
696  if (!isset($questionData['plugin'])) {
697  return false;
698  }
699 
700  if (!$questionData['plugin']) {
701  return true;
702  }
703 
704  if (!$this->component_repository->getComponentByTypeAndName(
706  'TestQuestionPool'
707  )->getPluginSlotById('qst')->hasPluginName($questionData['plugin_name'])) {
708  return false;
709  }
710 
711  return $this->component_repository
712  ->getComponentByTypeAndName(
714  'TestQuestionPool'
715  )
716  ->getPluginSlotById(
717  'qst'
718  )
719  ->getPluginByName(
720  $questionData['plugin_name']
721  )->isActive();
722  }
+ Here is the caller graph for this function:

◆ isInList()

ilAssQuestionList::isInList (   $questionId)

Definition at line 734 of file class.ilAssQuestionList.php.

734  : bool
735  {
736  return isset($this->questions[$questionId]);
737  }

◆ load()

ilAssQuestionList::load ( )

Definition at line 637 of file class.ilAssQuestionList.php.

References $query, $res, buildQuery(), checkFilters(), ilAssQuestionType\completeMissingPluginName(), isActiveQuestionType(), ILIAS\Repository\lng(), loadTaxonomyAssignmentData(), and ILIAS\Repository\refinery().

637  : void
638  {
639  $this->checkFilters();
640 
641  $tags_trafo = $this->refinery->string()->stripTags();
642 
643  $query = $this->buildQuery();
644 
645  $res = $this->db->query($query);
646 
647  while ($row = $this->db->fetchAssoc($res)) {
649 
650  if (!$this->isActiveQuestionType($row)) {
651  continue;
652  }
653 
654  $row['title'] = $tags_trafo->transform($row['title'] ?? '&nbsp;');
655  $row['description'] = $tags_trafo->transform($row['description'] !== '' && $row['description'] !== null ? $row['description'] : '&nbsp;');
656  $row['author'] = $tags_trafo->transform($row['author']);
657  $row['taxonomies'] = $this->loadTaxonomyAssignmentData($row['obj_fi'], $row['question_id']);
658  $row['ttype'] = $this->lng->txt($row['type_tag']);
659 
660  $this->questions[ $row['question_id'] ] = $row;
661  }
662  }
$res
Definition: ltiservices.php:69
isActiveQuestionType(array $questionData)
static completeMissingPluginName($questionTypeData)
$query
loadTaxonomyAssignmentData($parentObjId, $questionId)
+ Here is the call graph for this function:

◆ loadTaxonomyAssignmentData()

ilAssQuestionList::loadTaxonomyAssignmentData (   $parentObjId,
  $questionId 
)
private

Definition at line 664 of file class.ilAssQuestionList.php.

References $parentObjId, and getAvailableTaxonomyIds().

Referenced by load().

664  : array
665  {
666  $taxAssignmentData = array();
667 
668  foreach ($this->getAvailableTaxonomyIds() as $taxId) {
669  require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
670  require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
671 
672  $taxTree = new ilTaxonomyTree($taxId);
673 
674  $taxAssignment = new ilTaxNodeAssignment('qpl', $parentObjId, 'quest', $taxId);
675 
676  $assignments = $taxAssignment->getAssignmentsOfItem($questionId);
677 
678  foreach ($assignments as $assData) {
679  if (!isset($taxAssignmentData[ $assData['tax_id'] ])) {
680  $taxAssignmentData[ $assData['tax_id'] ] = array();
681  }
682 
683  $nodeData = $taxTree->getNodeData($assData['node_id']);
684 
685  $assData['node_lft'] = $nodeData['lft'];
686 
687  $taxAssignmentData[ $assData['tax_id'] ][ $assData['node_id'] ] = $assData;
688  }
689  }
690 
691  return $taxAssignmentData;
692  }
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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAnswerStatusActiveId()

ilAssQuestionList::setAnswerStatusActiveId (   $answerStatusActiveId)

Definition at line 260 of file class.ilAssQuestionList.php.

References $answerStatusActiveId.

260  : void
261  {
262  $this->answerStatusActiveId = $answerStatusActiveId;
263  }

◆ setAnswerStatusFilter()

ilAssQuestionList::setAnswerStatusFilter (   $answerStatusFilter)

Definition at line 270 of file class.ilAssQuestionList.php.

References $answerStatusFilter.

270  : void
271  {
272  $this->answerStatusFilter = $answerStatusFilter;
273  }

◆ setAvailableTaxonomyIds()

ilAssQuestionList::setAvailableTaxonomyIds (   $availableTaxonomyIds)

Definition at line 250 of file class.ilAssQuestionList.php.

References $availableTaxonomyIds.

250  : void
251  {
252  $this->availableTaxonomyIds = $availableTaxonomyIds;
253  }

◆ setExcludeQuestionIdsFilter()

ilAssQuestionList::setExcludeQuestionIdsFilter (   $excludeQuestionIdsFilter)

Definition at line 223 of file class.ilAssQuestionList.php.

References $excludeQuestionIdsFilter.

223  : void
224  {
225  $this->excludeQuestionIdsFilter = $excludeQuestionIdsFilter;
226  }

◆ setForcedQuestionIds()

ilAssQuestionList::setForcedQuestionIds (   $forcedQuestionIds)
Parameters
array$forcedQuestionIds

Definition at line 303 of file class.ilAssQuestionList.php.

References $forcedQuestionIds.

303  : void
304  {
305  $this->forcedQuestionIds = $forcedQuestionIds;
306  }

◆ setIncludeQuestionIdsFilter()

ilAssQuestionList::setIncludeQuestionIdsFilter (   $questionIdsFilter)

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

208  : void
209  {
210  $this->includeQuestionIdsFilter = $questionIdsFilter;
211  }

◆ setJoinObjectData()

ilAssQuestionList::setJoinObjectData (   $a_val)

Set if object data table should be joined.

Parameters
bool$a_valjoin object_data

Definition at line 285 of file class.ilAssQuestionList.php.

285  : void
286  {
287  $this->join_obj_data = $a_val;
288  }

◆ setParentObjectType()

ilAssQuestionList::setParentObjectType (   $parentObjType)

Definition at line 177 of file class.ilAssQuestionList.php.

References $parentObjType.

177  : void
178  {
179  $this->parentObjType = $parentObjType;
180  }

◆ setParentObjId()

ilAssQuestionList::setParentObjId (   $parentObjId)

Definition at line 167 of file class.ilAssQuestionList.php.

References $parentObjId.

Referenced by ilTestResultsGUI\executeCommand(), and ilCopySelfAssQuestionTableGUI\getQuestions().

167  : void
168  {
169  $this->parentObjId = $parentObjId;
170  }
+ Here is the caller graph for this function:

◆ setParentObjIdsFilter()

ilAssQuestionList::setParentObjIdsFilter (   $parentObjIdsFilter)
Parameters
array$parentObjIdsFilter

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

References $parentObjIdsFilter.

Referenced by ilAsqFactory\getQuestionDataArray(), and ilAsqFactory\getQuestionInstances().

193  : void
194  {
195  $this->parentObjIdsFilter = $parentObjIdsFilter;
196  }
+ Here is the caller graph for this function:

◆ setQuestionCompletionStatusFilter()

ilAssQuestionList::setQuestionCompletionStatusFilter (   $questionCompletionStatusFilter)

Definition at line 233 of file class.ilAssQuestionList.php.

References $questionCompletionStatusFilter.

233  : void
234  {
235  $this->questionCompletionStatusFilter = $questionCompletionStatusFilter;
236  }

◆ setQuestionInstanceTypeFilter()

ilAssQuestionList::setQuestionInstanceTypeFilter (   $questionInstanceTypeFilter)

Definition at line 198 of file class.ilAssQuestionList.php.

References $questionInstanceTypeFilter.

198  : void
199  {
200  $this->questionInstanceTypeFilter = $questionInstanceTypeFilter;
201  }

Field Documentation

◆ $answerStatusActiveId

ilAssQuestionList::$answerStatusActiveId = null
private

Definition at line 95 of file class.ilAssQuestionList.php.

Referenced by getAnswerStatusActiveId(), and setAnswerStatusActiveId().

◆ $answerStatusFilter

ilAssQuestionList::$answerStatusFilter = null
private

Definition at line 128 of file class.ilAssQuestionList.php.

Referenced by getAnswerStatusFilter(), and setAnswerStatusFilter().

◆ $availableTaxonomyIds

ilAssQuestionList::$availableTaxonomyIds = array()
private

Definition at line 60 of file class.ilAssQuestionList.php.

Referenced by getAvailableTaxonomyIds(), and setAvailableTaxonomyIds().

◆ $component_repository

ilComponentRepository ilAssQuestionList::$component_repository
private

Definition at line 32 of file class.ilAssQuestionList.php.

Referenced by __construct().

◆ $db

ilDBInterface ilAssQuestionList::$db
private

Definition at line 29 of file class.ilAssQuestionList.php.

Referenced by __construct().

◆ $excludeQuestionIdsFilter

ilAssQuestionList::$excludeQuestionIdsFilter = null
private

◆ $fieldFilters

ilAssQuestionList::$fieldFilters = array()
private

Definition at line 67 of file class.ilAssQuestionList.php.

◆ $forcedQuestionIds

ilAssQuestionList::$forcedQuestionIds = array()
private

Definition at line 100 of file class.ilAssQuestionList.php.

Referenced by getForcedQuestionIds(), and setForcedQuestionIds().

◆ $includeQuestionIdsFilter

ilAssQuestionList::$includeQuestionIdsFilter = null
private

Definition at line 135 of file class.ilAssQuestionList.php.

Referenced by getIncludeQuestionIdsFilter().

◆ $join_obj_data

ilAssQuestionList::$join_obj_data = true
protected

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

Referenced by getJoinObjectData().

◆ $lng

ilLanguage ilAssQuestionList::$lng
private

Definition at line 30 of file class.ilAssQuestionList.php.

Referenced by __construct().

◆ $parentObjId

ilAssQuestionList::$parentObjId = null
private

◆ $parentObjIdsFilter

ilAssQuestionList::$parentObjIdsFilter = array()
private

Definition at line 39 of file class.ilAssQuestionList.php.

Referenced by getParentObjIdsFilter(), and setParentObjIdsFilter().

◆ $parentObjType

ilAssQuestionList::$parentObjType = 'qpl'
private

◆ $questionCompletionStatusFilter

ilAssQuestionList::$questionCompletionStatusFilter = self::QUESTION_COMPLETION_STATUS_BOTH
private

◆ $questionInstanceTypeFilter

ilAssQuestionList::$questionInstanceTypeFilter = self::QUESTION_INSTANCE_TYPE_ORIGINALS
private

◆ $questions

ilAssQuestionList::$questions = array()
protected

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

Referenced by getQuestionDataArray().

◆ $refinery

Refinery ilAssQuestionList::$refinery
private

Definition at line 31 of file class.ilAssQuestionList.php.

Referenced by __construct().

◆ $taxFilters

ilAssQuestionList::$taxFilters = array()
private

Definition at line 74 of file class.ilAssQuestionList.php.

◆ $taxParentIds

ilAssQuestionList::$taxParentIds = array()
private

Definition at line 81 of file class.ilAssQuestionList.php.

◆ $taxParentTypes

ilAssQuestionList::$taxParentTypes = array()
private

Definition at line 88 of file class.ilAssQuestionList.php.

◆ ANSWER_STATUS_FILTER_ALL_NON_CORRECT

const ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT = 'allNonCorrect'

answer status filter value domain

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

Referenced by ilTestDynamicQuestionSetStatisticTableGUI\initFilter().

◆ ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY

const ilAssQuestionList::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY = 'nonAnswered'

◆ ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY

const ilAssQuestionList::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY = 'wrongAnswered'

◆ QUESTION_ANSWER_STATUS_CORRECT_ANSWERED

const ilAssQuestionList::QUESTION_ANSWER_STATUS_CORRECT_ANSWERED = 'correctAnswered'

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

◆ QUESTION_ANSWER_STATUS_NON_ANSWERED

const ilAssQuestionList::QUESTION_ANSWER_STATUS_NON_ANSWERED = 'nonAnswered'

answer status domain for single questions

Definition at line 112 of file class.ilAssQuestionList.php.

◆ QUESTION_ANSWER_STATUS_WRONG_ANSWERED

const ilAssQuestionList::QUESTION_ANSWER_STATUS_WRONG_ANSWERED = 'wrongAnswered'

Definition at line 113 of file class.ilAssQuestionList.php.

◆ QUESTION_COMPLETION_STATUS_BOTH

const ilAssQuestionList::QUESTION_COMPLETION_STATUS_BOTH = 'complete/incomplete'

Definition at line 140 of file class.ilAssQuestionList.php.

◆ QUESTION_COMPLETION_STATUS_COMPLETE

const ilAssQuestionList::QUESTION_COMPLETION_STATUS_COMPLETE = 'complete'

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

◆ QUESTION_COMPLETION_STATUS_INCOMPLETE

const ilAssQuestionList::QUESTION_COMPLETION_STATUS_INCOMPLETE = 'incomplete'

Definition at line 139 of file class.ilAssQuestionList.php.

◆ QUESTION_INSTANCE_TYPE_ALL

const ilAssQuestionList::QUESTION_INSTANCE_TYPE_ALL = 'QST_INSTANCE_TYPE_ALL'

◆ QUESTION_INSTANCE_TYPE_DUPLICATES

◆ QUESTION_INSTANCE_TYPE_ORIGINALS


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