ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestEvaluationData Class Reference
+ Collaboration diagram for ilTestEvaluationData:

Public Member Functions

 __sleep ()
 
 __construct (ilObjTest $test=null)
 Constructor. More...
 
 generateOverview ()
 
 getTest ()
 
 setTest ($test)
 
 setDatasets ($datasets)
 
 getDatasets ()
 
 addQuestionTitle ($question_id, $question_title)
 
 getQuestionTitles ()
 
 getQuestionTitle ($question_id)
 
 calculateStatistics ()
 
 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
 

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

References $test, array, and generateOverview().

69  {
70  $this->participants = array();
71  $this->questionTitles = array();
72  if( $test !== null )
73  {
74  $this->test = $test;
75  $this->generateOverview();
76  }
77  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Member Function Documentation

◆ __sleep()

ilTestEvaluationData::__sleep ( )

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

References array.

59  {
60  return array('questionTitles', 'participants', 'statistics', 'arrFilter', 'datasets', 'test');
61  }
Create styles array
The data for the language used.

◆ addParticipant()

ilTestEvaluationData::addParticipant (   $active_id,
  $participant 
)

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

Referenced by generateOverview().

303  {
304  $this->participants[$active_id] = $participant;
305  }
+ Here is the caller graph for this function:

◆ addQuestionTitle()

ilTestEvaluationData::addQuestionTitle (   $question_id,
  $question_title 
)

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

185  {
186  $this->questionTitles[$question_id] = $question_title;
187  }

◆ calculateStatistics()

ilTestEvaluationData::calculateStatistics ( )

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

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

◆ generateOverview()

ilTestEvaluationData::generateOverview ( )

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

References $data, $ilDB, $pass, $query, $result, $row, ilObjTest\_getQuestionCountAndPointsForPassOfParticipant(), addParticipant(), array, getParticipant(), getTest(), and participantExists().

Referenced by __construct().

80  {
81  global $ilDB;
82 
83  include_once "./Modules/Test/classes/class.ilTestEvaluationPassData.php";
84  include_once "./Modules/Test/classes/class.ilTestEvaluationUserData.php";
85 
86  $this->participants = array();
87 
88  $query = "
89  SELECT usr_data.usr_id,
90  usr_data.firstname,
91  usr_data.lastname,
92  usr_data.title,
93  usr_data.login,
94  tst_pass_result.*
95  FROM tst_pass_result, tst_active
96  LEFT JOIN usr_data
97  ON tst_active.user_fi = usr_data.usr_id
98  WHERE tst_active.active_id = tst_pass_result.active_fi
99  AND tst_active.test_fi = %s
100  ORDER BY usr_data.lastname,
101  usr_data.firstname,
102  tst_pass_result.active_fi,
103  tst_pass_result.pass,
104  tst_pass_result.tstamp
105  ";
106 
107  $result = $ilDB->queryF(
108  $query, array('integer'), array($this->getTest()->getTestId())
109  );
110 
111  $pass = NULL;
112  $checked = array();
113  $thissets = 0;
114 
115  while( $row = $ilDB->fetchAssoc($result) )
116  {
117  $thissets++;
118 
119  $remove = FALSE;
120 
121  if( !$this->participantExists($row["active_fi"]) )
122  {
123  $this->addParticipant($row["active_fi"], new ilTestEvaluationUserData($this->getTest()->getPassScoring()));
124 
125  $this->getParticipant($row["active_fi"])->setName(
126  $this->getTest()->buildName($row["usr_id"], $row["firstname"], $row["lastname"], $row["title"])
127  );
128 
129  $this->getParticipant($row["active_fi"])->setLogin($row["login"]);
130 
131  $this->getParticipant($row["active_fi"])->setUserID($row["usr_id"]);
132  }
133 
134  if( !is_object($this->getParticipant($row["active_fi"])->getPass($row["pass"])) )
135  {
137  $pass->setPass($row["pass"]);
138  $this->getParticipant($row["active_fi"])->addPass($row["pass"], $pass);
139  }
140 
141  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setReachedPoints($row["points"]);
142  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setObligationsAnswered($row["obligations_answered"]);
143 
144  if( $row["questioncount"] == 0 )
145  {
147  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setMaxPoints($data['points']);
148  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setQuestionCount($data['count']);
149  }
150  else
151  {
152  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setMaxPoints($row["maxpoints"]);
153  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setQuestionCount($row["questioncount"]);
154  }
155 
156  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setNrOfAnsweredQuestions($row["answeredquestions"]);
157  $this->getParticipant($row["active_fi"])->getPass($row["pass"])->setWorkingTime($row["workingtime"]);
158 
159  $this->getParticipant($row['active_fi'])->getPass($row['pass'])->setRequestedHintsCount($row['hint_count']);
160  $this->getParticipant($row['active_fi'])->getPass($row['pass'])->setDeductedHintPoints($row['hint_points']);
161  }
162  }
$result
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
Create styles array
The data for the language used.
addParticipant($active_id, $participant)
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatasets()

ilTestEvaluationData::getDatasets ( )

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

References $datasets.

180  {
181  return $this->datasets;
182  }

◆ getParticipant()

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

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

Referenced by generateOverview().

312  {
313  return $this->participants[$active_id];
314  }
+ Here is the caller graph for this function:

◆ getParticipantIds()

ilTestEvaluationData::getParticipantIds ( )

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

332  {
333  return array_keys($this->participants);
334  }

◆ getParticipants()

ilTestEvaluationData::getParticipants ( )

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

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

213  {
214  if (is_array($this->arrFilter) && count($this->arrFilter) > 0)
215  {
216  $filteredParticipants = array();
217  $courseids = array();
218  $groupids = array();
219  global $ilDB;
220  if (array_key_exists('group', $this->arrFilter))
221  {
222  $ids = ilObject::_getIdsForTitle($this->arrFilter['group'], 'grp', true);
223  $groupids = array_merge($groupids, $ids);
224  }
225  if (array_key_exists('course', $this->arrFilter))
226  {
227  $ids = ilObject::_getIdsForTitle($this->arrFilter['course'], 'crs', true);
228  $courseids = array_merge($courseids, $ids);
229  }
230  foreach ($this->participants as $active_id => $participant)
231  {
232  $remove = FALSE;
233  if (array_key_exists('name', $this->arrFilter))
234  {
235  if (!(strpos(strtolower($participant->getName()), strtolower($this->arrFilter['name'])) !== FALSE)) $remove = TRUE;
236  }
237  if (!$remove)
238  {
239  if (array_key_exists('group', $this->arrFilter))
240  {
241  include_once "./Services/Membership/classes/class.ilParticipants.php";
242  $groups = ilParticipants::_getMembershipByType($participant->getUserID(), "grp");
243  $foundfilter = FALSE;
244  if (count(array_intersect($groupids, $groups))) $foundfilter = TRUE;
245  if (!$foundfilter) $remove = TRUE;
246  }
247  }
248  if (!$remove)
249  {
250  if (array_key_exists('course', $this->arrFilter))
251  {
252  include_once "./Services/Membership/classes/class.ilParticipants.php";
253  $courses = ilParticipants::_getMembershipByType($participant->getUserID(), "crs");
254  $foundfilter = FALSE;
255  if (count(array_intersect($courseids, $courses))) $foundfilter = TRUE;
256  if (!$foundfilter) $remove = TRUE;
257  }
258  }
259  if (!$remove)
260  {
261  if (array_key_exists('active_id', $this->arrFilter))
262  {
263  if ($active_id != $this->arrFilter['active_id']) $remove = TRUE;
264  }
265  }
266  if (!$remove) $filteredParticipants[$active_id] = $participant;
267  }
268  return $filteredParticipants;
269  }
270  else
271  {
272  return $this->participants;
273  }
274  }
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
Create styles array
The data for the language used.
global $ilDB
static _getIdsForTitle($title, $type='', $partialmatch=false)
+ Here is the call graph for this function:

◆ getQuestionTitle()

ilTestEvaluationData::getQuestionTitle (   $question_id)

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

195  {
196  if (array_key_exists($question_id, $this->questionTitles))
197  {
198  return $this->questionTitles[$question_id];
199  }
200  else
201  {
202  return "";
203  }
204  }

◆ getQuestionTitles()

ilTestEvaluationData::getQuestionTitles ( )

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

References $questionTitles.

◆ getStatistics()

ilTestEvaluationData::getStatistics ( )

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

References $statistics.

327  {
328  return $this->statistics;
329  }

◆ getTest()

ilTestEvaluationData::getTest ( )

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

References $test.

Referenced by generateOverview().

165  {
166  return $this->test;
167  }
+ Here is the caller graph for this function:

◆ participantExists()

ilTestEvaluationData::participantExists (   $active_id)

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

Referenced by generateOverview().

317  {
318  return array_key_exists($active_id, $this->participants);
319  }
+ Here is the caller graph for this function:

◆ removeParticipant()

ilTestEvaluationData::removeParticipant (   $active_id)

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

322  {
323  unset($this->participants[$active_id]);
324  }

◆ resetFilter()

ilTestEvaluationData::resetFilter ( )

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

References array.

277  {
278  $this->arrFilter = array();
279  }
Create styles array
The data for the language used.

◆ setDatasets()

ilTestEvaluationData::setDatasets (   $datasets)

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

References $datasets.

175  {
176  $this->datasets = $datasets;
177  }

◆ setFilter()

ilTestEvaluationData::setFilter (   $by,
  $text 
)

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

References $text, and array.

288  {
289  $this->arrFilter = array($by => $text);
290  }
Create styles array
The data for the language used.
$text

◆ setFilterArray()

ilTestEvaluationData::setFilterArray (   $arrFilter)

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

References $arrFilter.

298  {
299  $this->arrFilter = $arrFilter;
300  }

◆ setTest()

ilTestEvaluationData::setTest (   $test)

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

References $test.

170  {
171  $this->test =& $test;
172  }

Field Documentation

◆ $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: