ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestService Class Reference

Service class for tests. More...

+ Collaboration diagram for ilTestService:

Public Member Functions

 __construct (ilObjTest $a_object)
 public
 getPassOverviewData ($active_id, $short=false)
 public ilObjUser $ilUser
 getManScoringQuestionGuiList ($activeId, $pass)
 Returns the list of answers of a users test pass and offers a scoring option.

Static Public Member Functions

static isManScoringDone ($activeId)
 reads the flag wether manscoring is done for the given test active or not from the global settings (scope: assessment / key: manscoring_done_<activeId>)
static setManScoringDone ($activeId, $manScoringDone)
 stores the flag wether manscoring is done for the given test active or not within the global settings (scope: assessment / key: manscoring_done_<activeId>)

Protected Attributes

 $object = null

Detailed Description

Service class for tests.

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

ilTestService::__construct ( ilObjTest  $a_object)

public

Parameters
ilObjTest$a_object

Definition at line 25 of file class.ilTestService.php.

{
$this->object = $a_object;
}

Member Function Documentation

ilTestService::getManScoringQuestionGuiList (   $activeId,
  $pass 
)

Returns the list of answers of a users test pass and offers a scoring option.

public

Parameters
integer$active_idActive ID of the active user
integer$passTest pass
Returns
string HTML code of the list of answers

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

References $pass, and ilObjAssessmentFolder\_getManualScoring().

{
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
$manScoringQuestionTypes = ilObjAssessmentFolder::_getManualScoring();
$testResultData = $this->object->getTestResult($activeId, $pass);
$manScoringQuestionGuiList = array();
foreach($testResultData as $questionData)
{
if( !isset($questionData['qid']) )
{
continue;
}
if( !isset($questionData['type']) )
{
throw new ilTestException('no question type given!');
}
$questionGUI = $this->object->createQuestionGUI("", $questionData['qid']);
if( !in_array($questionGUI->object->getQuestionTypeID(), $manScoringQuestionTypes) )
{
continue;
}
$manScoringQuestionGuiList[ $questionData['qid'] ] = $questionGUI;
}
return $manScoringQuestionGuiList;
}

+ Here is the call graph for this function:

ilTestService::getPassOverviewData (   $active_id,
  $short = false 
)

public ilObjUser $ilUser

Parameters
integer$active_id
boolean$short
Returns
array $passOverwiewData

Definition at line 37 of file class.ilTestService.php.

References $ilUser, and $pass.

{
$passOverwiewData = array();
global $ilUser;
$scoredPass = $this->object->_getResultPass($active_id);
$lastPass = $this->object->_getPass($active_id);
$testPercentage = 0;
$testReachedPoints = 0;
$testMaxPoints = 0;
for( $pass = 0; $pass <= $lastPass; $pass++)
{
$passFinishDate = $this->object->getPassFinishDate($active_id, $pass);
if( $passFinishDate <= 0 )
{
continue;
}
if( !$short )
{
$resultData =& $this->object->getTestResult($active_id, $pass);
if (!$resultData["pass"]["total_max_points"])
{
$passPercentage = 0;
}
else
{
$passPercentage = ($resultData["pass"]["total_reached_points"]/$resultData["pass"]["total_max_points"])*100;
}
$passMaxPoints = $resultData["pass"]["total_max_points"];
$passReachedPoints = $resultData["pass"]["total_reached_points"];
$passAnsweredQuestions = $this->object->getAnsweredQuestionCount($active_id, $pass);
$passTotalQuestions = count($resultData) - 2;
if( $pass == $scoredPass )
{
$isScoredPass = true;
if (!$resultData["test"]["total_max_points"])
{
$testPercentage = 0;
}
else
{
$testPercentage = ($resultData["test"]["total_reached_points"]/$resultData["test"]["total_max_points"])*100;
}
$testMaxPoints = $resultData["test"]["total_max_points"];
$testReachedPoints = $resultData["test"]["total_reached_points"];
$passOverwiewData['test'] = array(
'active_id' => $active_id,
'scored_pass' => $scoredPass,
'max_points' => $testMaxPoints,
'reached_points' => $testReachedPoints,
'percentage' => $testPercentage
);
}
else $isScoredPass = false;
$passOverwiewData['passes'][] = array(
'active_id' => $active_id,
'pass' => $pass,
'finishdate' => $passFinishDate,
'max_points' => $passMaxPoints,
'reached_points' => $passReachedPoints,
'percentage' => $passPercentage,
'answered_questions' => $passAnsweredQuestions,
'total_questions' => $passTotalQuestions,
'is_scored_pass' => $isScoredPass
);
}
}
return $passOverwiewData;
}
static ilTestService::isManScoringDone (   $activeId)
static

reads the flag wether manscoring is done for the given test active or not from the global settings (scope: assessment / key: manscoring_done_<activeId>)

public

Parameters
integer$activeId
Returns
boolean $manScoringDone

Definition at line 172 of file class.ilTestService.php.

Referenced by ilTestScoringGUI\buildManScoringParticipantForm().

{
$assessmentSetting = new ilSetting("assessment");
return $assessmentSetting->get("manscoring_done_" . $activeId, false);
}

+ Here is the caller graph for this function:

static ilTestService::setManScoringDone (   $activeId,
  $manScoringDone 
)
static

stores the flag wether manscoring is done for the given test active or not within the global settings (scope: assessment / key: manscoring_done_<activeId>)

public

Parameters
integer$activeId
boolean$manScoringDone

Definition at line 187 of file class.ilTestService.php.

Referenced by ilTestScoringGUI\saveManScoringParticipantScreen().

{
$assessmentSetting = new ilSetting("assessment");
$assessmentSetting->set("manscoring_done_" . $activeId, (bool)$manScoringDone);
}

+ Here is the caller graph for this function:

Field Documentation

ilTestService::$object = null
protected

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


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