ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->test = $test;
74  $this->generateOverview();
75  }
76  }
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 295 of file class.ilTestEvaluationData.php.

Referenced by generateOverview().

296  {
297  $this->participants[$active_id] = $participant;
298  }
+ Here is the caller graph for this function:

◆ addQuestionTitle()

ilTestEvaluationData::addQuestionTitle (   $question_id,
  $question_title 
)

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

180  {
181  $this->questionTitles[$question_id] = $question_title;
182  }

◆ calculateStatistics()

ilTestEvaluationData::calculateStatistics ( )

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

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

◆ generateOverview()

ilTestEvaluationData::generateOverview ( )

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

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

Referenced by __construct().

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

References $datasets.

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

◆ getParticipant()

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

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

Referenced by generateOverview().

305  {
306  return $this->participants[$active_id];
307  }
+ Here is the caller graph for this function:

◆ getParticipantIds()

ilTestEvaluationData::getParticipantIds ( )

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

325  {
326  return array_keys($this->participants);
327  }

◆ getParticipants()

ilTestEvaluationData::getParticipants ( )

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

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

205  {
206  if (is_array($this->arrFilter) && count($this->arrFilter) > 0) {
207  $filteredParticipants = array();
208  $courseids = array();
209  $groupids = array();
210  global $ilDB;
211  if (array_key_exists('group', $this->arrFilter)) {
212  $ids = ilObject::_getIdsForTitle($this->arrFilter['group'], 'grp', true);
213  $groupids = array_merge($groupids, $ids);
214  }
215  if (array_key_exists('course', $this->arrFilter)) {
216  $ids = ilObject::_getIdsForTitle($this->arrFilter['course'], 'crs', true);
217  $courseids = array_merge($courseids, $ids);
218  }
219  foreach ($this->participants as $active_id => $participant) {
220  $remove = false;
221  if (array_key_exists('name', $this->arrFilter)) {
222  if (!(strpos(strtolower($participant->getName()), strtolower($this->arrFilter['name'])) !== false)) {
223  $remove = true;
224  }
225  }
226  if (!$remove) {
227  if (array_key_exists('group', $this->arrFilter)) {
228  include_once "./Services/Membership/classes/class.ilParticipants.php";
229  $groups = ilParticipants::_getMembershipByType($participant->getUserID(), "grp");
230  $foundfilter = false;
231  if (count(array_intersect($groupids, $groups))) {
232  $foundfilter = true;
233  }
234  if (!$foundfilter) {
235  $remove = true;
236  }
237  }
238  }
239  if (!$remove) {
240  if (array_key_exists('course', $this->arrFilter)) {
241  include_once "./Services/Membership/classes/class.ilParticipants.php";
242  $courses = ilParticipants::_getMembershipByType($participant->getUserID(), "crs");
243  $foundfilter = false;
244  if (count(array_intersect($courseids, $courses))) {
245  $foundfilter = true;
246  }
247  if (!$foundfilter) {
248  $remove = true;
249  }
250  }
251  }
252  if (!$remove) {
253  if (array_key_exists('active_id', $this->arrFilter)) {
254  if ($active_id != $this->arrFilter['active_id']) {
255  $remove = true;
256  }
257  }
258  }
259  if (!$remove) {
260  $filteredParticipants[$active_id] = $participant;
261  }
262  }
263  return $filteredParticipants;
264  } else {
265  return $this->participants;
266  }
267  }
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 189 of file class.ilTestEvaluationData.php.

190  {
191  if (array_key_exists($question_id, $this->questionTitles)) {
192  return $this->questionTitles[$question_id];
193  } else {
194  return "";
195  }
196  }

◆ getQuestionTitles()

ilTestEvaluationData::getQuestionTitles ( )

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

References $questionTitles.

◆ getStatistics()

ilTestEvaluationData::getStatistics ( )

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

References $statistics.

320  {
321  return $this->statistics;
322  }

◆ getTest()

ilTestEvaluationData::getTest ( )

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

References $test.

Referenced by generateOverview().

160  {
161  return $this->test;
162  }
+ Here is the caller graph for this function:

◆ participantExists()

ilTestEvaluationData::participantExists (   $active_id)

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

Referenced by generateOverview().

310  {
311  return array_key_exists($active_id, $this->participants);
312  }
+ Here is the caller graph for this function:

◆ removeParticipant()

ilTestEvaluationData::removeParticipant (   $active_id)

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

315  {
316  unset($this->participants[$active_id]);
317  }

◆ resetFilter()

ilTestEvaluationData::resetFilter ( )

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

References array.

270  {
271  $this->arrFilter = array();
272  }
Create styles array
The data for the language used.

◆ setDatasets()

ilTestEvaluationData::setDatasets (   $datasets)

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

References $datasets.

170  {
171  $this->datasets = $datasets;
172  }

◆ setFilter()

ilTestEvaluationData::setFilter (   $by,
  $text 
)

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

References $text, and array.

281  {
282  $this->arrFilter = array($by => $text);
283  }
$text
Definition: errorreport.php:18
Create styles array
The data for the language used.

◆ setFilterArray()

ilTestEvaluationData::setFilterArray (   $arrFilter)

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

References $arrFilter.

291  {
292  $this->arrFilter = $arrFilter;
293  }

◆ setTest()

ilTestEvaluationData::setTest (   $test)

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

References $test.

165  {
166  $this->test =&$test;
167  }

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: