ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAssQuestionList Class Reference
+ Inheritance diagram for ilAssQuestionList:
+ Collaboration diagram for ilAssQuestionList:

Public Member Functions

 __construct (ilDB $db, ilLanguage $lng, ilPluginAdmin $pluginAdmin, $parentObjId)
 Constructor.
 setParentObjectType ($parentObjType)
 getParentObjectType ()
 setQuestionInstanceTypeFilter ($questionInstanceTypeFilter)
 getQuestionInstanceTypeFilter ()
 setQuestionIdsFilter ($questionIdsFilter)
 getQuestionIdsFilter ()
 addFieldFilter ($fieldName, $fieldValue)
 addTaxonomyFilter ($taxId, $taxNodes)
 setAvailableTaxonomyIds ($availableTaxonomyIds)
 getAvailableTaxonomyIds ()
 setAnswerStatusActiveId ($answerStatusActiveId)
 getAnswerStatusActiveId ()
 setAnswerStatusFilter ($answerStatusFilter)
 getAnswerStatusFilter ()
 setForcedQuestionIds ($forcedQuestionIds)
 getForcedQuestionIds ()
 load ()
 getQuestionDataArray ()
 isInList ($questionId)
 getTitle ($a_comp_id, $a_item_type, $a_item_id)
 Get title of an assigned item.

Data Fields

const QUESTION_ANSWER_STATUS_NON_ANSWERED = 'nonAnswered'
 answer status domain for single questions
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
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'

Private Member Functions

 getFieldFilterExpressions ()
 getTaxonomyFilterExpressions ()
 getQuestionInstanceTypeFilterExpression ()
 getQuestionIdsFilterExpression ()
 getParentObjectIdFilterExpression ()
 getAnswerStatusFilterExpressions ()
 getTableJoinExpression ()
 getConditionalFilterExpression ()
 getSelectFieldsExpression ()
 buildBasicQuery ()
 buildQuery ()
 loadTaxonomyAssignmentData ($questionId)
 isActiveQuestionType ($questionData)
 checkFilters ()

Private Attributes

 $db = null
 $lng = null
 $pluginAdmin = null
 $parentObjId = null
 $parentObjType = 'qpl'
 $availableTaxonomyIds = array()
 $fieldFilters = array()
 $taxFilters = array()
 $answerStatusActiveId = null
 $forcedQuestionIds = array()
 $answerStatusFilter = null
 $questions = array()
 $questionInstanceTypeFilter = self::QUESTION_INSTANCE_TYPE_ORIGINALS
 $questionIdsFilter = null

Detailed Description

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
ilDB$db
integer$parentObjId

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

References $db, $lng, $parentObjId, and $pluginAdmin.

{
$this->db = $db;
$this->lng = $lng;
$this->pluginAdmin = $pluginAdmin;
$this->parentObjId = $parentObjId;
}

Member Function Documentation

ilAssQuestionList::addFieldFilter (   $fieldName,
  $fieldValue 
)

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

{
$this->fieldFilters[$fieldName] = $fieldValue;
}
ilAssQuestionList::addTaxonomyFilter (   $taxId,
  $taxNodes 
)

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

Referenced by ilObjQuestionPoolGUI\buildQuestionBrowserTableGUI().

{
$this->taxFilters[$taxId] = $taxNodes;
}

+ Here is the caller graph for this function:

ilAssQuestionList::buildBasicQuery ( )
private

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

Referenced by buildQuery().

{
return "
{$this->getSelectFieldsExpression()}
FROM qpl_questions
{$this->getTableJoinExpression()}
WHERE qpl_questions.tstamp > 0
";
}

+ Here is the caller graph for this function:

ilAssQuestionList::buildQuery ( )
private

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

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

Referenced by load().

