ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestEvaluationPassData Class Reference
+ Collaboration diagram for ilTestEvaluationPassData:

Public Member Functions

 __sleep ()
 
 __construct ()
 Constructor. More...
 
 getNrOfAnsweredQuestions ()
 
 setNrOfAnsweredQuestions (int $nrOfAnsweredQuestions)
 
 getReachedPoints ()
 
 setReachedPoints (float $reachedpoints)
 
 getMaxPoints ()
 
 setMaxPoints (float $maxpoints)
 
 getQuestionCount ()
 
 setQuestionCount (int $questioncount)
 
 getWorkingTime ()
 
 setWorkingTime (int $workingtime)
 
 getPass ()
 
 setPass (int $pass)
 
 getAnsweredQuestions ()
 
 addAnsweredQuestion (int $question_id, float $max_points, float $reached_points, bool $isAnswered, ?int $sequence=null, int $manual=0)
 
 getAnsweredQuestion (int $index)
 
 getAnsweredQuestionByQuestionId (int $question_id)
 
 getAnsweredQuestionCount ()
 
 getRequestedHintsCount ()
 
 setRequestedHintsCount (int $requestedHintsCount)
 
 getDeductedHintPoints ()
 
 setDeductedHintPoints (float $deductedHintPoints)
 
 setObligationsAnswered (bool $obligationsAnswered)
 
 getExamId ()
 
 setExamId (string $exam_id)
 
 areObligationsAnswered ()
 getter for property obligationsAnswered. More...
 

Data Fields

array $answeredQuestions
 

Private Attributes

int $workingtime
 
int $questioncount
 
float $maxpoints
 
float $reachedpoints
 
int $nrOfAnsweredQuestions
 
int $pass
 
int $requestedHintsCount = null
 
float $deductedHintPoints = null
 
bool $obligationsAnswered = false
 
string $exam_id = ''
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestEvaluationPassData::__construct ( )

Constructor.

public

Definition at line 62 of file class.ilTestEvaluationPassData.php.

63  {
64  $this->answeredQuestions = [];
65  }

Member Function Documentation

◆ __sleep()

ilTestEvaluationPassData::__sleep ( )

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

52  {
53  return array('answeredQuestions', 'pass', 'nrOfAnsweredQuestions', 'reachedpoints',
54  'maxpoints', 'questioncount', 'workingtime', 'examId');
55  }

◆ addAnsweredQuestion()

ilTestEvaluationPassData::addAnsweredQuestion ( int  $question_id,
float  $max_points,
float  $reached_points,
bool  $isAnswered,
?int  $sequence = null,
int  $manual = 0 
)

Definition at line 132 of file class.ilTestEvaluationPassData.php.

Referenced by ilTestEvaluationFactory\addQuestionToAttempt().

139  : void {
140  $this->answeredQuestions[] = [
141  "id" => $question_id,
142  "points" => round($max_points, 2),
143  "reached" => round($reached_points, 2),
144  'isAnswered' => $isAnswered,
145  "sequence" => $sequence,
146  'manual' => $manual
147  ];
148  }
+ Here is the caller graph for this function:

◆ areObligationsAnswered()

ilTestEvaluationPassData::areObligationsAnswered ( )

getter for property obligationsAnswered.

if property wasn't set yet the method is trying to determine this information by iterating over the added questions. if both wasn't possible the method throws an exception

Definition at line 216 of file class.ilTestEvaluationPassData.php.

References $obligationsAnswered.

216  : ?bool
217  {
218  if (!is_null($this->obligationsAnswered)) {
220  }
221 
222  if (is_array($this->answeredQuestions) && $this->answeredQuestions !== []) {
223  foreach ($this->answeredQuestions as $question) {
224  if (!$question['isAnswered']) {
225  return false;
226  }
227  }
228 
229  return true;
230  }
231 
232  throw new ilTestEvaluationException(
233  'Neither the boolean property ilTestEvaluationPassData::obligationsAnswered was set, ' .
234  'nor the property array property ilTestEvaluationPassData::answeredQuestions contains elements!'
235  );
236  }

◆ getAnsweredQuestion()

