4 require_once
'Services/Taxonomy/interfaces/interface.ilTaxAssignedItemInfo.php';
5 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionType.php';
216 $this->includeQuestionIdsFilter = $questionIdsFilter;
246 $this->fieldFilters[$fieldName] = $fieldValue;
251 $this->taxFilters[$taxId] = $taxNodes;
293 $this->join_obj_data = $a_val;
326 return 'qpl_questions.obj_fi = '.$this->db->quote($this->
getParentObjId(),
'integer');
339 $expressions =
array();
341 foreach($this->fieldFilters as $fieldName => $fieldValue)
349 $expressions[] = $this->db->like(
'qpl_questions.' . $fieldName,
'text',
"%%$fieldValue%%");
354 $expressions[] =
"qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
358 if ($fieldValue !=
"" && !is_array($fieldValue))
360 $fieldValue =
array($fieldValue);
362 $expressions[] = $this->db->in(
"qpl_questions.question_id", $fieldValue,
false,
"integer");
366 if ($this->join_obj_data)
368 $expressions[] = $this->db->like(
'object_data.title',
'text',
"%%$fieldValue%%");
379 $expressions =
array();
381 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
382 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
384 foreach($this->taxFilters as $taxId => $taxNodes)
386 $questionIds =
array();
390 foreach($taxNodes as $taxNode)
392 $forceBypass =
false;
395 $this->taxParentTypes[$taxId], $this->taxParentIds[$taxId],
400 $this->parentObjType, $this->parentObjId,
404 $taxItems = array_merge($taxItemsByTaxParent, $taxItemsByParent);
405 foreach($taxItems as $taxItem)
407 $questionIds[$taxItem[
'item_id']] = $taxItem[
'item_id'];
413 $expressions[] = $this->db->in(
'question_id', $questionIds,
false,
'integer');
435 $subNodes = $taxTree->getSubTreeIds($taxNode);
436 $subNodes[] = $taxNode;
438 return $taxNodeAssignment->getAssignmentsOfNode($subNodes);
445 case self::QUESTION_INSTANCE_TYPE_ORIGINALS:
447 return 'qpl_questions.original_id IS NULL';
449 case self::QUESTION_INSTANCE_TYPE_DUPLICATES:
451 return 'qpl_questions.original_id IS NOT NULL';
459 $expressions =
array();
463 $expressions[] = $this->db->in(
474 if($IN ==
' 1=2 ') { $IN =
' 1=1 '; }
476 $expressions[] = $IN;
484 if( $this->parentObjId )
486 return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
494 $expressions =
array();
498 case self::ANSWER_STATUS_FILTER_ALL_NON_CORRECT:
501 (tst_test_result.question_fi IS NULL OR tst_test_result.points < qpl_questions.points) 505 case self::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY:
507 $expressions[] =
'tst_test_result.question_fi IS NULL';
510 case self::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY:
512 $expressions[] =
'tst_test_result.question_fi IS NOT NULL';
513 $expressions[] =
'tst_test_result.points < qpl_questions.points';
523 INNER JOIN qpl_qst_type 524 ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi 527 if ($this->join_obj_data)
530 INNER JOIN object_data 531 ON object_data.obj_id = qpl_questions.obj_fi 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')} 549 $CONDITIONS =
array();
566 $CONDITIONS = array_merge($CONDITIONS,
573 $CONDITIONS = implode(
' AND ', $CONDITIONS);
575 return strlen($CONDITIONS) ?
'AND '.$CONDITIONS :
'';
580 $selectFields =
array(
582 'qpl_qst_type.type_tag',
583 'qpl_qst_type.plugin',
584 'qpl_qst_type.plugin_name',
585 'qpl_questions.points max_points' 588 if ($this->join_obj_data)
590 $selectFields[] =
'object_data.title parent_title';
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 604 $selectFields = implode(
",\n\t\t\t\t", $selectFields);
607 SELECT {$selectFields} 614 {$this->getSelectFieldsExpression()} 618 {$this->getTableJoinExpression()} 620 WHERE qpl_questions.tstamp > 0 627 {$this->getConditionalFilterExpression()} 633 UNION {$this->buildBasicQuery()} 634 AND {$this->db->in('qpl_questions.question_id', $this->getForcedQuestionIds(), false, 'integer')} 653 #vd($this->db->db->last_query); 655 while(
$row = $this->db->fetchAssoc(
$res) )
666 $row[
'ttype'] = $this->lng->txt(
$row[
'type_tag']);
668 $this->questions[
$row[
'question_id'] ] =
$row;
674 $taxAssignmentData =
array();
678 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
679 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
685 $assignments = $taxAssignment->getAssignmentsOfItem($questionId);
687 foreach($assignments as $assData)
689 if( !isset($taxAssignmentData[ $assData[
'tax_id'] ]) )
691 $taxAssignmentData[ $assData[
'tax_id'] ] =
array();
694 $nodeData = $taxTree->getNodeData($assData[
'node_id']);
696 $assData[
'node_lft'] = $nodeData[
'lft'];
698 $taxAssignmentData[ $assData[
'tax_id'] ][ $assData[
'node_id'] ] = $assData;
702 return $taxAssignmentData;
707 if( !isset($questionData[
'plugin']) )
712 if( !$questionData[
'plugin'] )
717 return $this->pluginAdmin->isActive(
IL_COMP_MODULE,
'TestQuestionPool',
'qst', $questionData[
'plugin_name']);
722 return $this->questions[$questionId];
732 return isset($this->questions[$questionId]);
744 public function getTitle($a_comp_id, $a_item_type, $a_item_id)
746 if( $a_comp_id !=
'qpl' || $a_item_type !=
'quest' || !(
int)$a_item_id )
751 if( !isset($this->questions[$a_item_id]) )
756 return $this->questions[$a_item_id][
'title'];
763 require_once
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
766 'No active id given! You cannot use the answer status filter without giving an active id.'
getExcludeQuestionIdsFilter()
setAnswerStatusFilter($answerStatusFilter)
$questionCompletionStatusFilter
Taxonomy node <-> item assignment.
$includeQuestionIdsFilter
getAnswerStatusActiveId()
getSelectFieldsExpression()
$questionInstanceTypeFilter
getTaxItems($parentType, $parentObjId, $taxId, $taxNode)
getQuestionIdsFilterExpressions()
getIncludeQuestionIdsFilter()
__construct(ilDBInterface $db, ilLanguage $lng, ilPluginAdmin $pluginAdmin)
Constructor.
getParentObjFilterExpression()
setExcludeQuestionIdsFilter($excludeQuestionIdsFilter)
const QUESTION_INSTANCE_TYPE_DUPLICATES
getDataArrayForQuestionId($questionId)
getConditionalFilterExpression()
isActiveQuestionType($questionData)
setAnswerStatusActiveId($answerStatusActiveId)
Administration class for plugins.
static completeMissingPluginName($questionTypeData)
const ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY
getAvailableTaxonomyIds()
getTaxonomyFilterExpressions()
setIncludeQuestionIdsFilter($questionIdsFilter)
getAnswerStatusFilterExpressions()
setParentObjId($parentObjId)
setParentObjectType($parentObjType)
$excludeQuestionIdsFilter
getParentObjectIdFilterExpression()
getFieldFilterExpressions()
addTaxonomyFilter($taxId, $taxNodes, $parentObjId, $parentObjType)
getQuestionInstanceTypeFilter()
getJoinObjectData()
Get if object data table should be joined.
const ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY
Create styles array
The data for the language used.
getQuestionInstanceTypeFilterExpression()
const QUESTION_COMPLETION_STATUS_COMPLETE
setQuestionInstanceTypeFilter($questionInstanceTypeFilter)
const ANSWER_STATUS_FILTER_ALL_NON_CORRECT
answer status filter value domain
Interface for assigned items of taxonomies.
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.
getTitle($a_comp_id, $a_item_type, $a_item_id)
Get title of an assigned item.
const QUESTION_COMPLETION_STATUS_INCOMPLETE
addFieldFilter($fieldName, $fieldValue)
setParentObjIdsFilter($parentObjIdsFilter)
loadTaxonomyAssignmentData($parentObjId, $questionId)
const QUESTION_INSTANCE_TYPE_ORIGINALS
const QUESTION_ANSWER_STATUS_NON_ANSWERED
answer status domain for single questions
setQuestionCompletionStatusFilter($questionCompletionStatusFilter)
getQuestionCompletionStatusFilter()
setAvailableTaxonomyIds($availableTaxonomyIds)