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

Public Member Functions

 __construct (ilDB $db, ilAssQuestionPreviewSession $previewSession)
 requestsExist ()
 requestsPossible ()
 getNextRequestableHint ()
 storeRequest (ilAssQuestionHint $questionHint)
 isRequested ($hintId)
 getNumExistingRequests ()
 getRequestedHintsList ()

Private Attributes

 $db
 $previewSession

Detailed Description

Definition at line 11 of file class.ilAssQuestionPreviewHintTracking.php.

Constructor & Destructor Documentation

ilAssQuestionPreviewHintTracking::__construct ( ilDB  $db,
ilAssQuestionPreviewSession  $previewSession 
)

Definition at line 23 of file class.ilAssQuestionPreviewHintTracking.php.

References $db, and $previewSession.

{
$this->db = $db;
$this->previewSession = $previewSession;
}

Member Function Documentation

ilAssQuestionPreviewHintTracking::getNextRequestableHint ( )

Definition at line 58 of file class.ilAssQuestionPreviewHintTracking.php.

References $query, $res, $row, ilAssQuestionHint\getInstanceById(), and isRequested().

{
$query = "
SELECT qht_hint_id
FROM qpl_hints
WHERE qht_question_fi = %s
ORDER BY qht_hint_index ASC
";
$res = $this->db->queryF(
$query, array('integer'), array($this->previewSession->getQuestionId())
);
while( $row = $this->db->fetchAssoc($res) )
{
if( !$this->isRequested($row['qht_hint_id']) )
{
return ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
}
}
throw new ilTestException(
"no next hint found for questionId={$this->previewSession->getQuestionId()}, userId={$this->previewSession->getUserId()}"
);
}

+ Here is the call graph for this function:

ilAssQuestionPreviewHintTracking::getNumExistingRequests ( )

Definition at line 97 of file class.ilAssQuestionPreviewHintTracking.php.

{
return $this->previewSession->getNumRequestedHints();
}
ilAssQuestionPreviewHintTracking::getRequestedHintsList ( )

Definition at line 102 of file class.ilAssQuestionPreviewHintTracking.php.

References ilAssQuestionHintList\getListByHintIds().

{
$hintIds = $this->previewSession->getRequestedHints();
$requestedHintsList = ilAssQuestionHintList::getListByHintIds($hintIds);
return $requestedHintsList;
}

+ Here is the call graph for this function:

ilAssQuestionPreviewHintTracking::isRequested (   $hintId)

Definition at line 92 of file class.ilAssQuestionPreviewHintTracking.php.

Referenced by getNextRequestableHint().

{
return $this->previewSession->isHintRequested($hintId);
}

+ Here is the caller graph for this function:

ilAssQuestionPreviewHintTracking::requestsExist ( )

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

{
return (
$this->previewSession->getNumRequestedHints() > 0
);
}
ilAssQuestionPreviewHintTracking::requestsPossible ( )

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

References $query, $res, and $row.

{
$query = "
SELECT COUNT(qht_hint_id) cnt_available
FROM qpl_hints
WHERE qht_question_fi = %s
";
$res = $this->db->queryF(
$query, array('integer'), array($this->previewSession->getQuestionId())
);
$row = $this->db->fetchAssoc($res);
if( $row['cnt_available'] > $this->previewSession->getNumRequestedHints() )
{
return true;
}
return false;
}
ilAssQuestionPreviewHintTracking::storeRequest ( ilAssQuestionHint  $questionHint)

Definition at line 87 of file class.ilAssQuestionPreviewHintTracking.php.

References ilAssQuestionHint\getId().

{
$this->previewSession->addRequestedHint($questionHint->getId());
}

+ Here is the call graph for this function:

Field Documentation

ilAssQuestionPreviewHintTracking::$db
private

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

Referenced by __construct().

ilAssQuestionPreviewHintTracking::$previewSession
private

Definition at line 21 of file class.ilAssQuestionPreviewHintTracking.php.

Referenced by __construct().


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