{
$query = $this->buildBasicQuery()."
{$this->getConditionalFilterExpression()}
";
if( count($this->getForcedQuestionIds()) )
{
$query .= "
UNION {$this->buildBasicQuery()}
AND {$this->db->in('qpl_questions.question_id', $this->getForcedQuestionIds(), false, 'integer')}
";
}
return $query;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::checkFilters ( )
private

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

References getAnswerStatusActiveId(), and getAnswerStatusFilter().

Referenced by load().

{
if( strlen($this->getAnswerStatusFilter()) && !$this->getAnswerStatusActiveId() )
{
require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
'No active id given! You cannot use the answer status filter without giving an active id.'
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::getAnswerStatusActiveId ( )

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

References $answerStatusActiveId.

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

+ Here is the caller graph for this function:

ilAssQuestionList::getAnswerStatusFilter ( )

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

References $answerStatusFilter.

Referenced by checkFilters(), and getAnswerStatusFilterExpressions().

+ Here is the caller graph for this function:

ilAssQuestionList::getAnswerStatusFilterExpressions ( )
private

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

References getAnswerStatusFilter().

Referenced by getConditionalFilterExpression().

{
$expressions = array();
switch( $this->getAnswerStatusFilter() )
{
case self::ANSWER_STATUS_FILTER_ALL_NON_CORRECT:
$expressions[] = '
(tst_test_result.question_fi IS NULL OR tst_test_result.points < qpl_questions.points)
';
break;
case self::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY:
$expressions[] = 'tst_test_result.question_fi IS NULL';
break;
case self::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY:
$expressions[] = 'tst_test_result.question_fi IS NOT NULL';
$expressions[] = 'tst_test_result.points < qpl_questions.points';
break;
}
return $expressions;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::getAvailableTaxonomyIds ( )

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

References $availableTaxonomyIds.

Referenced by loadTaxonomyAssignmentData().

+ Here is the caller graph for this function:

ilAssQuestionList::getConditionalFilterExpression ( )
private

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

References getAnswerStatusFilterExpressions(), getFieldFilterExpressions(), getParentObjectIdFilterExpression(), getQuestionIdsFilterExpression(), getQuestionInstanceTypeFilterExpression(), and getTaxonomyFilterExpressions().

{
$CONDITIONS = array();
{
$CONDITIONS[] = $this->getQuestionInstanceTypeFilterExpression();
}
if( $this->getQuestionIdsFilterExpression() !== null )
{
$CONDITIONS[] = $this->getQuestionIdsFilterExpression();
}
if( $this->getParentObjectIdFilterExpression() !== null )
{
$CONDITIONS[] = $this->getParentObjectIdFilterExpression();
}
$CONDITIONS = array_merge($CONDITIONS,
);
$CONDITIONS = implode(' AND ', $CONDITIONS);
return strlen($CONDITIONS) ? 'AND '.$CONDITIONS : '';
}

+ Here is the call graph for this function:

ilAssQuestionList::getFieldFilterExpressions ( )
private

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

Referenced by getConditionalFilterExpression().

{
$expressions = array();
foreach($this->fieldFilters as $fieldName => $fieldValue)
{
switch($fieldName)
{
case 'title':
case 'description':
case 'author':
$expressions[] = $this->db->like('qpl_questions.' . $fieldName, 'text', "%%$fieldValue%%");
break;
case 'type':
$expressions[] = "qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
break;
case 'question_id':
if ($fieldValue != "" && !is_array($fieldValue))
{
$fieldValue = array($fieldValue);
}
$expressions[] = $this->db->in("qpl_questions.question_id", $fieldValue, false, "integer");
break;
}
}
return $expressions;
}

+ Here is the caller graph for this function:

ilAssQuestionList::getForcedQuestionIds ( )
Returns
array

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

References $forcedQuestionIds.

Referenced by buildQuery().

+ Here is the caller graph for this function:

ilAssQuestionList::getParentObjectIdFilterExpression ( )
private

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

Referenced by getConditionalFilterExpression().

{
if( $this->parentObjId )
{
return "qpl_questions.obj_fi = {$this->db->quote($this->parentObjId, 'integer')}";
}
return null;
}

+ Here is the caller graph for this function:

ilAssQuestionList::getParentObjectType ( )

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

References $parentObjType.

{
}
ilAssQuestionList::getQuestionDataArray ( )
ilAssQuestionList::getQuestionIdsFilter ( )

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

References $questionIdsFilter.

Referenced by getQuestionIdsFilterExpression().

+ Here is the caller graph for this function:

ilAssQuestionList::getQuestionIdsFilterExpression ( )
private

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

References getQuestionIdsFilter().

Referenced by getConditionalFilterExpression().

{
if( is_array($this->getQuestionIdsFilter()) )
{
return $this->db->in('qpl_questions.question_id', $this->getQuestionIdsFilter(), false, 'integer');
}
return null;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::getQuestionInstanceTypeFilter ( )

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

References $questionInstanceTypeFilter.

Referenced by getQuestionInstanceTypeFilterExpression().

+ Here is the caller graph for this function:

ilAssQuestionList::getQuestionInstanceTypeFilterExpression ( )
private

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

References getQuestionInstanceTypeFilter().

Referenced by getConditionalFilterExpression().

{
switch( $this->getQuestionInstanceTypeFilter() )
{
case self::QUESTION_INSTANCE_TYPE_ORIGINALS:
return 'qpl_questions.original_id IS NULL';
case self::QUESTION_INSTANCE_TYPE_DUPLICATES:
return 'qpl_questions.original_id IS NOT NULL';
}
return null;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::getSelectFieldsExpression ( )
private

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

References getAnswerStatusActiveId().

{
$selectFields = array(
'qpl_questions.*',
'qpl_qst_type.type_tag',
'qpl_qst_type.plugin',
'qpl_questions.points max_points'
);
if( $this->getAnswerStatusActiveId() )
{
$selectFields[] = 'tst_test_result.points reached_points';
$selectFields[] = "CASE
WHEN tst_test_result.points IS NULL THEN '".self::QUESTION_ANSWER_STATUS_NON_ANSWERED."'
WHEN tst_test_result.points < qpl_questions.points THEN '".self::QUESTION_ANSWER_STATUS_WRONG_ANSWERED."'
ELSE '".self::QUESTION_ANSWER_STATUS_CORRECT_ANSWERED."'
END question_answer_status
";
}
$selectFields = implode(",\n\t\t\t\t", $selectFields);
return "
SELECT {$selectFields}
";
}

+ Here is the call graph for this function:

ilAssQuestionList::getTableJoinExpression ( )
private

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

References getAnswerStatusActiveId().

{
$tableJoin = "
INNER JOIN qpl_qst_type
ON qpl_qst_type.question_type_id = qpl_questions.question_type_fi
";
if( $this->getAnswerStatusActiveId() )
{
$tableJoin .= "
LEFT JOIN tst_test_result
ON tst_test_result.question_fi = qpl_questions.question_id
AND tst_test_result.active_fi = {$this->db->quote($this->getAnswerStatusActiveId(), 'integer')}
";
}
return $tableJoin;
}

+ Here is the call graph for this function:

ilAssQuestionList::getTaxonomyFilterExpressions ( )
private

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

Referenced by getConditionalFilterExpression().

{
$expressions = array();
require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
foreach($this->taxFilters as $taxId => $taxNodes)
{
$questionIds = array();
$forceBypass = true;
foreach($taxNodes as $taxNode)
{
$forceBypass = false;
$taxTree = new ilTaxonomyTree($taxId);
$taxNodeAssignment = new ilTaxNodeAssignment($this->parentObjType, $this->parentObjId, 'quest', $taxId);
$subNodes = $taxTree->getSubTreeIds($taxNode);
$subNodes[] = $taxNode;
$taxItems = $taxNodeAssignment->getAssignmentsOfNode($subNodes);
foreach($taxItems as $taxItem)
{
$questionIds[$taxItem['item_id']] = $taxItem['item_id'];
}
}
if( !$forceBypass )
{
$expressions[] = $this->db->in('question_id', $questionIds, false, 'integer');
}
}
return $expressions;
}

+ Here is the caller graph for this function:

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 555 of file class.ilAssQuestionList.php.

{
if( $a_comp_id != 'qpl' || $a_item_type != 'quest' || !(int)$a_item_id )
{
return '';
}
if( !isset($this->questions[$a_item_id]) )
{
return '';
}
return $this->questions[$a_item_id]['title'];
}
ilAssQuestionList::isActiveQuestionType (   $questionData)
private

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

References IL_COMP_MODULE.

Referenced by load().

{
if( !isset($questionData['plugin']) )
{
return false;
}
if( !$questionData['plugin'] )
{
return true;
}
return $this->pluginAdmin->isActive(IL_COMP_MODULE, 'TestQuestionPool', 'qst', $questionData['type_tag']);
}

+ Here is the caller graph for this function:

ilAssQuestionList::isInList (   $questionId)

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

{
return isset($this->questions[$questionId]);
}
ilAssQuestionList::load ( )

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

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

Referenced by ilObjQuestionPoolTaxonomyEditingCommandForwarder\forward().

{
$this->checkFilters();
$query = $this->buildQuery();
#vd($query);
$res = $this->db->query($query);
//echo $this->db->db->last_query;
#vd($this->db->db->last_query);
while( $row = $this->db->fetchAssoc($res) )
{
if( !$this->isActiveQuestionType($row) )
{
continue;
}
$row['taxonomies'] = $this->loadTaxonomyAssignmentData($row['question_id']);
$row['ttype'] = $this->lng->txt($row['type_tag']);
$this->questions[ $row['question_id'] ] = $row;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::loadTaxonomyAssignmentData (   $questionId)
private

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

References getAvailableTaxonomyIds().

Referenced by load().

{
$taxAssignmentData = array();
foreach($this->getAvailableTaxonomyIds() as $taxId)
{
require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
$taxTree = new ilTaxonomyTree($taxId);
$taxAssignment = new ilTaxNodeAssignment('qpl', $this->parentObjId, 'quest', $taxId);
$assignments = $taxAssignment->getAssignmentsOfItem($questionId);
foreach($assignments as $assData)
{
if( !isset($taxAssignmentData[ $assData['tax_id'] ]) )
{
$taxAssignmentData[ $assData['tax_id'] ] = array();
}
$nodeData = $taxTree->getNodeData($assData['node_id']);
$assData['node_lft'] = $nodeData['lft'];
$taxAssignmentData[ $assData['tax_id'] ][ $assData['node_id'] ] = $assData;
}
}
return $taxAssignmentData;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionList::setAnswerStatusActiveId (   $answerStatusActiveId)

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

References $answerStatusActiveId.

Referenced by ilTestDynamicQuestionSet\initCompleteQuestionList(), and ilTestDynamicQuestionSet\initFilteredQuestionList().

{
$this->answerStatusActiveId = $answerStatusActiveId;
}

+ Here is the caller graph for this function:

ilAssQuestionList::setAnswerStatusFilter (   $answerStatusFilter)

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

References $answerStatusFilter.

{
$this->answerStatusFilter = $answerStatusFilter;
}
ilAssQuestionList::setAvailableTaxonomyIds (   $availableTaxonomyIds)

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

References $availableTaxonomyIds.

{
$this->availableTaxonomyIds = $availableTaxonomyIds;
}
ilAssQuestionList::setForcedQuestionIds (   $forcedQuestionIds)
Parameters
array$forcedQuestionIds

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

References $forcedQuestionIds.

{
$this->forcedQuestionIds = $forcedQuestionIds;
}
ilAssQuestionList::setParentObjectType (   $parentObjType)

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

References $parentObjType.

{
$this->parentObjType = $parentObjType;
}
ilAssQuestionList::setQuestionIdsFilter (   $questionIdsFilter)

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

References $questionIdsFilter.

{
$this->questionIdsFilter = $questionIdsFilter;
}
ilAssQuestionList::setQuestionInstanceTypeFilter (   $questionInstanceTypeFilter)

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

References $questionInstanceTypeFilter.

{
$this->questionInstanceTypeFilter = $questionInstanceTypeFilter;
}

Field Documentation

ilAssQuestionList::$answerStatusActiveId = null
private

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

Referenced by getAnswerStatusActiveId(), and setAnswerStatusActiveId().

ilAssQuestionList::$answerStatusFilter = null
private

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

Referenced by getAnswerStatusFilter(), and setAnswerStatusFilter().

ilAssQuestionList::$availableTaxonomyIds = array()
private

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

Referenced by getAvailableTaxonomyIds(), and setAvailableTaxonomyIds().

ilAssQuestionList::$db = null
private

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

Referenced by __construct().

ilAssQuestionList::$fieldFilters = array()
private

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

ilAssQuestionList::$forcedQuestionIds = array()
private

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

Referenced by getForcedQuestionIds(), and setForcedQuestionIds().

ilAssQuestionList::$lng = null
private

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

Referenced by __construct().

ilAssQuestionList::$parentObjId = null
private

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

Referenced by __construct().

ilAssQuestionList::$parentObjType = 'qpl'
private

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

Referenced by getParentObjectType(), and setParentObjectType().

ilAssQuestionList::$pluginAdmin = null
private

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

Referenced by __construct().

ilAssQuestionList::$questionIdsFilter = null
private

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

Referenced by getQuestionIdsFilter(), and setQuestionIdsFilter().

ilAssQuestionList::$questionInstanceTypeFilter = self::QUESTION_INSTANCE_TYPE_ORIGINALS
private
ilAssQuestionList::$questions = array()
private

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

Referenced by getQuestionDataArray().

ilAssQuestionList::$taxFilters = array()
private

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

const ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT = 'allNonCorrect'
const ilAssQuestionList::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY = 'nonAnswered'
const ilAssQuestionList::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY = 'wrongAnswered'
const ilAssQuestionList::QUESTION_ANSWER_STATUS_CORRECT_ANSWERED = 'correctAnswered'
const ilAssQuestionList::QUESTION_ANSWER_STATUS_NON_ANSWERED = 'nonAnswered'

answer status domain for single questions

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

Referenced by ilTestPlayerDynamicQuestionSetGUI\buildQuestionSetAnswerStatisticRowArray().

const ilAssQuestionList::QUESTION_ANSWER_STATUS_WRONG_ANSWERED = 'wrongAnswered'
const ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES = 'QST_INSTANCE_TYPE_DUPLICATES'
const ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS = 'QST_INSTANCE_TYPE_ORIGINALS'

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


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