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

Public Member Functions

 __construct (ilDB $db, ilObjTest $testOBJ)
 isAdminModeEnabled ()
 setAdminModeEnabled ($adminModeEnabled)
 getActiveId ()
 setActiveId ($activeId)
 getLastFinishedPass ()
 setLastFinishedPass ($lastFinishedPass)
 getExistingPasses ()
 getNumExistingPasses ()
 getClosedPasses ()
 getReportablePasses ()

Protected Attributes

 $db
 $testOBJ

Private Member Functions

 loadExistingPasses ()
 fetchReportablePasses ($existingPasses)
 fetchClosedPasses ($existingPasses)
 fetchLastPass ($existingPasses)
 isReportablePass ($lastPass, $pass)
 isClosedPass ($pass)
 isReportingDateReached ()
 isProcessingTimeReached ($pass)

Private Attributes

 $adminModeEnabled
 $activeId
 $lastFinishedPass

Detailed Description

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

Constructor & Destructor Documentation

ilTestPassesSelector::__construct ( ilDB  $db,
ilObjTest  $testOBJ 
)

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

References $db, and $testOBJ.

{
$this->db = $db;
$this->testOBJ = $testOBJ;
$this->adminModeEnabled = false;
}

Member Function Documentation

ilTestPassesSelector::fetchClosedPasses (   $existingPasses)
private

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

References $pass, and isClosedPass().

Referenced by getClosedPasses().

