ILIAS  release_7 Revision v7.30-3-g800a261c036
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 15 of file class.ilTestEvaluationData.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestEvaluationData::__construct ( ilObjTest  $test = null)

Constructor.

@access public

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

74 {
75 $this->participants = array();
76 $this->questionTitles = array();
77 if ($test !== null) {
78 $this->test = $test;
79
83 );
84 }
85
86 $this->generateOverview();
87 }
88 }
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 63 of file class.ilTestEvaluationData.php.

64 {
65 return array('questionTitles', 'participants', 'statistics', 'arrFilter', 'datasets', 'test');
66 }

◆ addParticipant()

ilTestEvaluationData::addParticipant (   $active_id,
  $participant 
)

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

371 {
372 $this->participants[$active_id] = $participant;
373 }

Referenced by generateOverview().

+ Here is the caller graph for this function:

◆ addQuestionTitle()

ilTestEvaluationData::addQuestionTitle (   $question_id,
  $question_title 
)

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

239 {
240 $this->questionTitles[$question_id] = $question_title;
241 }

◆ calculateStatistics()

ilTestEvaluationData::calculateStatistics ( )

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

258 {
259 include_once "./Modules/Test/classes/class.ilTestStatistics.php";
260 $this->statistics = new ilTestStatistics($this);
261 }
This class calculates statistical data for a test which has to be calculated using all participant da...

◆ checkParticipantAccess()

ilTestEvaluationData::checkParticipantAccess (   $activeId)
protected

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

107 {
108 if ($this->getAccessFilteredParticipantList() === null) {
109 return true;
110 }
111
112 return $this->getAccessFilteredParticipantList()->isActiveIdInList($activeId);
113 }

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 159 of file class.ilTestEvaluationData.php.

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

References $data, $pass, 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 ( )
Returns
ilTestParticipantList

Definition at line 93 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 233 of file class.ilTestEvaluationData.php.

References $datasets.

◆ getParticipant()

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

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

380 {
381 return $this->participants[$active_id];
382 }

Referenced by generateOverview().

+ Here is the caller graph for this function:

◆ getParticipantIds()

ilTestEvaluationData::getParticipantIds ( )

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

400 {
401 return array_keys($this->participants);
402 }

◆ getParticipants()

ilTestEvaluationData::getParticipants ( )

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

279 {
280 if (is_array($this->arrFilter) && count($this->arrFilter) > 0) {
281 $filteredParticipants = array();
282 $courseids = array();
283 $groupids = array();
284 global $DIC;
285 $ilDB = $DIC['ilDB'];
286 if (array_key_exists('group', $this->arrFilter)) {
287 $ids = ilObject::_getIdsForTitle($this->arrFilter['group'], 'grp', true);
288 $groupids = array_merge($groupids, $ids);
289 }
290 if (array_key_exists('course', $this->arrFilter)) {
291 $ids = ilObject::_getIdsForTitle($this->arrFilter['course'], 'crs', true);
292 $courseids = array_merge($courseids, $ids);
293 }
294 foreach ($this->participants as $active_id => $participant) {
295 $remove = false;
296 if (array_key_exists('name', $this->arrFilter)) {
297 if (!(strpos(strtolower($participant->getName()), strtolower($this->arrFilter['name'])) !== false)) {
298 $remove = true;
299 }
300 }
301 if (!$remove) {
302 if (array_key_exists('group', $this->arrFilter)) {
303 include_once "./Services/Membership/classes/class.ilParticipants.php";
304 $groups = ilParticipants::_getMembershipByType($participant->getUserID(), "grp");
305 $foundfilter = false;
306 if (count(array_intersect($groupids, $groups))) {
307 $foundfilter = true;
308 }
309 if (!$foundfilter) {
310 $remove = true;
311 }
312 }
313 }
314 if (!$remove) {
315 if (array_key_exists('course', $this->arrFilter)) {
316 include_once "./Services/Membership/classes/class.ilParticipants.php";
317 $courses = ilParticipants::_getMembershipByType($participant->getUserID(), "crs");
318 $foundfilter = false;
319 if (count(array_intersect($courseids, $courses))) {
320 $foundfilter = true;
321 }
322 if (!$foundfilter) {
323 $remove = true;
324 }
325 }
326 }
327 if (!$remove) {
328 if (array_key_exists('active_id', $this->arrFilter)) {
329 if ($active_id != $this->arrFilter['active_id']) {
330 $remove = true;
331 }
332 }
333 }
334 if (!$remove) {
335 $filteredParticipants[$active_id] = $participant;
336 }
337 }
338 return $filteredParticipants;
339 } else {
340 return $this->participants;
341 }
342 }
static _getIdsForTitle($title, $type='', $partialmatch=false)
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
global $DIC
Definition: goto.php:24
global $ilDB

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

