ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 178 of file class.ilTestScoring.php.

References $pass, and array.

Referenced by recalculatePasses().

179  {
180  if( !is_array($this->recalculatedPasses[$activeId]) )
181  {
182  $this->recalculatedPasses[$activeId] = array();
183  }
184 
185  $this->recalculatedPasses[$activeId][] = $pass;
186  }
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 173 of file class.ilTestScoring.php.

References $recalculatedPasses.

174  {
176  }

◆ recalculatePass()

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

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

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

Referenced by recalculatePasses().

103  {
104  $questions = $passdata->getAnsweredQuestions();
105  if (is_array( $questions ))
106  {
107  foreach ($questions as $questiondata)
108  {
109  $question_gui = $this->test->createQuestionGUI( "", $questiondata['id'] );
110  $this->recalculateQuestionScore( $question_gui, $active_id, $pass, $questiondata );
111  }
112  }
113 
114  }
+ 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 84 of file class.ilTestScoring.php.

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

Referenced by recalculateSolutions().

85  {
86  $passes = $userdata->getPasses();
87  foreach ($passes as $pass => $passdata)
88  {
89  if (is_object( $passdata ))
90  {
91  $this->recalculatePass( $passdata, $active_id, $pass );
92  $this->addRecalculatedPassByActive($active_id, $pass);
93  }
94  }
95  }
recalculatePass($passdata, $active_id, $pass)
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 assQuestion\_updateTestResultCache(), and recalculatePasses().

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

◆ resetRecalculatedPassesByActives()

ilTestScoring::resetRecalculatedPassesByActives ( )

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

References array.

169  {
170  $this->recalculatedPasses = array();
171  }
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: