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;
325 return 'qpl_questions.obj_fi = ' . $this->db->quote($this->
getParentObjId(),
'integer');
337 $expressions = array();
339 foreach ($this->fieldFilters as $fieldName => $fieldValue) {
340 switch ($fieldName) {
346 $expressions[] = $this->db->like(
'qpl_questions.' . $fieldName,
'text',
"%%$fieldValue%%");
351 $expressions[] =
"qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
355 if ($fieldValue !=
"" && !is_array($fieldValue)) {
356 $fieldValue = array($fieldValue);
358 $expressions[] = $this->db->in(
"qpl_questions.question_id", $fieldValue,
false,
"integer");
362 if ($this->join_obj_data) {
363 $expressions[] = $this->db->like(
'object_data.title',
'text',
"%%$fieldValue%%");
374 $expressions = array();
376 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
377 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
379 foreach ($this->taxFilters as $taxId => $taxNodes) {
380 $questionIds = array();
384 foreach ($taxNodes as $taxNode) {
385 $forceBypass =
false;
388 $this->taxParentTypes[$taxId],
389 $this->taxParentIds[$taxId],
395 $this->parentObjType,
401 $taxItems = array_merge($taxItemsByTaxParent, $taxItemsByParent);
402 foreach ($taxItems as $taxItem) {
403 $questionIds[$taxItem[
'item_id']] = $taxItem[
'item_id'];
408 $expressions[] = $this->db->in(
'question_id', $questionIds,
false,
'integer');
433 $subNodes = $taxTree->getSubTreeIds($taxNode);
434 $subNodes[] = $taxNode;
436 return $taxNodeAssignment->getAssignmentsOfNode($subNodes);
442 case self::QUESTION_INSTANCE_TYPE_ORIGINALS:
444 return 'qpl_questions.original_id IS NULL';
446 case self::QUESTION_INSTANCE_TYPE_DUPLICATES:
448 return 'qpl_questions.original_id IS NOT NULL';
456 $expressions = array();
459 $expressions[] = $this->db->in(
460 'qpl_questions.question_id',
469 'qpl_questions.question_id',
475 if ($IN ==
' 1=2 ') {
479 $expressions[] = $IN;
487 if ($this->parentObjId) {
488 return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
496 $expressions = array();
499 case self::ANSWER_STATUS_FILTER_ALL_NON_CORRECT:
502 (tst_test_result.question_fi IS NULL OR tst_test_result.points < qpl_questions.points) 506 case self::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY:
508 $expressions[] =
'tst_test_result.question_fi IS NULL';
511 case self::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY:
513 $expressions[] =
'tst_test_result.question_fi IS NOT NULL';
514 $expressions[] =
'tst_test_result.points < qpl_questions.points';
524 INNER JOIN qpl_qst_type 525 ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi 528 if ($this->join_obj_data) {
530 INNER JOIN object_data 531 ON object_data.obj_id = qpl_questions.obj_fi 537 LEFT JOIN tst_test_result 538 ON tst_test_result.question_fi = qpl_questions.question_id 539 AND tst_test_result.active_fi = {$this->db->quote($this->getAnswerStatusActiveId(), 'integer')} 548 $CONDITIONS = array();
562 $CONDITIONS = array_merge(
570 $CONDITIONS = implode(
' AND ', $CONDITIONS);
572 return strlen($CONDITIONS) ?
'AND ' . $CONDITIONS :
'';
577 $selectFields = array(
579 'qpl_qst_type.type_tag',
580 'qpl_qst_type.plugin',
581 'qpl_qst_type.plugin_name',
582 'qpl_questions.points max_points' 585 if ($this->join_obj_data) {
586 $selectFields[] =
'object_data.title parent_title';
590 $selectFields[] =
'tst_test_result.points reached_points';
591 $selectFields[] =
"CASE 592 WHEN tst_test_result.points IS NULL THEN '" . self::QUESTION_ANSWER_STATUS_NON_ANSWERED .
"' 593 WHEN tst_test_result.points < qpl_questions.points THEN '" . self::QUESTION_ANSWER_STATUS_WRONG_ANSWERED .
"' 594 ELSE '" . self::QUESTION_ANSWER_STATUS_CORRECT_ANSWERED .
"' 595 END question_answer_status 599 $selectFields = implode(
",\n\t\t\t\t", $selectFields);
602 SELECT {$selectFields} 609 {$this->getSelectFieldsExpression()} 613 {$this->getTableJoinExpression()} 615 WHERE qpl_questions.tstamp > 0 622 {$this->getConditionalFilterExpression()} 627 UNION {$this->buildBasicQuery()} 628 AND {$this->db->in('qpl_questions.question_id', $this->getForcedQuestionIds(), false, 'integer')} 647 #vd($this->db->db->last_query); 649 while ($row = $this->db->fetchAssoc(
$res)) {
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 return $this->pluginAdmin->isActive(
IL_COMP_MODULE,
'TestQuestionPool',
'qst', $questionData[
'plugin_name']);
709 return $this->questions[$questionId];
719 return isset($this->questions[$questionId]);
731 public function getTitle($a_comp_id, $a_item_type, $a_item_id)
733 if ($a_comp_id !=
'qpl' || $a_item_type !=
'quest' || !(
int) $a_item_id) {
737 if (!isset($this->questions[$a_item_id])) {
741 return $this->questions[$a_item_id][
'title'];
747 require_once
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
750 '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()
foreach($_POST as $key=> $value) $res
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
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)