ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 
 resetRecalculatedPassesByActives ()
 
 getRecalculatedPassesByActives ()
 
 addRecalculatedPassByActive ($activeId, $pass)
 

Protected Attributes

 $test
 
 $testGUI
 
 $preserve_manual_scores
 

Private Attributes

 $recalculatedPasses
 

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

◆ __construct()

ilTestScoring::__construct ( ilObjTest  $test)

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

References $test, and array.

37  {
38  $this->test = $test;
39  $this->preserve_manual_scores = false;
40 
41  $this->recalculatedPasses = array();
42 
43  require_once './Modules/Test/classes/class.ilObjTestGUI.php';
44  $this->testGUI = new ilObjTestGUI();
45  }
Class ilObjTestGUI.
Create styles array
The data for the language used.

Member Function Documentation

◆ addRecalculatedPassByActive()

ilTestScoring::addRecalculatedPassByActive (   $activeId,
  $pass 
)

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

References $pass, and array.

Referenced by recalculatePasses().

167  {
168  if (!is_array($this->recalculatedPasses[$activeId])) {
169  $this->recalculatedPasses[$activeId] = array();
170  }
171 
172  $this->recalculatedPasses[$activeId][] = $pass;
173  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getPreserveManualScores()

ilTestScoring::getPreserveManualScores ( )
Returns
boolean

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

References $preserve_manual_scores.

59  {
61  }

◆ getRecalculatedPassesByActives()

ilTestScoring::getRecalculatedPassesByActives ( )

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

References $recalculatedPasses.

162  {
164  }

◆ recalculatePass()

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

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

References $pass, assQuestion\_setReachedPoints(), and assQuestion\setForcePassResultUpdateEnabled().

Referenced by recalculatePasses().

98  {
99  $questions = $passdata->getAnsweredQuestions();
100  if (is_array($questions)) {
101  foreach ($questions as $questiondata) {
102  $question_gui = $this->test->createQuestionGUI("", $questiondata['id']);
103  $this->recalculateQuestionScore($question_gui, $active_id, $pass, $questiondata);
104  }
105  }
106  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recalculatePasses()

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

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

References $pass, $userdata, addRecalculatedPassByActive(), and recalculatePass().

Referenced by recalculateSolutions().

82  {
83  $passes = $userdata->getPasses();
84  foreach ($passes as $pass => $passdata) {
85  if (is_object($passdata)) {
86  $this->recalculatePass($passdata, $active_id, $pass);
87  $this->addRecalculatedPassByActive($active_id, $pass);
88  }
89  }
90  }
recalculatePass($passdata, $active_id, $pass)
$userdata
Definition: demo.php:48
addRecalculatedPassByActive($activeId, $pass)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recalculateSolutions()

ilTestScoring::recalculateSolutions ( )

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

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

64  {
65  $participants = $this->test->getCompleteEvaluationData(false)->getParticipants();
66  if (is_array($participants)) {
67  require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
68  foreach ($participants as $active_id => $userdata) {
69  if (is_object($userdata) && is_array($userdata->getPasses())) {
70  $this->recalculatePasses($userdata, $active_id);
71  }
73  }
74  }
75  }
static _updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
Move this to a proper place.
$userdata
Definition: demo.php:48
recalculatePasses($userdata, $active_id)
+ Here is the call graph for this function:

◆ resetRecalculatedPassesByActives()

ilTestScoring::resetRecalculatedPassesByActives ( )

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

References array.

157  {
158  $this->recalculatedPasses = array();
159  }
Create styles array
The data for the language used.

◆ setPreserveManualScores()

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

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

References $preserve_manual_scores.

51  {
52  $this->preserve_manual_scores = $preserve_manual_scores;
53  }

Field Documentation

◆ $preserve_manual_scores

ilTestScoring::$preserve_manual_scores
protected

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

Referenced by getPreserveManualScores(), and setPreserveManualScores().

◆ $recalculatedPasses

ilTestScoring::$recalculatedPasses
private

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

Referenced by getRecalculatedPassesByActives().

◆ $test

ilTestScoring::$test
protected

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

Referenced by __construct().

◆ $testGUI

ilTestScoring::$testGUI
protected

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


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