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) {
345 $expressions[] = $this->db->like(
'qpl_questions.' . $fieldName,
'text',
"%%$fieldValue%%");
350 $expressions[] =
"qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
354 if ($fieldValue !=
"" && !is_array($fieldValue)) {
355 $fieldValue =
array($fieldValue);
357 $expressions[] = $this->db->in(
"qpl_questions.question_id", $fieldValue,
false,
"integer");
361 if ($this->join_obj_data) {
362 $expressions[] = $this->db->like(
'object_data.title',
'text',
"%%$fieldValue%%");
373 $expressions =
array();
375 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
376 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
378 foreach ($this->taxFilters as $taxId => $taxNodes) {
379 $questionIds =
array();
383 foreach ($taxNodes as $taxNode) {
384 $forceBypass =
false;
387 $this->taxParentTypes[$taxId],
388 $this->taxParentIds[$taxId],
394 $this->parentObjType,
400 $taxItems = array_merge($taxItemsByTaxParent, $taxItemsByParent);
401 foreach ($taxItems as $taxItem) {
402 $questionIds[$taxItem[
'item_id']] = $taxItem[
'item_id'];
407 $expressions[] = $this->db->in(
'question_id', $questionIds,
false,
'integer');
432 $subNodes = $taxTree->getSubTreeIds($taxNode);
433 $subNodes[] = $taxNode;
435 return $taxNodeAssignment->getAssignmentsOfNode($subNodes);
441 case self::QUESTION_INSTANCE_TYPE_ORIGINALS:
443 return 'qpl_questions.original_id IS NULL';
445 case self::QUESTION_INSTANCE_TYPE_DUPLICATES:
447 return 'qpl_questions.original_id IS NOT NULL';
455 $expressions =
array();
458 $expressions[] = $this->db->in(
459 'qpl_questions.question_id',
468 'qpl_questions.question_id',
474 if ($IN ==
' 1=2 ') {
478 $expressions[] = $IN;
486 if ($this->parentObjId) {
487 return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
495 $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) {
529 INNER JOIN object_data 530 ON object_data.obj_id = qpl_questions.obj_fi 536 LEFT JOIN tst_test_result 537 ON tst_test_result.question_fi = qpl_questions.question_id 538 AND tst_test_result.active_fi = {$this->db->quote($this->getAnswerStatusActiveId(), 'integer')} 547 $CONDITIONS =
array();
561 $CONDITIONS = array_merge(
569 $CONDITIONS = implode(
' AND ', $CONDITIONS);
571 return strlen($CONDITIONS) ?
'AND ' . $CONDITIONS :
'';
576 $selectFields =
array(
578 'qpl_qst_type.type_tag',
579 'qpl_qst_type.plugin',
580 'qpl_qst_type.plugin_name',
581 'qpl_questions.points max_points' 584 if ($this->join_obj_data) {
585 $selectFields[] =
'object_data.title parent_title';
589 $selectFields[] =
'tst_test_result.points reached_points';
590 $selectFields[] =
"CASE 591 WHEN tst_test_result.points IS NULL THEN '" . self::QUESTION_ANSWER_STATUS_NON_ANSWERED .
"' 592 WHEN tst_test_result.points < qpl_questions.points THEN '" . self::QUESTION_ANSWER_STATUS_WRONG_ANSWERED .
"' 593 ELSE '" . self::QUESTION_ANSWER_STATUS_CORRECT_ANSWERED .
"' 594 END question_answer_status 598 $selectFields = implode(
",\n\t\t\t\t", $selectFields);
601 SELECT {$selectFields} 608 {$this->getSelectFieldsExpression()} 612 {$this->getTableJoinExpression()} 614 WHERE qpl_questions.tstamp > 0 621 {$this->getConditionalFilterExpression()} 626 UNION {$this->buildBasicQuery()} 627 AND {$this->db->in('qpl_questions.question_id', $this->getForcedQuestionIds(), false, 'integer')} 646 #vd($this->db->db->last_query); 648 while (
$row = $this->db->fetchAssoc(
$res)) {
657 $row[
'ttype'] = $this->lng->txt(
$row[
'type_tag']);
659 $this->questions[
$row[
'question_id'] ] =
$row;
665 $taxAssignmentData =
array();
668 require_once
'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
669 require_once
'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
675 $assignments = $taxAssignment->getAssignmentsOfItem($questionId);
677 foreach ($assignments as $assData) {
678 if (!isset($taxAssignmentData[ $assData[
'tax_id'] ])) {
679 $taxAssignmentData[ $assData[
'tax_id'] ] =
array();
682 $nodeData = $taxTree->getNodeData($assData[
'node_id']);
684 $assData[
'node_lft'] = $nodeData[
'lft'];
686 $taxAssignmentData[ $assData[
'tax_id'] ][ $assData[
'node_id'] ] = $assData;
690 return $taxAssignmentData;
695 if (!isset($questionData[
'plugin'])) {
699 if (!$questionData[
'plugin']) {
703 return $this->pluginAdmin->isActive(
IL_COMP_MODULE,
'TestQuestionPool',
'qst', $questionData[
'plugin_name']);
708 return $this->questions[$questionId];
718 return isset($this->questions[$questionId]);
730 public function getTitle($a_comp_id, $a_item_type, $a_item_id)
732 if ($a_comp_id !=
'qpl' || $a_item_type !=
'quest' || !(
int) $a_item_id) {
736 if (!isset($this->questions[$a_item_id])) {
740 return $this->questions[$a_item_id][
'title'];
746 require_once
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
749 '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
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)