ilTestEvaluationPassData::getAnsweredQuestion ( int  $index)

Definition at line 150 of file class.ilTestEvaluationPassData.php.

150  : ?array
151  {
152  if (array_key_exists($index, $this->answeredQuestions)) {
153  return $this->answeredQuestions[$index];
154  }
155 
156  return null;
157  }

◆ getAnsweredQuestionByQuestionId()

ilTestEvaluationPassData::getAnsweredQuestionByQuestionId ( int  $question_id)

Definition at line 159 of file class.ilTestEvaluationPassData.php.

159  : ?array
160  {
161  foreach ($this->answeredQuestions as $question) {
162  if ($question["id"] == $question_id) {
163  return $question;
164  }
165  }
166  return null;
167  }

◆ getAnsweredQuestionCount()

ilTestEvaluationPassData::getAnsweredQuestionCount ( )

Definition at line 169 of file class.ilTestEvaluationPassData.php.

169  : int
170  {
171  return count($this->answeredQuestions);
172  }

◆ getAnsweredQuestions()

ilTestEvaluationPassData::getAnsweredQuestions ( )

Definition at line 127 of file class.ilTestEvaluationPassData.php.

References $answeredQuestions.

Referenced by ilTestScoring\recalculatePass().

127  : array
128  {
130  }
+ Here is the caller graph for this function:

◆ getDeductedHintPoints()

ilTestEvaluationPassData::getDeductedHintPoints ( )

Definition at line 184 of file class.ilTestEvaluationPassData.php.

References $deductedHintPoints.

184  : ?float
185  {
187  }

◆ getExamId()

ilTestEvaluationPassData::getExamId ( )

Definition at line 199 of file class.ilTestEvaluationPassData.php.

References $exam_id.

199  : string
200  {
201  return $this->exam_id;
202  }

◆ getMaxPoints()

ilTestEvaluationPassData::getMaxPoints ( )

Definition at line 87 of file class.ilTestEvaluationPassData.php.

References $maxpoints.

87  : float
88  {
89  return $this->maxpoints;
90  }

◆ getNrOfAnsweredQuestions()

ilTestEvaluationPassData::getNrOfAnsweredQuestions ( )

Definition at line 67 of file class.ilTestEvaluationPassData.php.

References $nrOfAnsweredQuestions.

67  : int
68  {
70  }

◆ getPass()

ilTestEvaluationPassData::getPass ( )

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

References $pass.

117  : int
118  {
119  return $this->pass;
120  }

◆ getQuestionCount()

ilTestEvaluationPassData::getQuestionCount ( )

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

References $questioncount.

97  : int
98  {
99  return $this->questioncount;
100  }

◆ getReachedPoints()

ilTestEvaluationPassData::getReachedPoints ( )

Definition at line 77 of file class.ilTestEvaluationPassData.php.

References $reachedpoints.

77  : float
78  {
79  return $this->reachedpoints;
80  }

◆ getRequestedHintsCount()

ilTestEvaluationPassData::getRequestedHintsCount ( )

Definition at line 174 of file class.ilTestEvaluationPassData.php.

References $requestedHintsCount.

174  : ?int
175  {
177  }

◆ getWorkingTime()

ilTestEvaluationPassData::getWorkingTime ( )

Definition at line 107 of file class.ilTestEvaluationPassData.php.

References $workingtime.

107  : int
108  {
109  return $this->workingtime;
110  }

◆ setDeductedHintPoints()

ilTestEvaluationPassData::setDeductedHintPoints ( float  $deductedHintPoints)

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

References $deductedHintPoints.

189  : void
190  {
191  $this->deductedHintPoints = $deductedHintPoints;
192  }

◆ setExamId()

ilTestEvaluationPassData::setExamId ( string  $exam_id)

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

References $exam_id.

204  : void
205  {
206  $this->exam_id = $exam_id;
207  }

◆ setMaxPoints()

ilTestEvaluationPassData::setMaxPoints ( float  $maxpoints)

Definition at line 92 of file class.ilTestEvaluationPassData.php.

References $maxpoints.

Referenced by ilTestEvaluationFactory\addPointsAndQuestionCountToAttempt().

