17 $this->
object = $a_object;
25 public function getUserToplistByWorkingtime($a_test_ref_id, $a_user_id)
33 SELECT count(tst_pass_result.workingtime) as count
35 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
36 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
37 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
38 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
39 AND tst_pass_result.pass = tst_result_cache.pass
40 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
41 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
42 AND tst_active.user_fi != ' .
$ilDB->quote($a_user_id,
'integer') .
'
47 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
48 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
49 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
50 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
51 AND tst_pass_result.pass = tst_result_cache.pass
52 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
53 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
59 $better_participants =
$row[
'count'];
60 $own_placement = $better_participants + 1;
64 SELECT count(tst_pass_result.workingtime) as count
66 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
67 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
68 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
69 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
70 AND tst_pass_result.pass = tst_result_cache.pass
71 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
72 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer')
75 $number_total =
$row[
'count'];
79 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage ,
80 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname
82 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
83 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
84 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
85 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
86 AND tst_pass_result.pass = tst_result_cache.pass
87 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
89 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
90 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
93 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage,
94 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname
96 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
97 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
98 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
99 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
100 AND tst_pass_result.pass = tst_result_cache.pass
101 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
102 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
103 AND tst_active.user_fi != ' .
$ilDB->quote($a_user_id,
'integer') .
'
106 SELECT tst_pass_result.workingtime
107 FROM object_reference
108 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
109 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
110 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
111 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
112 AND tst_pass_result.pass = tst_result_cache.pass
113 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
114 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
116 ORDER BY workingtime DESC
120 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage,
121 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname
122 FROM object_reference
123 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
124 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
125 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
126 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
127 AND tst_pass_result.pass = tst_result_cache.pass
128 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
129 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
130 AND tst_active.user_fi != ' .
$ilDB->quote($a_user_id,
'integer') .
'
133 SELECT tst_pass_result.workingtime
134 FROM object_reference
135 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
136 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
137 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
138 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
139 AND tst_pass_result.pass = tst_result_cache.pass
140 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
141 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
143 ORDER BY workingtime DESC
146 ORDER BY workingtime ASC
150 $i = $own_placement - (($better_participants >= 3) ? 3 : $better_participants);
156 $item = array(
'Rank' =>
'...');
169 if($number_total > $i)
171 $item = array(
'Rank' =>
'...');
184 public function getGeneralToplistByPercentage($a_test_ref_id, $a_user_id)
190 SELECT tst_result_cache.*, round(points/maxpoints*100,2) as percentage, tst_pass_result.workingtime, usr_data.usr_id, usr_data.firstname, usr_data.lastname
191 FROM object_reference
192 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
193 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
194 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
195 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi AND tst_pass_result.pass = tst_result_cache.pass
196 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
197 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
198 ORDER BY percentage DESC
199 LIMIT 0, ' .
$ilDB->quote($this->object->getHighscoreTopNum(),
'integer') .
'
220 public function getGeneralToplistByWorkingtime($a_test_ref_id, $a_user_id)
226 SELECT tst_result_cache.*, round(points/maxpoints*100,2) as percentage, tst_pass_result.workingtime, usr_data.usr_id, usr_data.firstname, usr_data.lastname
227 FROM object_reference
228 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
229 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
230 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
231 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi AND tst_pass_result.pass = tst_result_cache.pass
232 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
233 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
234 ORDER BY workingtime ASC
235 LIMIT 0, ' .
$ilDB->quote($this->object->getHighscoreTopNum(),
'integer') .
'
255 public function getUserToplistByPercentage($a_test_ref_id, $a_user_id)
263 SELECT count(tst_pass_result.workingtime) as count
264 FROM object_reference
265 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
266 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
267 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
268 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
269 AND tst_pass_result.pass = tst_result_cache.pass
270 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
271 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
272 AND tst_active.user_fi != ' .
$ilDB->quote($a_user_id,
'integer') .
'
273 AND round(reached_points/max_points*100) >=
275 SELECT round(reached_points/max_points*100)
276 FROM object_reference
277 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
278 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
279 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
280 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
281 AND tst_pass_result.pass = tst_result_cache.pass
282 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
283 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
289 $better_participants =
$row[
'count'];
290 $own_placement = $better_participants + 1;
294 SELECT count(tst_pass_result.workingtime) as count
295 FROM object_reference
296 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
297 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
298 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
299 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
300 AND tst_pass_result.pass = tst_result_cache.pass
301 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
302 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer')
305 $number_total =
$row[
'count'];
309 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage ,
310 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname
311 FROM object_reference
312 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
313 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
314 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
315 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
316 AND tst_pass_result.pass = tst_result_cache.pass
317 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
319 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
320 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
323 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage,
324 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname
325 FROM object_reference
326 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
327 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
328 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
329 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
330 AND tst_pass_result.pass = tst_result_cache.pass
331 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
332 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
333 AND tst_active.user_fi != ' .
$ilDB->quote($a_user_id,
'integer') .
'
334 AND round(reached_points/max_points*100) >=
336 SELECT round(reached_points/max_points*100)
337 FROM object_reference
338 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
339 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
340 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
341 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
342 AND tst_pass_result.pass = tst_result_cache.pass
343 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
344 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
346 ORDER BY round(reached_points/max_points*100) ASC
350 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage,
351 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname
352 FROM object_reference
353 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
354 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
355 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
356 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
357 AND tst_pass_result.pass = tst_result_cache.pass
358 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi
359 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
360 AND tst_active.user_fi != ' .
$ilDB->quote($a_user_id,
'integer') .
'
361 AND round(reached_points/max_points*100) <=
363 SELECT round(reached_points/max_points*100)
364 FROM object_reference
365 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi
366 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi
367 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi
368 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi
369 AND tst_pass_result.pass = tst_result_cache.pass
370 WHERE object_reference.ref_id = ' .
$ilDB->quote($a_test_ref_id,
'integer') .
'
371 AND tst_active.user_fi = ' .
$ilDB->quote($a_user_id,
'integer') .
'
373 ORDER BY round(reached_points/max_points*100) ASC
376 ORDER BY round(reached_points/max_points*100) DESC, tstamp ASC
380 $i = $own_placement - (($better_participants >= 3) ? 3 : $better_participants);
386 $item = array(
'Rank' =>
'...');
399 if($number_total > $i)
401 $item = array(
'Rank' =>
'...');
417 $item[
'Rank'] = $i .
'. ';
419 if($this->object->isHighscoreAnon() &&
$row[
'usr_id'] != $a_user_id)
421 $item[
'Participant'] =
"-, -";
425 $item[
'Participant'] =
$row[
'lastname'] .
', ' .
$row[
'firstname'];
428 if($this->object->getHighscoreAchievedTS())
434 if($this->object->getHighscoreScore())
436 $item[
'Score'] =
$row[
'reached_points'] .
' / ' .
$row[
'max_points'];
439 if($this->object->getHighscorePercentage())
441 $item[
'Percentage'] =
$row[
'percentage'] .
'%';
444 if($this->object->getHighscoreHints())
446 $item[
'Hints'] =
$row[
'hint_count'];
449 if($this->object->getHighscoreWTime())
454 $item[
'Highlight'] = (
$row[
'usr_id'] == $a_user_id) ?
'tblrowmarked' :
'';
465 $hours = intval(intval($seconds) / 3600);
466 $retval .= str_pad($hours, 2,
"0", STR_PAD_LEFT) .
":";
467 $minutes = intval(($seconds / 60) % 60);
468 $retval .= str_pad($minutes, 2,
"0", STR_PAD_LEFT) .
":";
469 $seconds = intval($seconds % 60);
470 $retval .= str_pad($seconds, 2,
"0", STR_PAD_LEFT);
@classDescription Date and time handling
getResultTableRow($row, $i, $a_user_id)
__construct(ilObjTest $a_object)