+ Here is the call graph for this function:

◆ getQuestionTitle()

ilTestEvaluationData::getQuestionTitle (   $question_id)

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

249 {
250 if (array_key_exists($question_id, $this->questionTitles)) {
251 return $this->questionTitles[$question_id];
252 } else {
253 return "";
254 }
255 }

◆ getQuestionTitles()

ilTestEvaluationData::getQuestionTitles ( )

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

References $questionTitles.

◆ getStatistics()

ilTestEvaluationData::getStatistics ( )

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

References $statistics.

◆ getTest()

ilTestEvaluationData::getTest ( )

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

219 {
220 return $this->test;
221 }

References $test.

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

+ Here is the caller graph for this function:

◆ getTotalFinishedParticipants()

ilTestEvaluationData::getTotalFinishedParticipants ( )

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

264 {
265 $finishedParticipants = 0;
266
267 foreach ($this->participants as $active_id => $participant) {
268 if (!$participant->isSubmitted()) {
269 continue;
270 }
271
272 $finishedParticipants++;
273 }
274
275 return $finishedParticipants;
276 }

◆ loadRows()

ilTestEvaluationData::loadRows ( )
protected

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

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

References $DIC, $query, $result, $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 384 of file class.ilTestEvaluationData.php.

385 {
386 return array_key_exists($active_id, $this->participants);
387 }

Referenced by generateOverview().

+ Here is the caller graph for this function:

◆ removeParticipant()

ilTestEvaluationData::removeParticipant (   $active_id)

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

390 {
391 unset($this->participants[$active_id]);
392 }

◆ resetFilter()

ilTestEvaluationData::resetFilter ( )

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

345 {
346 $this->arrFilter = array();
347 }

◆ setAccessFilteredParticipantList()

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

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

102 {
103 $this->accessFilteredParticipantList = $accessFilteredParticipantList;
104 }

References $accessFilteredParticipantList.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setDatasets()

ilTestEvaluationData::setDatasets (   $datasets)

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

229 {
230 $this->datasets = $datasets;
231 }

References $datasets.

◆ setFilter()

ilTestEvaluationData::setFilter (   $by,
  $text 
)

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

356 {
357 $this->arrFilter = array($by => $text);
358 }

◆ setFilterArray()

ilTestEvaluationData::setFilterArray (   $arrFilter)

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

366 {
367 $this->arrFilter = $arrFilter;
368 }

References $arrFilter.

◆ setTest()

ilTestEvaluationData::setTest (   $test)

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

224 {
225 $this->test = &$test;
226 }

References $test.

Field Documentation

◆ $accessFilteredParticipantList

ilTestEvaluationData::$accessFilteredParticipantList
protected

◆ $arrFilter

ilTestEvaluationData::$arrFilter

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

Referenced by setFilterArray().

◆ $datasets

ilTestEvaluationData::$datasets

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

Referenced by getDatasets(), and setDatasets().

◆ $participants

ilTestEvaluationData::$participants

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

Referenced by getParticipants().

◆ $questionTitles

ilTestEvaluationData::$questionTitles

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

Referenced by getQuestionTitles().

◆ $statistics

ilTestEvaluationData::$statistics

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

Referenced by getStatistics().

◆ $test

ilTestEvaluationData::$test
private

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

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


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