210 $this->includeQuestionIdsFilter = $questionIdsFilter;
240 $this->fieldFilters[$fieldName] = $fieldValue;
245 $this->taxFilters[$taxId] = $taxNodes;
287 $this->join_obj_data = $a_val;
319 return 'qpl_questions.obj_fi = ' . $this->db->quote($this->
getParentObjId(),
'integer');
331 $expressions = array();
333 foreach ($this->fieldFilters as $fieldName => $fieldValue) {
334 switch ($fieldName) {
340 $expressions[] = $this->db->like(
'qpl_questions.' . $fieldName,
'text',
"%%$fieldValue%%");
345 $expressions[] =
"qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
349 if ($fieldValue !=
"" && !is_array($fieldValue)) {
350 $fieldValue = array($fieldValue);
352 $expressions[] = $this->db->in(
"qpl_questions.question_id", $fieldValue,
false,
"integer");
356 if ($this->join_obj_data) {
357 $expressions[] = $this->db->like(
'object_data.title',
'text',
"%%$fieldValue%%");
368 $expressions = array();
370 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
371 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
373 foreach ($this->taxFilters as $taxId => $taxNodes) {
374 $questionIds = array();
378 foreach ($taxNodes as $taxNode) {
379 $forceBypass =
false;
382 $this->taxParentTypes[$taxId],
383 $this->taxParentIds[$taxId],
389 $this->parentObjType,
395 $taxItems = array_merge($taxItemsByTaxParent, $taxItemsByParent);
396 foreach ($taxItems as $taxItem) {
397 $questionIds[$taxItem[
'item_id']] = $taxItem[
'item_id'];
402 $expressions[] = $this->db->in(
'question_id', $questionIds,
false,
'integer');
427 $subNodes = $taxTree->getSubTreeIds($taxNode);
428 $subNodes[] = $taxNode;
430 return $taxNodeAssignment->getAssignmentsOfNode($subNodes);
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:
450 $expressions = array();
453 $expressions[] = $this->db->in(
454 'qpl_questions.question_id',
463 'qpl_questions.question_id',
469 if ($IN ==
' 1=2 ') {
473 $expressions[] = $IN;
481 if ($this->parentObjId) {
482 return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
490 $expressions = array();
493 case self::ANSWER_STATUS_FILTER_ALL_NON_CORRECT:
496 (tst_test_result.question_fi IS NULL OR tst_test_result.points < qpl_questions.points) 500 case self::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY:
502 $expressions[] =
'tst_test_result.question_fi IS NULL';
505 case self::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY:
507 $expressions[] =
'tst_test_result.question_fi IS NOT NULL';
508 $expressions[] =
'tst_test_result.points < qpl_questions.points';
518 INNER JOIN qpl_qst_type 519 ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi 522 if ($this->join_obj_data) {
524 INNER JOIN object_data 525 ON object_data.obj_id = qpl_questions.obj_fi 532 INNER JOIN tst_test_question tstquest 533 ON tstquest.question_fi = qpl_questions.question_id 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')} 550 $CONDITIONS = array();
564 $CONDITIONS = array_merge(
572 $CONDITIONS = implode(
' AND ', $CONDITIONS);
574 return strlen($CONDITIONS) ?
'AND ' . $CONDITIONS :
'';
579 $selectFields = array(
581 'qpl_qst_type.type_tag',
582 'qpl_qst_type.plugin',
583 'qpl_qst_type.plugin_name',
584 'qpl_questions.points max_points' 587 if ($this->join_obj_data) {
588 $selectFields[] =
'object_data.title parent_title';
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 601 $selectFields = implode(
",\n\t\t\t\t", $selectFields);
604 SELECT {$selectFields} 611 {$this->getSelectFieldsExpression()} 615 {$this->getTableJoinExpression()} 617 WHERE qpl_questions.tstamp > 0 624 {$this->getConditionalFilterExpression()} 629 UNION {$this->buildBasicQuery()} 630 AND {$this->db->in('qpl_questions.question_id', $this->getForcedQuestionIds(), false, 'integer')} 641 $tags_trafo = $this->
refinery->string()->stripTags();
647 while ($row = $this->db->fetchAssoc(
$res)) {
654 $row[
'title'] = $tags_trafo->transform($row[
'title'] ??
' ');
655 $row[
'description'] = $tags_trafo->transform($row[
'description'] !==
'' && $row[
'description'] !== null ? $row[
'description'] :
' ');
656 $row[
'author'] = $tags_trafo->transform($row[
'author']);
658 $row[
'ttype'] = $this->
lng->txt($row[
'type_tag']);
660 $this->questions[ $row[
'question_id'] ] = $row;
666 $taxAssignmentData = array();
669 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
670 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
676 $assignments = $taxAssignment->getAssignmentsOfItem($questionId);
678 foreach ($assignments as $assData) {
679 if (!isset($taxAssignmentData[ $assData[
'tax_id'] ])) {
680 $taxAssignmentData[ $assData[
'tax_id'] ] = array();
683 $nodeData = $taxTree->getNodeData($assData[
'node_id']);
685 $assData[
'node_lft'] = $nodeData[
'lft'];
687 $taxAssignmentData[ $assData[
'tax_id'] ][ $assData[
'node_id'] ] = $assData;
691 return $taxAssignmentData;
696 if (!isset($questionData[
'plugin'])) {
700 if (!$questionData[
'plugin']) {
704 if (!$this->component_repository->getComponentByTypeAndName(
707 )->getPluginSlotById(
'qst')->hasPluginName($questionData[
'plugin_name'])) {
711 return $this->component_repository
712 ->getComponentByTypeAndName(
720 $questionData[
'plugin_name']
726 return $this->questions[$questionId];
736 return isset($this->questions[$questionId]);
748 public function getTitle(
string $a_comp_id,
string $a_item_type,
int $a_item_id): string
750 if ($a_comp_id !=
'qpl' || $a_item_type !=
'quest' || !$a_item_id) {
754 if (!isset($this->questions[$a_item_id])) {
758 return $this->questions[$a_item_id][
'title'];
764 require_once
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
767 'No active id given! You cannot use the answer status filter without giving an active id.'
getExcludeQuestionIdsFilter()
Readable part of repository interface to ilComponentDataDB.
setAnswerStatusFilter($answerStatusFilter)
$questionCompletionStatusFilter
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$includeQuestionIdsFilter
isActiveQuestionType(array $questionData)
getAnswerStatusActiveId()
getSelectFieldsExpression()
$questionInstanceTypeFilter
getTaxItems($parentType, $parentObjId, $taxId, $taxNode)
getQuestionIdsFilterExpressions()
getIncludeQuestionIdsFilter()
getParentObjFilterExpression()
setExcludeQuestionIdsFilter($excludeQuestionIdsFilter)
const QUESTION_INSTANCE_TYPE_DUPLICATES
getTitle(string $a_comp_id, string $a_item_type, int $a_item_id)
Get title of an assigned item.
getDataArrayForQuestionId($questionId)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getConditionalFilterExpression()
setAnswerStatusActiveId($answerStatusActiveId)
static completeMissingPluginName($questionTypeData)
const ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY
getAvailableTaxonomyIds()
getTaxonomyFilterExpressions()
setIncludeQuestionIdsFilter($questionIdsFilter)
getAnswerStatusFilterExpressions()
setParentObjId($parentObjId)
setParentObjectType($parentObjType)
$excludeQuestionIdsFilter
getParentObjectIdFilterExpression()
__construct(ilDBInterface $db, ilLanguage $lng, Refinery $refinery, ilComponentRepository $component_repository)
getFieldFilterExpressions()
addTaxonomyFilter($taxId, $taxNodes, $parentObjId, $parentObjType)
getQuestionInstanceTypeFilter()
getJoinObjectData()
Get if object data table should be joined.
const ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY
getQuestionInstanceTypeFilterExpression()
const QUESTION_COMPLETION_STATUS_COMPLETE
setQuestionInstanceTypeFilter($questionInstanceTypeFilter)
const ANSWER_STATUS_FILTER_ALL_NON_CORRECT
answer status filter value domain
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setForcedQuestionIds($forcedQuestionIds)
const QUESTION_ANSWER_STATUS_CORRECT_ANSWERED
const QUESTION_COMPLETION_STATUS_BOTH
const QUESTION_ANSWER_STATUS_WRONG_ANSWERED
setJoinObjectData($a_val)
Set if object data table should be joined.
const QUESTION_COMPLETION_STATUS_INCOMPLETE
addFieldFilter($fieldName, $fieldValue)
setParentObjIdsFilter($parentObjIdsFilter)
const QUESTION_INSTANCE_TYPE_ALL
loadTaxonomyAssignmentData($parentObjId, $questionId)
const QUESTION_INSTANCE_TYPE_ORIGINALS
const QUESTION_ANSWER_STATUS_NON_ANSWERED
answer status domain for single questions
setQuestionCompletionStatusFilter($questionCompletionStatusFilter)
getQuestionCompletionStatusFilter()
ilComponentRepository $component_repository
setAvailableTaxonomyIds($availableTaxonomyIds)