ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestScoring Class Reference

Class ilTestScoring. More...

+ Collaboration diagram for ilTestScoring:

Public Member Functions

 __construct (ilObjTest $test)
 setPreserveManualScores ($preserve_manual_scores)
 getPreserveManualScores ()
 recalculateSolutions ()
 recalculatePasses ($userdata, $active_id)
 recalculatePass ($passdata, $active_id, $pass)

Protected Attributes

 $test
 $testGUI
 $preserve_manual_scores

Detailed Description

Class ilTestScoring.

This class holds a mechanism to get the scoring for

  • a test,
  • a user in a test,
  • a pass in a users passes in a test, or
  • a question in a pass in a users passes in a test.

Warning: Please use carefully, this is one of the classes that may cause funny spikes on your servers load graph on large datasets in the test.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

ilTestScoring::__construct ( ilObjTest  $test)

Definition at line 34 of file class.ilTestScoring.php.

References $test.

{
$this->test = $test;
$this->preserve_manual_scores = false;
require_once './Modules/Test/classes/class.ilObjTestGUI.php';
$this->testGUI = new ilObjTestGUI();
}

Member Function Documentation

ilTestScoring::getPreserveManualScores ( )
Returns
boolean

Definition at line 54 of file class.ilTestScoring.php.

References $preserve_manual_scores.

ilTestScoring::recalculatePass (   $passdata,
  $active_id,
  $pass 
)
Parameters
$passdata
$active_id
$pass

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

References $pass.

Referenced by recalculatePasses().

{
$questions = $passdata->getAnsweredQuestions();
if (is_array( $questions ))
{
foreach ($questions as $questiondata)
{
$question_gui = $this->test->createQuestionGUI( "", $questiondata['id'] );
$this->recalculateQuestionScore( $question_gui, $active_id, $pass, $questiondata );
}
}
}

+ Here is the caller graph for this function:

ilTestScoring::recalculatePasses (   $userdata,
  $active_id 
)
Parameters
$userdata
$active_id

Definition at line 80 of file class.ilTestScoring.php.

References $filename, $pass, ilTestPDFGenerator\generatePDF(), ilUtil\getWebspaceDir(), ilTestArchiver\handInTestResult(), ilTestPDFGenerator\PDF_OUTPUT_FILE, and recalculatePass().

Referenced by recalculateSolutions().

{
require_once './Modules/Test/classes/class.ilTestEvaluationGUI.php'; // Below!
require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
require_once './Modules/Test/classes/class.ilTestArchiver.php';
$passes = $userdata->getPasses();
foreach ($passes as $pass => $passdata)
{
if (is_object( $passdata ))
{
$this->recalculatePass( $passdata, $active_id, $pass );
if ($this->test->getEnableArchiving())
{
// requires out of the loop!
$test_evaluation_gui = new ilTestEvaluationGUI($this->test);
$result_array = $this->test->getTestResult($active_id, $pass);
$overview = $test_evaluation_gui->getPassListOfAnswers($result_array, $active_id, $pass, true, false, false, true);
$filename = ilUtil::getWebspaceDir() . '/assessment/scores-'.$this->test->getId() . '-' . $active_id . '-' . $pass . '.pdf';
$archiver = new ilTestArchiver($this->test->getId());
$archiver->handInTestResult($active_id, $pass, $filename);
unlink($filename);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestScoring::recalculateSolutions ( )

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

References assQuestion\_updateTestResultCache(), and recalculatePasses().

{
$participants = $this->test->getCompleteEvaluationData(false)->getParticipants();
if (is_array($participants))
{
require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
foreach ($participants as $active_id => $userdata)
{
if (is_object($userdata) && is_array($userdata->getPasses()))
{
$this->recalculatePasses( $userdata, $active_id );
}
}
}
}

+ Here is the call graph for this function:

ilTestScoring::setPreserveManualScores (   $preserve_manual_scores)
Parameters
boolean$preserve_manual_scores

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

References $preserve_manual_scores.

{
$this->preserve_manual_scores = $preserve_manual_scores;
}

Field Documentation

ilTestScoring::$preserve_manual_scores
protected

Definition at line 32 of file class.ilTestScoring.php.

Referenced by getPreserveManualScores(), and setPreserveManualScores().

ilTestScoring::$test
protected

Definition at line 26 of file class.ilTestScoring.php.

Referenced by __construct().

ilTestScoring::$testGUI
protected

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


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