ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

public

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

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

74  {
75  $this->participants = array();
76  $this->questionTitles = array();
77  if ($test !== null) {
78  $this->test = $test;
79 
80  if ($this->getTest()->getAccessFilteredParticipantList()) {
83  );
84  }
85 
86  $this->generateOverview();
87  }
88  }
setAccessFilteredParticipantList($accessFilteredParticipantList)
test()
Definition: build.php:107
+ 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 367 of file class.ilTestEvaluationData.php.

Referenced by generateOverview().

368  {
369  $this->participants[$active_id] = $participant;
370  }
+ Here is the caller graph for this function:

◆ addQuestionTitle()

ilTestEvaluationData::addQuestionTitle (   $question_id,
  $question_title 
)

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

236  {
237  $this->questionTitles[$question_id] = $question_title;
238  }

◆ calculateStatistics()

ilTestEvaluationData::calculateStatistics ( )

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

255  {
256  include_once "./Modules/Test/classes/class.ilTestStatistics.php";
257  $this->statistics = new ilTestStatistics($this);
258  }
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.

References getAccessFilteredParticipantList().

Referenced by loadRows().

107  {
108  if ($this->getAccessFilteredParticipantList() === null) {
109  return true;
110  }
111 
112  return $this->getAccessFilteredParticipantList()->isActiveIdInList($activeId);
113  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateOverview()

ilTestEvaluationData::generateOverview ( )

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

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

Referenced by __construct().

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

References $datasets.

231  {
232  return $this->datasets;
233  }

◆ getParticipant()

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

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

Referenced by generateOverview().

377  {
378  return $this->participants[$active_id];
379  }
+ Here is the caller graph for this function:

◆ getParticipantIds()

ilTestEvaluationData::getParticipantIds ( )

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

397  {
398  return array_keys($this->participants);
399  }

◆ getParticipants()

ilTestEvaluationData::getParticipants ( )

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

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

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

◆ getQuestionTitle()

ilTestEvaluationData::getQuestionTitle (   $question_id)

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

246  {
247  if (array_key_exists($question_id, $this->questionTitles)) {
248  return $this->questionTitles[$question_id];
249  } else {
250  return "";
251  }
252  }

◆ getQuestionTitles()

ilTestEvaluationData::getQuestionTitles ( )

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

References $questionTitles.

◆ getStatistics()

ilTestEvaluationData::getStatistics ( )

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

References $statistics.

392  {
393  return $this->statistics;
394  }

◆ getTest()

ilTestEvaluationData::getTest ( )

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

References $test.

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

216  {
217  return $this->test;
218  }
+ Here is the caller graph for this function:

◆ getTotalFinishedParticipants()

ilTestEvaluationData::getTotalFinishedParticipants ( )

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

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

◆ loadRows()

ilTestEvaluationData::loadRows ( )
protected

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

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

Referenced by generateOverview().

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  FROM tst_pass_result, tst_active
128  LEFT JOIN usr_data
129  ON tst_active.user_fi = usr_data.usr_id
130  WHERE tst_active.active_id = tst_pass_result.active_fi
131  AND tst_active.test_fi = %s
132  ORDER BY usr_data.lastname,
133  usr_data.firstname,
134  tst_pass_result.active_fi,
135  tst_pass_result.pass,
136  tst_pass_result.tstamp
137  ";
138 
139  $result = $DIC->database()->queryF(
140  $query,
141  array('integer'),
142  array($this->getTest()->getTestId())
143  );
144 
145  $rows = array();
146 
147  while ($row = $DIC->database()->fetchAssoc($result)) {
148  if (!$this->checkParticipantAccess($row['active_fi'])) {
149  continue;
150  }
151 
152  $rows[] = $row;
153  }
154 
155  return $rows;
156  }
$result
global $DIC
Definition: saml.php:7
$query
$row
$rows
Definition: xhr_table.php:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ participantExists()

ilTestEvaluationData::participantExists (   $active_id)

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

Referenced by generateOverview().

382  {
383  return array_key_exists($active_id, $this->participants);
384  }
+ Here is the caller graph for this function:

◆ removeParticipant()

ilTestEvaluationData::removeParticipant (   $active_id)

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

387  {
388  unset($this->participants[$active_id]);
389  }

◆ resetFilter()

ilTestEvaluationData::resetFilter ( )

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

342  {
343  $this->arrFilter = array();
344  }

◆ setAccessFilteredParticipantList()

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

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

References $accessFilteredParticipantList.

Referenced by __construct().

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

◆ setDatasets()

ilTestEvaluationData::setDatasets (   $datasets)

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

References $datasets.

226  {
227  $this->datasets = $datasets;
228  }

◆ setFilter()

ilTestEvaluationData::setFilter (   $by,
  $text 
)

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

References $text.

353  {
354  $this->arrFilter = array($by => $text);
355  }
$text
Definition: errorreport.php:18

◆ setFilterArray()

ilTestEvaluationData::setFilterArray (   $arrFilter)

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

References $arrFilter.

363  {
364  $this->arrFilter = $arrFilter;
365  }

◆ setTest()

ilTestEvaluationData::setTest (   $test)

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

References $test, and test().

221  {
222  $this->test = &$test;
223  }
test()
Definition: build.php:107
+ Here is the call graph for this function:

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: