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

Public Member Functions

 __construct ($questionId, $activeId, $pass)
 setActiveId ($activeId)
 getActiveId ()
 setPass ($pass)
 getPass ()
 setQuestionId ($questionId)
 getQuestionId ()
 requestsExist ()
 Returns the fact wether there exists hint requests for the given question relating to the given testactive and testpass or not.
 getNumExistingRequests ()
 Returns the number existing hint requests for the given question relating to the given testactive and testpass or not.
 requestsPossible ()
 Returns the fact wether (further) hint requests are possible for the given question relating to the given testactive and testpass or not.
 isRequested ($hintId)
 Returns the fact wether the hint for given id is requested for the given testactive and testpass.
 getNextRequestableHint ()
 Returns the next requestable hint for given question relating to given testactive and testpass.
 getRequestedHintsList ()
 Returns an object of class ilAssQuestionHintList containing objects of class ilAssQuestionHint for all allready requested hints relating to the given question, testactive and testpass.
 storeRequest (ilAssQuestionHint $questionHint)
 Tracks the given hint as requested for the given question, testactive and testpass.
 getRequestStatisticDataByQuestionAndTestpass ()
 Returns a question hint request statistic data container containing the statistics for all requests relating to given ...
 deleteRequestsByQuestionIds ($questionIds)
 Deletes all hint requests relating to a question included in given question ids.
 deleteRequestsByActiveIds ($activeIds)
 Deletes all hint requests relating to a testactive included in given active ids.

Private Attributes

 $questionId
 $activeId
 $pass

Detailed Description

Definition at line 14 of file class.ilAssQuestionHintTracking.php.

Constructor & Destructor Documentation

ilAssQuestionHintTracking::__construct (   $questionId,
  $activeId,
  $pass 
)

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

References $activeId, $pass, and $questionId.

{
$this->questionId = $questionId;
$this->activeId = $activeId;
$this->pass = $pass;
}

Member Function Documentation

ilAssQuestionHintTracking::deleteRequestsByActiveIds (   $activeIds)

Deletes all hint requests relating to a testactive included in given active ids.

public ilDB $ilDB

Parameters
array[integer]$activeIds

Definition at line 376 of file class.ilAssQuestionHintTracking.php.

References $ilDB, and $query.

Referenced by ilObjTest\removeAllTestEditings(), ilObjTest\removeTestResultsByActiveIds(), and ilObjTest\removeTestResultsForUser().

{
global $ilDB;
$__active_fi__IN__activeIds = $ilDB->in('qhtr_active_fi', $activeIds, false, 'integer');
$query = "
DELETE FROM qpl_hint_tracking
WHERE $__active_fi__IN__activeIds
";
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

ilAssQuestionHintTracking::deleteRequestsByQuestionIds (   $questionIds)

Deletes all hint requests relating to a question included in given question ids.

public ilDB $ilDB

Parameters
array[integer]$questionIds

Definition at line 355 of file class.ilAssQuestionHintTracking.php.

References $ilDB, and $query.

Referenced by assQuestion\delete(), and ilObjTest\removeAllTestEditings().

{
global $ilDB;
$__question_fi__IN__questionIds = $ilDB->in('qhtr_question_fi', $questionIds, false, 'integer');
$query = "
DELETE FROM qpl_hint_tracking
WHERE $__question_fi__IN__questionIds
";
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

ilAssQuestionHintTracking::getActiveId ( )
ilAssQuestionHintTracking::getNextRequestableHint ( )

Returns the next requestable hint for given question relating to given testactive and testpass.

public ilDB $ilDB

Returns
ilAssQuestionHint $nextRequestableHint
Exceptions
ilTestException

Definition at line 196 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, getActiveId(), ilAssQuestionHint\getInstanceById(), getPass(), and getQuestionId().

{
global $ilDB;
$query = "
SELECT qht_hint_id
FROM qpl_hints
LEFT JOIN qpl_hint_tracking
ON qhtr_hint_fi = qht_hint_id
AND qhtr_active_fi = %s
AND qhtr_pass = %s
WHERE qht_question_fi = %s
AND qhtr_track_id IS NULL
ORDER BY qht_hint_index ASC
";
$ilDB->setLimit(1);
$res = $ilDB->queryF(
$query, array('integer', 'integer', 'integer'),
array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
);
while( $row = $ilDB->fetchAssoc($res) )
{
$nextHint = ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
return $nextHint;
}
throw new ilTestException(
"no next hint found for questionId={$this->getQuestionId()}, activeId={$this->getActiveId()}, pass={$this->getPass()}"
);
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::getNumExistingRequests ( )

Returns the number existing hint requests for the given question relating to the given testactive and testpass or not.

public ilDB $ilDB

Returns
integer $numExisingRequests

Definition at line 85 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, getActiveId(), getPass(), and getQuestionId().

{
global $ilDB;
$query = "
SELECT COUNT(qhtr_track_id) cnt
FROM qpl_hint_tracking
WHERE qhtr_question_fi = %s
AND qhtr_active_fi = %s
AND qhtr_pass = %s
";
$res = $ilDB->queryF(
$query, array('integer', 'integer', 'integer'),
array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
);
$row = $ilDB->fetchAssoc($res);
return $row['cnt'];
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::getPass ( )
ilAssQuestionHintTracking::getQuestionId ( )
ilAssQuestionHintTracking::getRequestedHintsList ( )

Returns an object of class ilAssQuestionHintList containing objects of class ilAssQuestionHint for all allready requested hints relating to the given question, testactive and testpass.

public ilDB $ilDB

Returns
ilAssQuestionHintList $requestedHintsList

Definition at line 244 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, getActiveId(), ilAssQuestionHintList\getListByHintIds(), getPass(), and getQuestionId().

{
global $ilDB;
$query = "
SELECT qhtr_hint_fi
FROM qpl_hint_tracking
WHERE qhtr_question_fi = %s
AND qhtr_active_fi = %s
AND qhtr_pass = %s
";
$res = $ilDB->queryF(
$query, array('integer', 'integer', 'integer'),
array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
);
$hintIds = array();
while( $row = $ilDB->fetchAssoc($res) )
{
$hintIds[] = $row['qhtr_hint_fi'];
}
$requestedHintsList = ilAssQuestionHintList::getListByHintIds($hintIds);
return $requestedHintsList;
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::getRequestStatisticDataByQuestionAndTestpass ( )

Returns a question hint request statistic data container containing the statistics for all requests relating to given ...

  • question
  • testactive
  • testpass

public ilDB $ilDB

Returns
ilAssQuestionHintRequestStatisticData $requestsStatisticData

Definition at line 309 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, getActiveId(), getPass(), and getQuestionId().

{
global $ilDB;
$query = "
SELECT COUNT(qhtr_track_id) requests_count,
SUM(qht_hint_points) requests_points
FROM qpl_hint_tracking
INNER JOIN qpl_hints
ON qht_hint_id = qhtr_hint_fi
WHERE qhtr_question_fi = %s
AND qhtr_active_fi = %s
AND qhtr_pass = %s
";
$res = $ilDB->queryF(
$query, array('integer', 'integer', 'integer'),
array($this->getQuestionId(), $this->getActiveId(), $this->getPass())
);
$row = $ilDB->fetchAssoc($res);
if( $row['requests_points'] === null )
{
$row['requests_points'] = 0;
}
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestStatisticData.php';
$requestsStatisticData = new ilAssQuestionHintRequestStatisticData();
$requestsStatisticData->setRequestsCount($row['requests_count']);
$requestsStatisticData->setRequestsPoints($row['requests_points']);
return $requestsStatisticData;
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::isRequested (   $hintId)

Returns the fact wether the hint for given id is requested for the given testactive and testpass.

public ilDB $ilDB

Parameters
integer$hintId
Returns
boolean $isRequested

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

References $ilDB, $query, $res, $row, getActiveId(), and getPass().

{
global $ilDB;
$query = "
SELECT COUNT(qhtr_track_id) cnt
FROM qpl_hint_tracking
WHERE qhtr_hint_fi = %s
AND qhtr_active_fi = %s
AND qhtr_pass = %s
";
$res = $ilDB->queryF(
$query, array('integer', 'integer', 'integer'), array($hintId, $this->getActiveId(), $this->getPass())
);
$row = $ilDB->fetchAssoc($res);
if( $row['cnt'] > 0 )
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::requestsExist ( )

Returns the fact wether there exists hint requests for the given question relating to the given testactive and testpass or not.

public ilDB $ilDB

Returns
boolean $requestsExist

Definition at line 67 of file class.ilAssQuestionHintTracking.php.

References getActiveId(), getPass(), and getQuestionId().

{
if( self::getNumExistingRequests($this->getQuestionId(), $this->getActiveId(), $this->getPass()) > 0 )
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::requestsPossible ( )

Returns the fact wether (further) hint requests are possible for the given question relating to the given testactive and testpass or not.

public ilDB $ilDB

Returns
boolean $requestsPossible

Definition at line 117 of file class.ilAssQuestionHintTracking.php.

References $ilDB, $query, $res, $row, getActiveId(), getPass(), and getQuestionId().

{
global $ilDB;
$query = "
SELECT COUNT(qht_hint_id) cnt_available,
COUNT(qhtr_track_id) cnt_requested
FROM qpl_hints
LEFT JOIN qpl_hint_tracking
ON qhtr_hint_fi = qht_hint_id
AND qhtr_active_fi = %s
AND qhtr_pass = %s
WHERE qht_question_fi = %s
";
$res = $ilDB->queryF(
$query, array('integer', 'integer', 'integer'),
array($this->getActiveId(), $this->getPass(), $this->getQuestionId())
);
$row = $ilDB->fetchAssoc($res);
if( $row['cnt_available'] > $row['cnt_requested'] )
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilAssQuestionHintTracking::setActiveId (   $activeId)

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

References $activeId.

{
$this->activeId = $activeId;
}
ilAssQuestionHintTracking::setPass (   $pass)

Definition at line 39 of file class.ilAssQuestionHintTracking.php.

References $pass.

{
$this->pass = $pass;
}
ilAssQuestionHintTracking::setQuestionId (   $questionId)

Definition at line 49 of file class.ilAssQuestionHintTracking.php.

References $questionId.

{
$this->questionId = $questionId;
}
ilAssQuestionHintTracking::storeRequest ( ilAssQuestionHint  $questionHint)

Tracks the given hint as requested for the given question, testactive and testpass.

public ilDB $ilDB

Parameters
ilAssQuestionHint$questionHint

Definition at line 283 of file class.ilAssQuestionHintTracking.php.

References $ilDB, getActiveId(), ilAssQuestionHint\getId(), getPass(), and getQuestionId().

{
global $ilDB;
$trackId = $ilDB->nextId('qpl_hint_tracking');
$ilDB->insert('qpl_hint_tracking', array(
'qhtr_track_id' => array('integer', $trackId),
'qhtr_active_fi' => array('integer', $this->getActiveId()),
'qhtr_pass' => array('integer', $this->getPass()),
'qhtr_question_fi' => array('integer', $this->getQuestionId()),
'qhtr_hint_fi' => array('integer', $questionHint->getId()),
));
}

+ Here is the call graph for this function:

Field Documentation

ilAssQuestionHintTracking::$activeId
private

Definition at line 18 of file class.ilAssQuestionHintTracking.php.

Referenced by __construct(), getActiveId(), and setActiveId().

ilAssQuestionHintTracking::$pass
private

Definition at line 20 of file class.ilAssQuestionHintTracking.php.

Referenced by __construct(), getPass(), and setPass().

ilAssQuestionHintTracking::$questionId
private

Definition at line 16 of file class.ilAssQuestionHintTracking.php.

Referenced by __construct(), getQuestionId(), and setQuestionId().


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