ILIAS  release_8 Revision v8.24
ilTestEvaluationData Class Reference
+ Collaboration diagram for ilTestEvaluationData:

Public Member Functions

 __sleep ()
 
 __construct (ilObjTest $test=null)
 Constructor. More...
 
 getAccessFilteredParticipantList ()
 
 setAccessFilteredParticipantList ($accessFilteredParticipantList)
 
 generateOverview ()
 
 getTest ()
 
 setTest ($test)
 
 setDatasets ($datasets)
 
 getDatasets ()
 
 addQuestionTitle ($question_id, $question_title)
 
 getQuestionTitles ()
 
 getQuestionTitle ($question_id)
 
 calculateStatistics ()
 
 getTotalFinishedParticipants ()
 
 getParticipants ()
 
 resetFilter ()
 
 setFilter ($by, $text)
 
 setFilterArray ($arrFilter)
 
 addParticipant ($active_id, $participant)
 
 getParticipant ($active_id)
 
 participantExists ($active_id)
 
 removeParticipant ($active_id)
 
 getStatistics ()
 
 getParticipantIds ()
 

Data Fields

 $questionTitles
 
 $participants
 
 $statistics
 
 $arrFilter
 
 $datasets
 

Protected Member Functions

 checkParticipantAccess ($activeId)
 
 loadRows ()
 

Protected Attributes

 $accessFilteredParticipantList
 

Private Attributes

 $test
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestEvaluationData::__construct ( ilObjTest  $test = null)

Constructor.

@access public

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

88 {
89 $this->participants = array();
90 $this->questionTitles = array();
91 if ($test !== null) {
92 $this->test = $test;
93
97 );
98 }
99
100 $this->generateOverview();
101 }
102 }
setAccessFilteredParticipantList($accessFilteredParticipantList)

References $test, generateOverview(), getAccessFilteredParticipantList(), getTest(), and setAccessFilteredParticipantList().

+ Here is the call graph for this function:

Member Function Documentation

◆ __sleep()

ilTestEvaluationData::__sleep ( )

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

78 {
79 return array('questionTitles', 'participants', 'statistics', 'arrFilter', 'datasets', 'test');
80 }

◆ addParticipant()

ilTestEvaluationData::addParticipant (   $active_id,
  $participant 
)

Definition at line 378 of file class.ilTestEvaluationData.php.

379 {
380 $this->participants[$active_id] = $participant;
381 }

Referenced by generateOverview().

+ Here is the caller graph for this function:

◆ addQuestionTitle()

ilTestEvaluationData::addQuestionTitle (   $question_id,
  $question_title 
)

Definition at line 249 of file class.ilTestEvaluationData.php.

250 {
251 $this->questionTitles[$question_id] = $question_title;
252 }

◆ calculateStatistics()

ilTestEvaluationData::calculateStatistics ( )

Definition at line 268 of file class.ilTestEvaluationData.php.

