ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssQuestionList Class Reference
+ Inheritance diagram for ilAssQuestionList:
+ Collaboration diagram for ilAssQuestionList:

Public Member Functions

 __construct (ilDBInterface $db, ilLanguage $lng, ilPluginAdmin $pluginAdmin)
 Constructor. More...
 
 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 ($a_comp_id, $a_item_type, $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_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

 $db = null
 
 $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 ($questionData)
 
 checkFilters ()
 

Private Attributes

 $lng = null
 
 $pluginAdmin = null
 
 $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 16 of file class.ilAssQuestionList.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionList::__construct ( ilDBInterface  $db,
ilLanguage  $lng,
ilPluginAdmin  $pluginAdmin 
)

Constructor.

Parameters
ilDBInterface$db
ilLanguage$lng
ilPluginAdmin$pluginAdmin

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

References $db, $lng, and $pluginAdmin.

162  {
163  $this->db = $db;
164  $this->lng = $lng;
165  $this->pluginAdmin = $pluginAdmin;
166  }

Member Function Documentation

◆ addFieldFilter()

ilAssQuestionList::addFieldFilter (   $fieldName,
  $fieldValue 
)

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

245  {
246  $this->fieldFilters[$fieldName] = $fieldValue;
247  }

◆ addTaxonomyFilter()

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

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

References $parentObjId, and $parentObjType.

250  {
251  $this->taxFilters[$taxId] = $taxNodes;
252  $this->taxParentIds[$taxId] = $parentObjId;
253  $this->taxParentTypes[$taxId] = $parentObjType;
254  }

◆ buildBasicQuery()

ilAssQuestionList::buildBasicQuery ( )
private

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

Referenced by buildQuery().

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

◆ buildQuery()

ilAssQuestionList::buildQuery ( )
private

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

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

Referenced by load().

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

◆ checkFilters()

ilAssQuestionList::checkFilters ( )
private

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

References getAnswerStatusActiveId(), and getAnswerStatusFilter().

Referenced by load().

760  {
761  if( strlen($this->getAnswerStatusFilter()) && !$this->getAnswerStatusActiveId() )
762  {
763  require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
764 
765  throw new ilTestQuestionPoolException(
766  'No active id given! You cannot use the answer status filter without giving an active id.'
767  );
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 271 of file class.ilAssQuestionList.php.

References $answerStatusActiveId.

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

272  {
274  }
+ Here is the caller graph for this function:

◆ getAnswerStatusFilter()

ilAssQuestionList::getAnswerStatusFilter ( )

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

References $answerStatusFilter.

Referenced by checkFilters(), and getAnswerStatusFilterExpressions().

282  {
284  }
+ Here is the caller graph for this function:

◆ getAnswerStatusFilterExpressions()

ilAssQuestionList::getAnswerStatusFilterExpressions ( )
private

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

References array, and getAnswerStatusFilter().

Referenced by getConditionalFilterExpression().

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

◆ getAvailableTaxonomyIds()

ilAssQuestionList::getAvailableTaxonomyIds ( )

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

References $availableTaxonomyIds.

Referenced by loadTaxonomyAssignmentData().

262  {
264  }
+ Here is the caller graph for this function:

◆ getConditionalFilterExpression()

ilAssQuestionList::getConditionalFilterExpression ( )
private

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

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

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

◆ getDataArrayForQuestionId()

ilAssQuestionList::getDataArrayForQuestionId (   $questionId)

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

721  {
722  return $this->questions[$questionId];
723  }

◆ getExcludeQuestionIdsFilter()

ilAssQuestionList::getExcludeQuestionIdsFilter ( )

Definition at line 224 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 337 of file class.ilAssQuestionList.php.

References array.

Referenced by getConditionalFilterExpression().

338  {
339  $expressions = array();
340 
341  foreach($this->fieldFilters as $fieldName => $fieldValue)
342  {
343  switch($fieldName)
344  {
345  case 'title':
346  case 'description':
347  case 'author':
348 
349  $expressions[] = $this->db->like('qpl_questions.' . $fieldName, 'text', "%%$fieldValue%%");
350  break;
351 
352  case 'type':
353 
354  $expressions[] = "qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
355  break;
356 
357  case 'question_id':
358  if ($fieldValue != "" && !is_array($fieldValue))
359  {
360  $fieldValue = array($fieldValue);
361  }
362  $expressions[] = $this->db->in("qpl_questions.question_id", $fieldValue, false, "integer");
363  break;
364 
365  case 'parent_title':
366  if ($this->join_obj_data)
367  {
368  $expressions[] = $this->db->like('object_data.title', 'text', "%%$fieldValue%%");
369  }
370  break;
371  }
372  }
373 
374  return $expressions;
375  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getForcedQuestionIds()

ilAssQuestionList::getForcedQuestionIds ( )
Returns
array

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

References $forcedQuestionIds.

Referenced by buildQuery().

318  {
320  }
+ Here is the caller graph for this function:

◆ getIncludeQuestionIdsFilter()

ilAssQuestionList::getIncludeQuestionIdsFilter ( )

Definition at line 219 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 301 of file class.ilAssQuestionList.php.

References $join_obj_data.

302  {
303  return $this->join_obj_data;
304  }

◆ getParentObjectIdFilterExpression()

ilAssQuestionList::getParentObjectIdFilterExpression ( )
private

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

Referenced by getConditionalFilterExpression().

483  {
484  if( $this->parentObjId )
485  {
486  return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
487  }
488 
489  return null;
490  }
+ Here is the caller graph for this function:

◆ getParentObjectType()

ilAssQuestionList::getParentObjectType ( )

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

References $parentObjType.

179  {
180  return $this->parentObjType;
181  }

◆ getParentObjFilterExpression()

ilAssQuestionList::getParentObjFilterExpression ( )
private

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

References getParentObjId(), and getParentObjIdsFilter().

Referenced by getConditionalFilterExpression().

323  {
324  if( $this->getParentObjId() )
325  {
326  return 'qpl_questions.obj_fi = '.$this->db->quote($this->getParentObjId(), 'integer');
327  }
328 
329  if( count($this->getParentObjIdsFilter()) )
330  {
331  return $this->db->in('qpl_questions.obj_fi', $this->getParentObjIdsFilter(), false, 'integer');
332  }
333 
334  return null;
335  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObjId()

ilAssQuestionList::getParentObjId ( )

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

References $parentObjId.

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

169  {
170  return $this->parentObjId;
171  }
+ Here is the caller graph for this function:

◆ getParentObjIdsFilter()

ilAssQuestionList::getParentObjIdsFilter ( )
Returns
array

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

References $parentObjIdsFilter.

Referenced by getParentObjFilterExpression().

192  {
194  }
+ Here is the caller graph for this function:

◆ getQuestionCompletionStatusFilter()

ilAssQuestionList::getQuestionCompletionStatusFilter ( )

◆ getQuestionDataArray()

ilAssQuestionList::getQuestionDataArray ( )

◆ getQuestionIdsFilterExpressions()

ilAssQuestionList::getQuestionIdsFilterExpressions ( )
private

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

References array, getExcludeQuestionIdsFilter(), and getIncludeQuestionIdsFilter().

Referenced by getConditionalFilterExpression().

458  {
459  $expressions = array();
460 
461  if( is_array($this->getIncludeQuestionIdsFilter()) )
462  {
463  $expressions[] = $this->db->in(
464  'qpl_questions.question_id', $this->getIncludeQuestionIdsFilter(), false, 'integer'
465  );
466  }
467 
468  if( is_array($this->getExcludeQuestionIdsFilter()) )
469  {
470  $IN = $this->db->in(
471  'qpl_questions.question_id', $this->getExcludeQuestionIdsFilter(), true, 'integer'
472  );
473 
474  if($IN == ' 1=2 ') { $IN = ' 1=1 '; } // required for ILIAS < 5.0
475 
476  $expressions[] = $IN;
477  }
478 
479  return $expressions;
480  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionInstanceTypeFilter()

ilAssQuestionList::getQuestionInstanceTypeFilter ( )

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

References $questionInstanceTypeFilter.

Referenced by getQuestionInstanceTypeFilterExpression().

+ Here is the caller graph for this function:

◆ getQuestionInstanceTypeFilterExpression()

ilAssQuestionList::getQuestionInstanceTypeFilterExpression ( )
private

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

References getQuestionInstanceTypeFilter().

Referenced by getConditionalFilterExpression().

442  {
443  switch( $this->getQuestionInstanceTypeFilter() )
444  {
445  case self::QUESTION_INSTANCE_TYPE_ORIGINALS:
446 
447  return 'qpl_questions.original_id IS NULL';
448 
449  case self::QUESTION_INSTANCE_TYPE_DUPLICATES:
450 
451  return 'qpl_questions.original_id IS NOT NULL';
452  }
453 
454  return null;
455  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectFieldsExpression()

ilAssQuestionList::getSelectFieldsExpression ( )
private

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

References array, and getAnswerStatusActiveId().

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

◆ getTableJoinExpression()

ilAssQuestionList::getTableJoinExpression ( )
private

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

References getAnswerStatusActiveId().

521  {
522  $tableJoin = "
523  INNER JOIN qpl_qst_type
524  ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi
525  ";
526 
527  if ($this->join_obj_data)
528  {
529  $tableJoin .= "
530  INNER JOIN object_data
531  ON object_data.obj_id = qpl_questions.obj_fi
532  ";
533  }
534 
535  if( $this->getAnswerStatusActiveId() )
536  {
537  $tableJoin .= "
538  LEFT JOIN tst_test_result
539  ON tst_test_result.question_fi = qpl_questions.question_id
540  AND tst_test_result.active_fi = {$this->db->quote($this->getAnswerStatusActiveId(), 'integer')}
541  ";
542  }
543 
544  return $tableJoin;
545  }
+ 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 427 of file class.ilAssQuestionList.php.

References $parentObjId.

Referenced by getTaxonomyFilterExpressions().

428  {
429  $taxTree = new ilTaxonomyTree($taxId);
430 
431  $taxNodeAssignment = new ilTaxNodeAssignment(
432  $parentType, $parentObjId, 'quest', $taxId
433  );
434 
435  $subNodes = $taxTree->getSubTreeIds($taxNode);
436  $subNodes[] = $taxNode;
437 
438  return $taxNodeAssignment->getAssignmentsOfNode($subNodes);
439  }
Taxonomy node <-> item assignment.
+ Here is the caller graph for this function:

◆ getTaxonomyFilterExpressions()

ilAssQuestionList::getTaxonomyFilterExpressions ( )
private

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

References array, and getTaxItems().

Referenced by getConditionalFilterExpression().

378  {
379  $expressions = array();
380 
381  require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
382  require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
383 
384  foreach($this->taxFilters as $taxId => $taxNodes)
385  {
386  $questionIds = array();
387 
388  $forceBypass = true;
389 
390  foreach($taxNodes as $taxNode)
391  {
392  $forceBypass = false;
393 
394  $taxItemsByTaxParent = $this->getTaxItems(
395  $this->taxParentTypes[$taxId], $this->taxParentIds[$taxId],
396  $taxId, $taxNode
397  );
398 
399  $taxItemsByParent = $this->getTaxItems(
400  $this->parentObjType, $this->parentObjId,
401  $taxId, $taxNode
402  );
403 
404  $taxItems = array_merge($taxItemsByTaxParent, $taxItemsByParent);
405  foreach($taxItems as $taxItem)
406  {
407  $questionIds[$taxItem['item_id']] = $taxItem['item_id'];
408  }
409  }
410 
411  if( !$forceBypass )
412  {
413  $expressions[] = $this->db->in('question_id', $questionIds, false, 'integer');
414  }
415  }
416 
417  return $expressions;
418  }
getTaxItems($parentType, $parentObjId, $taxId, $taxNode)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilAssQuestionList::getTitle (   $a_comp_id,
  $a_item_type,
  $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 744 of file class.ilAssQuestionList.php.

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

◆ isActiveQuestionType()

ilAssQuestionList::isActiveQuestionType (   $questionData)
private

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

References IL_COMP_MODULE.

Referenced by load().

706  {
707  if( !isset($questionData['plugin']) )
708  {
709  return false;
710  }
711 
712  if( !$questionData['plugin'] )
713  {
714  return true;
715  }
716 
717  return $this->pluginAdmin->isActive(IL_COMP_MODULE, 'TestQuestionPool', 'qst', $questionData['plugin_name']);
718  }
const IL_COMP_MODULE
+ Here is the caller graph for this function:

◆ isInList()

ilAssQuestionList::isInList (   $questionId)

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

731  {
732  return isset($this->questions[$questionId]);
733  }

◆ load()

ilAssQuestionList::load ( )

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

References $query, $res, $row, buildQuery(), checkFilters(), ilAssQuestionType\completeMissingPluginName(), isActiveQuestionType(), and loadTaxonomyAssignmentData().

642  {
643  $this->checkFilters();
644 
645  $query = $this->buildQuery();
646 
647  #vd($query);
648 
649  $res = $this->db->query($query);
650 
651  //echo $this->db->db->last_query;
652 
653  #vd($this->db->db->last_query);
654 
655  while( $row = $this->db->fetchAssoc($res) )
656  {
658 
659  if( !$this->isActiveQuestionType($row) )
660  {
661  continue;
662  }
663 
664  $row['taxonomies'] = $this->loadTaxonomyAssignmentData($row['obj_fi'], $row['question_id']);
665 
666  $row['ttype'] = $this->lng->txt($row['type_tag']);
667 
668  $this->questions[ $row['question_id'] ] = $row;
669  }
670  }
isActiveQuestionType($questionData)
static completeMissingPluginName($questionTypeData)
loadTaxonomyAssignmentData($parentObjId, $questionId)
+ Here is the call graph for this function:

◆ loadTaxonomyAssignmentData()

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

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

References $parentObjId, array, and getAvailableTaxonomyIds().

Referenced by load().

673  {
674  $taxAssignmentData = array();
675 
676  foreach($this->getAvailableTaxonomyIds() as $taxId)
677  {
678  require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
679  require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
680 
681  $taxTree = new ilTaxonomyTree($taxId);
682 
683  $taxAssignment = new ilTaxNodeAssignment('qpl', $parentObjId, 'quest', $taxId);
684 
685  $assignments = $taxAssignment->getAssignmentsOfItem($questionId);
686 
687  foreach($assignments as $assData)
688  {
689  if( !isset($taxAssignmentData[ $assData['tax_id'] ]) )
690  {
691  $taxAssignmentData[ $assData['tax_id'] ] = array();
692  }
693 
694  $nodeData = $taxTree->getNodeData($assData['node_id']);
695 
696  $assData['node_lft'] = $nodeData['lft'];
697 
698  $taxAssignmentData[ $assData['tax_id'] ][ $assData['node_id'] ] = $assData;
699  }
700  }
701 
702  return $taxAssignmentData;
703  }
Taxonomy node <-> item assignment.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAnswerStatusActiveId()

ilAssQuestionList::setAnswerStatusActiveId (   $answerStatusActiveId)

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

References $answerStatusActiveId.

267  {
268  $this->answerStatusActiveId = $answerStatusActiveId;
269  }

◆ setAnswerStatusFilter()

ilAssQuestionList::setAnswerStatusFilter (   $answerStatusFilter)

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

References $answerStatusFilter.

277  {
278  $this->answerStatusFilter = $answerStatusFilter;
279  }

◆ setAvailableTaxonomyIds()

ilAssQuestionList::setAvailableTaxonomyIds (   $availableTaxonomyIds)

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

References $availableTaxonomyIds.

257  {
258  $this->availableTaxonomyIds = $availableTaxonomyIds;
259  }

◆ setExcludeQuestionIdsFilter()

ilAssQuestionList::setExcludeQuestionIdsFilter (   $excludeQuestionIdsFilter)

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

References $excludeQuestionIdsFilter.

230  {
231  $this->excludeQuestionIdsFilter = $excludeQuestionIdsFilter;
232  }

◆ setForcedQuestionIds()

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

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

References $forcedQuestionIds.

310  {
311  $this->forcedQuestionIds = $forcedQuestionIds;
312  }

◆ setIncludeQuestionIdsFilter()

ilAssQuestionList::setIncludeQuestionIdsFilter (   $questionIdsFilter)

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

215  {
216  $this->includeQuestionIdsFilter = $questionIdsFilter;
217  }

◆ setJoinObjectData()

ilAssQuestionList::setJoinObjectData (   $a_val)

Set if object data table should be joined.

Parameters
bool$a_valjoin object_data

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

292  {
293  $this->join_obj_data = $a_val;
294  }

◆ setParentObjectType()

ilAssQuestionList::setParentObjectType (   $parentObjType)

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

References $parentObjType.

184  {
185  $this->parentObjType = $parentObjType;
186  }

◆ setParentObjId()

ilAssQuestionList::setParentObjId (   $parentObjId)

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

References $parentObjId.

174  {
175  $this->parentObjId = $parentObjId;
176  }

◆ setParentObjIdsFilter()

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

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

References $parentObjIdsFilter.

200  {
201  $this->parentObjIdsFilter = $parentObjIdsFilter;
202  }

◆ setQuestionCompletionStatusFilter()

ilAssQuestionList::setQuestionCompletionStatusFilter (   $questionCompletionStatusFilter)

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

References $questionCompletionStatusFilter.

240  {
241  $this->questionCompletionStatusFilter = $questionCompletionStatusFilter;
242  }

◆ setQuestionInstanceTypeFilter()

ilAssQuestionList::setQuestionInstanceTypeFilter (   $questionInstanceTypeFilter)

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

References $questionInstanceTypeFilter.

205  {
206  $this->questionInstanceTypeFilter = $questionInstanceTypeFilter;
207  }

Field Documentation

◆ $answerStatusActiveId

ilAssQuestionList::$answerStatusActiveId = null
private

◆ $answerStatusFilter

ilAssQuestionList::$answerStatusFilter = null
private

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

Referenced by getAnswerStatusFilter(), and setAnswerStatusFilter().

◆ $availableTaxonomyIds

ilAssQuestionList::$availableTaxonomyIds = array()
private

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

Referenced by getAvailableTaxonomyIds(), and setAvailableTaxonomyIds().

◆ $db

ilAssQuestionList::$db = null
protected

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

Referenced by __construct().

◆ $excludeQuestionIdsFilter

ilAssQuestionList::$excludeQuestionIdsFilter = null
private

◆ $fieldFilters

ilAssQuestionList::$fieldFilters = array()
private

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

◆ $forcedQuestionIds

ilAssQuestionList::$forcedQuestionIds = array()
private

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

Referenced by getForcedQuestionIds(), and setForcedQuestionIds().

◆ $includeQuestionIdsFilter

ilAssQuestionList::$includeQuestionIdsFilter = null
private

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

Referenced by getIncludeQuestionIdsFilter().

◆ $join_obj_data

ilAssQuestionList::$join_obj_data = true
protected

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

Referenced by getJoinObjectData().

◆ $lng

ilAssQuestionList::$lng = null
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 44 of file class.ilAssQuestionList.php.

Referenced by getParentObjIdsFilter(), and setParentObjIdsFilter().

◆ $parentObjType

ilAssQuestionList::$parentObjType = 'qpl'
private

◆ $pluginAdmin

ilAssQuestionList::$pluginAdmin = null
private

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

Referenced by __construct().

◆ $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 152 of file class.ilAssQuestionList.php.

Referenced by getQuestionDataArray().

◆ $taxFilters

ilAssQuestionList::$taxFilters = array()
private

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

◆ $taxParentIds

ilAssQuestionList::$taxParentIds = array()
private

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

◆ $taxParentTypes

ilAssQuestionList::$taxParentTypes = array()
private

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

◆ ANSWER_STATUS_FILTER_ALL_NON_CORRECT

const ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT = 'allNonCorrect'

◆ 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'

◆ QUESTION_ANSWER_STATUS_NON_ANSWERED

const ilAssQuestionList::QUESTION_ANSWER_STATUS_NON_ANSWERED = 'nonAnswered'

answer status domain for single questions

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

Referenced by ilTestPlayerDynamicQuestionSetGUI\buildQuestionSetAnswerStatisticRowArray().

◆ QUESTION_ANSWER_STATUS_WRONG_ANSWERED

const ilAssQuestionList::QUESTION_ANSWER_STATUS_WRONG_ANSWERED = 'wrongAnswered'

◆ QUESTION_COMPLETION_STATUS_BOTH

const ilAssQuestionList::QUESTION_COMPLETION_STATUS_BOTH = 'complete/incomplete'

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

◆ QUESTION_COMPLETION_STATUS_COMPLETE

const ilAssQuestionList::QUESTION_COMPLETION_STATUS_COMPLETE = 'complete'

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

◆ QUESTION_COMPLETION_STATUS_INCOMPLETE

const ilAssQuestionList::QUESTION_COMPLETION_STATUS_INCOMPLETE = 'incomplete'

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

◆ QUESTION_INSTANCE_TYPE_DUPLICATES

◆ QUESTION_INSTANCE_TYPE_ORIGINALS


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