92  : void
93  {
94  $this->maxpoints = $maxpoints;
95  }
+ Here is the caller graph for this function:

◆ setNrOfAnsweredQuestions()

ilTestEvaluationPassData::setNrOfAnsweredQuestions ( int  $nrOfAnsweredQuestions)

Definition at line 72 of file class.ilTestEvaluationPassData.php.

References $nrOfAnsweredQuestions.

72  : void
73  {
74  $this->nrOfAnsweredQuestions = $nrOfAnsweredQuestions;
75  }

◆ setObligationsAnswered()

ilTestEvaluationPassData::setObligationsAnswered ( bool  $obligationsAnswered)

Definition at line 194 of file class.ilTestEvaluationPassData.php.

References $obligationsAnswered.

194  : void
195  {
196  $this->obligationsAnswered = $obligationsAnswered;
197  }

◆ setPass()

ilTestEvaluationPassData::setPass ( int  $pass)

Definition at line 122 of file class.ilTestEvaluationPassData.php.

References $pass.

122  : void
123  {
124  $this->pass = $pass;
125  }

◆ setQuestionCount()

ilTestEvaluationPassData::setQuestionCount ( int  $questioncount)

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

References $questioncount.

Referenced by ilTestEvaluationFactory\addPointsAndQuestionCountToAttempt().

102  : void
103  {
104  $this->questioncount = $questioncount;
105  }
+ Here is the caller graph for this function:

◆ setReachedPoints()

ilTestEvaluationPassData::setReachedPoints ( float  $reachedpoints)

Definition at line 82 of file class.ilTestEvaluationPassData.php.

References $reachedpoints.

82  : void
83  {
84  $this->reachedpoints = $reachedpoints;
85  }

◆ setRequestedHintsCount()

ilTestEvaluationPassData::setRequestedHintsCount ( int  $requestedHintsCount)

Definition at line 179 of file class.ilTestEvaluationPassData.php.

References $requestedHintsCount.

179  : void
180  {
181  $this->requestedHintsCount = $requestedHintsCount;
182  }

◆ setWorkingTime()

ilTestEvaluationPassData::setWorkingTime ( int  $workingtime)

Definition at line 112 of file class.ilTestEvaluationPassData.php.

References $workingtime.

112  : void
113  {
114  $this->workingtime = $workingtime;
115  }

Field Documentation

◆ $answeredQuestions

array ilTestEvaluationPassData::$answeredQuestions

Definition at line 39 of file class.ilTestEvaluationPassData.php.

Referenced by getAnsweredQuestions().

◆ $deductedHintPoints

float ilTestEvaluationPassData::$deductedHintPoints = null
private

◆ $exam_id

string ilTestEvaluationPassData::$exam_id = ''
private

Definition at line 49 of file class.ilTestEvaluationPassData.php.

Referenced by getExamId(), and setExamId().

◆ $maxpoints

float ilTestEvaluationPassData::$maxpoints
private

Definition at line 42 of file class.ilTestEvaluationPassData.php.

Referenced by getMaxPoints(), and setMaxPoints().

◆ $nrOfAnsweredQuestions

int ilTestEvaluationPassData::$nrOfAnsweredQuestions
private

◆ $obligationsAnswered

bool ilTestEvaluationPassData::$obligationsAnswered = false
private

◆ $pass

int ilTestEvaluationPassData::$pass
private

Definition at line 45 of file class.ilTestEvaluationPassData.php.

Referenced by getPass(), and setPass().

◆ $questioncount

int ilTestEvaluationPassData::$questioncount
private

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

Referenced by getQuestionCount(), and setQuestionCount().

◆ $reachedpoints

float ilTestEvaluationPassData::$reachedpoints
private

Definition at line 43 of file class.ilTestEvaluationPassData.php.

Referenced by getReachedPoints(), and setReachedPoints().

◆ $requestedHintsCount

int ilTestEvaluationPassData::$requestedHintsCount = null
private

◆ $workingtime

int ilTestEvaluationPassData::$workingtime
private

Definition at line 40 of file class.ilTestEvaluationPassData.php.

Referenced by getWorkingTime(), and setWorkingTime().


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