269 {
270 include_once "./Modules/Test/classes/class.ilTestStatistics.php";
271 $this->statistics = new ilTestStatistics($this);
272 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ checkParticipantAccess()

ilTestEvaluationData::checkParticipantAccess (   $activeId)
protected

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

117 : bool
118 {
119 if ($this->getAccessFilteredParticipantList() === null) {
120 return true;
121 }
122
123 return $this->getAccessFilteredParticipantList()->isActiveIdInList($activeId);
124 }

References getAccessFilteredParticipantList().

Referenced by loadRows().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateOverview()

ilTestEvaluationData::generateOverview ( )

Definition at line 170 of file class.ilTestEvaluationData.php.

171 {
172 include_once "./Modules/Test/classes/class.ilTestEvaluationPassData.php";
173 include_once "./Modules/Test/classes/class.ilTestEvaluationUserData.php";
174
175 $this->participants = array();
176
177 $pass = null;
178 $checked = array();
179 $thissets = 0;
180
181 foreach ($this->loadRows() as $row) {
182 $thissets++;
183
184 $remove = false;
185
186 if (!$this->participantExists($row["active_fi"])) {
187 $this->addParticipant($row["active_fi"], new ilTestEvaluationUserData($this->getTest()->getPassScoring()));
188
189 $this->getParticipant($row["active_fi"])->setName(
190 $this->getTest()->buildName($row["usr_id"], $row["firstname"], $row["lastname"], $row["title"])
191 );
192
193 $this->getParticipant($row["active_fi"])->setLogin($row["login"]);
194
195 $this->getParticipant($row["active_fi"])->setUserID($row["usr_id"]);
196
197 $this->getParticipant($row["active_fi"])->setSubmitted($row['submitted']);
198
199 $this->getParticipant($row["active_fi"])->setLastFinishedPass($row['last_finished_pass']);
200 }
201
202 if (!is_object($this->getParticipant($row["active_fi"])->getPass($row["pass"]))) {
203 $pass = new ilTestEvaluationPassData();
204 $pass->setPass($row["pass"]);
205 $this->getParticipant($row["active_fi"])->addPass($row["pass"], $pass);
206 }
207
208 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setReachedPoints((float) $row["points"]);
209 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setObligationsAnswered($row["obligations_answered"]);
210
211 if ($row["questioncount"] == 0) {
212 $data = ilObjTest::_getQuestionCountAndPointsForPassOfParticipant($row['active_fi'], $row['pass']);
213 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setMaxPoints($data['points']);
214 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setQuestionCount($data['count']);
215 } else {
216 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setMaxPoints($row["maxpoints"]);
217 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setQuestionCount($row["questioncount"]);
218 }
219
220 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setNrOfAnsweredQuestions($row["answeredquestions"]);
221 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setWorkingTime($row["workingtime"]);
222 $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setExamId((string) $row["exam_id"]);
223
224 $this->getParticipant($row['active_fi'])->getPass($row['pass'])->setRequestedHintsCount($row['hint_count']);
225 $this->getParticipant($row['active_fi'])->getPass($row['pass'])->setDeductedHintPoints($row['hint_points']);
226 }
227 }
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
addParticipant($active_id, $participant)

References $data, ilObjTest\_getQuestionCountAndPointsForPassOfParticipant(), addParticipant(), getParticipant(), getTest(), loadRows(), and participantExists().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccessFilteredParticipantList()

ilTestEvaluationData::getAccessFilteredParticipantList ( )

Definition at line 104 of file class.ilTestEvaluationData.php.

References $accessFilteredParticipantList.

Referenced by __construct(), and checkParticipantAccess().

+ Here is the caller graph for this function:

◆ getDatasets()

ilTestEvaluationData::getDatasets ( )

Definition at line 244 of file class.ilTestEvaluationData.php.

244 : int
245 {
246 return $this->datasets;
247 }

References $datasets.

◆ getParticipant()

ilTestEvaluationData::getParticipant (   $active_id)
Parameters
integer$active_id
Returns
ilTestEvaluationUserData

Definition at line 387 of file class.ilTestEvaluationData.php.

388 {
389 return $this->participants[$active_id];
390 }

Referenced by generateOverview().

+ Here is the caller graph for this function:

◆ getParticipantIds()

ilTestEvaluationData::getParticipantIds ( )

Definition at line 407 of file class.ilTestEvaluationData.php.

407 : array
408 {
409 return array_keys($this->participants);
410 }

◆ getParticipants()

ilTestEvaluationData::getParticipants ( )

Definition at line 289 of file class.ilTestEvaluationData.php.

289 : array
290 {
291 if (is_array($this->arrFilter) && count($this->arrFilter) > 0) {
292 $filtered_participants = [];
293 $courseids = [];
294 $groupids = [];
295
296 if (array_key_exists('group', $this->arrFilter)) {
297 $ids = ilObject::_getIdsForTitle($this->arrFilter['group'], 'grp', true);
298 $groupids = array_merge($groupids, $ids);
299 }
300 if (array_key_exists('course', $this->arrFilter)) {
301 $ids = ilObject::_getIdsForTitle($this->arrFilter['course'], 'crs', true);
302 $courseids = array_merge($courseids, $ids);
303 }
304 foreach ($this->participants as $active_id => $participant) {
305 $remove = false;
306 if (array_key_exists('name', $this->arrFilter)) {
307 if (!(strpos(strtolower($participant->getName()), strtolower((string) $this->arrFilter['name'])) !== false)) {
308 $remove = true;
309 }
310 }
311 if (!$remove) {
312 if (array_key_exists('group', $this->arrFilter)) {
313 $groups = ilParticipants::_getMembershipByType($participant->getUserID(), ["grp"]);
314 $foundfilter = false;
315 if (count(array_intersect($groupids, $groups))) {
316 $foundfilter = true;
317 }
318 if (!$foundfilter) {
319 $remove = true;
320 }
321 }
322 }
323 if (!$remove) {
324 if (array_key_exists('course', $this->arrFilter)) {
325 $courses = ilParticipants::_getMembershipByType($participant->getUserID(), ["crs"]);
326 $foundfilter = false;
327 if (count(array_intersect($courseids, $courses))) {
328 $foundfilter = true;
329 }
330 if (!$foundfilter) {
331 $remove = true;
332 }
333 }
334 }
335 if (!$remove) {
336 if (array_key_exists('active_id', $this->arrFilter)) {
337 if ($active_id != $this->arrFilter['active_id']) {
338 $remove = true;
339 }
340 }
341 }
342 if (!$remove) {
343 $filtered_participants[$active_id] = $participant;
344 }
345 }
346 return $filtered_participants;
347 } else {
348 return $this->participants;
349 }
350 }
static _getIdsForTitle(string $title, string $type='', bool $partial_match=false)
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership

References $participants, ilObject\_getIdsForTitle(), and ilParticipants\_getMembershipByType().

+ Here is the call graph for this function:

◆ getQuestionTitle()

ilTestEvaluationData::getQuestionTitle (   $question_id)

Definition at line 259 of file class.ilTestEvaluationData.php.

260 {
261 if (array_key_exists($question_id, $this->questionTitles)) {
262 return $this->questionTitles[$question_id];
263 } else {
264 return "";
265 }
266 }

◆ getQuestionTitles()

ilTestEvaluationData::getQuestionTitles ( )

Definition at line 254 of file class.ilTestEvaluationData.php.

254 : array
255 {
257 }

References $questionTitles.

◆ getStatistics()

ilTestEvaluationData::getStatistics ( )

Definition at line 402 of file class.ilTestEvaluationData.php.

402 : object
403 {
404 return $this->statistics;
405 }

References $statistics.

◆ getTest()

ilTestEvaluationData::getTest ( )

Definition at line 229 of file class.ilTestEvaluationData.php.

229 : ilObjTest
230 {
231 return $this->test;
232 }

References $test.

Referenced by __construct(), generateOverview(), and loadRows().

+ Here is the caller graph for this function:

◆ getTotalFinishedParticipants()

ilTestEvaluationData::getTotalFinishedParticipants ( )

Definition at line 274 of file class.ilTestEvaluationData.php.

274 : int
275 {
276 $finishedParticipants = 0;
277
278 foreach ($this->participants as $active_id => $participant) {
279 if (!$participant->isSubmitted()) {
280 continue;
281 }
282
283 $finishedParticipants++;
284 }
285
286 return $finishedParticipants;
287 }

◆ loadRows()

ilTestEvaluationData::loadRows ( )
protected

Definition at line 126 of file class.ilTestEvaluationData.php.

126 : array
127 {
128 global $DIC; /* @var ILIAS\DI\Container $DIC */
129
130 $query = "
131 SELECT usr_data.usr_id,
132 usr_data.firstname,
133 usr_data.lastname,
134 usr_data.title,
135 usr_data.login,
136 tst_pass_result.*,
137 tst_active.submitted,
138 tst_active.last_finished_pass
139 FROM tst_pass_result, tst_active
140 LEFT JOIN usr_data
141 ON tst_active.user_fi = usr_data.usr_id
142 WHERE tst_active.active_id = tst_pass_result.active_fi
143 AND tst_active.test_fi = %s
144 ORDER BY usr_data.lastname,
145 usr_data.firstname,
146 tst_pass_result.active_fi,
147 tst_pass_result.pass,
148 tst_pass_result.tstamp
149 ";
150
151 $result = $DIC->database()->queryF(
152 $query,
153 array('integer'),
154 array($this->getTest()->getTestId())
155 );
156
157 $rows = array();
158
159 while ($row = $DIC->database()->fetchAssoc($result)) {
160 if (!$this->checkParticipantAccess($row['active_fi'])) {
161 continue;
162 }
163
164 $rows[] = $row;
165 }
166
167 return $rows;
168 }
global $DIC
Definition: feed.php:28
$query
$rows
Definition: xhr_table.php:10

References $DIC, $query, $rows, checkParticipantAccess(), and getTest().

Referenced by generateOverview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ participantExists()

ilTestEvaluationData::participantExists (   $active_id)

Definition at line 392 of file class.ilTestEvaluationData.php.

392 : bool
393 {
394 return array_key_exists($active_id, $this->participants);
395 }

Referenced by generateOverview().

+ Here is the caller graph for this function:

◆ removeParticipant()

ilTestEvaluationData::removeParticipant (   $active_id)

Definition at line 397 of file class.ilTestEvaluationData.php.

398 {
399 unset($this->participants[$active_id]);
400 }

◆ resetFilter()

ilTestEvaluationData::resetFilter ( )

Definition at line 352 of file class.ilTestEvaluationData.php.

353 {
354 $this->arrFilter = array();
355 }

◆ setAccessFilteredParticipantList()

ilTestEvaluationData::setAccessFilteredParticipantList (   $accessFilteredParticipantList)
Parameters
ilTestParticipantList$accessFilteredParticipantList

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

113 {
114 $this->accessFilteredParticipantList = $accessFilteredParticipantList;
115 }

References $accessFilteredParticipantList.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setDatasets()

ilTestEvaluationData::setDatasets (   $datasets)

Definition at line 239 of file class.ilTestEvaluationData.php.

240 {
241 $this->datasets = $datasets;
242 }

References $datasets.

◆ setFilter()

ilTestEvaluationData::setFilter (   $by,
  $text 
)

Definition at line 363 of file class.ilTestEvaluationData.php.

364 {
365 $this->arrFilter = array($by => $text);
366 }

◆ setFilterArray()

ilTestEvaluationData::setFilterArray (   $arrFilter)

Definition at line 373 of file class.ilTestEvaluationData.php.

374 {
375 $this->arrFilter = $arrFilter;
376 }

References $arrFilter.

◆ setTest()

ilTestEvaluationData::setTest (   $test)

Definition at line 234 of file class.ilTestEvaluationData.php.

235 {
236 $this->test = &$test;
237 }

References $test.

Field Documentation

◆ $accessFilteredParticipantList

ilTestEvaluationData::$accessFilteredParticipantList
protected

◆ $arrFilter

ilTestEvaluationData::$arrFilter

Definition at line 64 of file class.ilTestEvaluationData.php.

Referenced by setFilterArray().

◆ $datasets

ilTestEvaluationData::$datasets

Definition at line 70 of file class.ilTestEvaluationData.php.

Referenced by getDatasets(), and setDatasets().

◆ $participants

ilTestEvaluationData::$participants

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

Referenced by getParticipants().

◆ $questionTitles

ilTestEvaluationData::$questionTitles

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

Referenced by getQuestionTitles().

◆ $statistics

ilTestEvaluationData::$statistics

Definition at line 57 of file class.ilTestEvaluationData.php.

Referenced by getStatistics().

◆ $test

ilTestEvaluationData::$test
private

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

Referenced by __construct(), getTest(), and setTest().


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