{
$closedPasses = array();
foreach($existingPasses as $pass)
{
if( $this->isClosedPass($pass) )
{
$closedPasses[] = $pass;
}
}
return $closedPasses;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestPassesSelector::fetchLastPass (   $existingPasses)
private

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

References $pass.

Referenced by fetchReportablePasses().

{
$lastPass = null;
foreach($existingPasses as $pass)
{
if( $lastPass === null || $pass > $lastPass )
{
$lastPass = $pass;
}
}
return $lastPass;
}

+ Here is the caller graph for this function:

ilTestPassesSelector::fetchReportablePasses (   $existingPasses)
private

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

References $pass, fetchLastPass(), and isReportablePass().

Referenced by getReportablePasses().

{
$lastPass = $this->fetchLastPass($existingPasses);
$reportablePasses = array();
foreach($existingPasses as $pass)
{
if( $this->isReportablePass($lastPass, $pass) )
{
$reportablePasses[] = $pass;
}
}
return $reportablePasses;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestPassesSelector::getActiveId ( )

Definition at line 41 of file class.ilTestPassesSelector.php.

References $activeId.

Referenced by isProcessingTimeReached(), and loadExistingPasses().

{
}

+ Here is the caller graph for this function:

ilTestPassesSelector::getClosedPasses ( )

Definition at line 71 of file class.ilTestPassesSelector.php.

References fetchClosedPasses(), and loadExistingPasses().

{
$existingPasses = $this->loadExistingPasses();
$closedPasses = $this->fetchClosedPasses($existingPasses);
return $closedPasses;
}

+ Here is the call graph for this function:

ilTestPassesSelector::getExistingPasses ( )

Definition at line 61 of file class.ilTestPassesSelector.php.

References loadExistingPasses().

{
return $this->loadExistingPasses();
}

+ Here is the call graph for this function:

ilTestPassesSelector::getLastFinishedPass ( )

Definition at line 51 of file class.ilTestPassesSelector.php.

References $lastFinishedPass.

Referenced by isClosedPass().

+ Here is the caller graph for this function:

ilTestPassesSelector::getNumExistingPasses ( )

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

References loadExistingPasses().

{
return count($this->loadExistingPasses());
}

+ Here is the call graph for this function:

ilTestPassesSelector::getReportablePasses ( )

Definition at line 79 of file class.ilTestPassesSelector.php.

References fetchReportablePasses(), isAdminModeEnabled(), and loadExistingPasses().

{
$existingPasses = $this->loadExistingPasses();
if( $this->isAdminModeEnabled() )
{
return $existingPasses;
}
$reportablePasses = $this->fetchReportablePasses($existingPasses);
return $reportablePasses;
}

+ Here is the call graph for this function:

ilTestPassesSelector::isAdminModeEnabled ( )

Definition at line 31 of file class.ilTestPassesSelector.php.

References $adminModeEnabled.

Referenced by getReportablePasses().

+ Here is the caller graph for this function:

ilTestPassesSelector::isClosedPass (   $pass)
private

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

References $pass, getLastFinishedPass(), and isProcessingTimeReached().

Referenced by fetchClosedPasses(), and isReportablePass().

{
if( $pass <= $this->getLastFinishedPass() )
{
return true;
}
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestPassesSelector::isProcessingTimeReached (   $pass)
private

Definition at line 220 of file class.ilTestPassesSelector.php.

References $pass, and getActiveId().

Referenced by isClosedPass().

{
if( !$this->testOBJ->getEnableProcessingTime() )
{
return false;
}
$startingTime = $this->testOBJ->getStartingTimeOfUser($this->getActiveId(), $pass);
if($startingTime === FALSE)
{
return false;
}
return $this->testOBJ->isMaxProcessingTimeReached($startingTime, $this->getActiveId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestPassesSelector::isReportablePass (   $lastPass,
  $pass 
)
private

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

References $pass, isClosedPass(), isReportingDateReached(), ilObjTest\SCORE_REPORTING_DATE, ilObjTest\SCORE_REPORTING_FINISHED, and ilObjTest\SCORE_REPORTING_IMMIDIATLY.

Referenced by fetchReportablePasses().

{
switch( $this->testOBJ->getScoreReporting() )
{
return true;
return $this->isReportingDateReached();
if($pass < $lastPass)
{
return true;
}
return $this->isClosedPass($pass);
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestPassesSelector::isReportingDateReached ( )
private

Definition at line 204 of file class.ilTestPassesSelector.php.

Referenced by isReportablePass().

{
$reg = '/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/';
$date = $this->testOBJ->getReportingDate();
$matches = null;
if( !preg_match($reg, $date, $matches) )
{
return false;
}
$repTS = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
return time() >= $repTS;
}

+ Here is the caller graph for this function:

ilTestPassesSelector::loadExistingPasses ( )
private

Definition at line 93 of file class.ilTestPassesSelector.php.

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

Referenced by getClosedPasses(), getExistingPasses(), getNumExistingPasses(), and getReportablePasses().

{
$query = "
SELECT DISTINCT tst_pass_result.pass FROM tst_pass_result
LEFT JOIN tst_test_result
ON tst_pass_result.pass = tst_test_result.pass
AND tst_pass_result.active_fi = tst_test_result.active_fi
WHERE tst_pass_result.active_fi = %s
";
$res = $this->db->queryF(
$query, array('integer'), array($this->getActiveId())
);
$existingPasses = array();
while( $row = $this->db->fetchAssoc($res) )
{
$existingPasses[] = $row['pass'];
}
return $existingPasses;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestPassesSelector::setActiveId (   $activeId)

Definition at line 46 of file class.ilTestPassesSelector.php.

References $activeId.

{
$this->activeId = $activeId;
}
ilTestPassesSelector::setAdminModeEnabled (   $adminModeEnabled)

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

References $adminModeEnabled.

{
$this->adminModeEnabled = $adminModeEnabled;
}
ilTestPassesSelector::setLastFinishedPass (   $lastFinishedPass)

Definition at line 56 of file class.ilTestPassesSelector.php.

References $lastFinishedPass.

{
$this->lastFinishedPass = $lastFinishedPass;
}

Field Documentation

ilTestPassesSelector::$activeId
private

Definition at line 19 of file class.ilTestPassesSelector.php.

Referenced by getActiveId(), and setActiveId().

ilTestPassesSelector::$adminModeEnabled
private

Definition at line 17 of file class.ilTestPassesSelector.php.

Referenced by isAdminModeEnabled(), and setAdminModeEnabled().

ilTestPassesSelector::$db
protected

Definition at line 13 of file class.ilTestPassesSelector.php.

Referenced by __construct().

ilTestPassesSelector::$lastFinishedPass
private

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

Referenced by getLastFinishedPass(), and setLastFinishedPass().

ilTestPassesSelector::$testOBJ
protected

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

Referenced by __construct().


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