ILIAS  release_8 Revision v8.24
class.ilObjTestAccess.php
Go to the documentation of this file.
1<?php
2
26
40{
41 public function canBeDelivered(ilWACPath $ilWACPath): bool
42 {
43 global $DIC;
44 $readable = new Readable($DIC);
45
46 $can_it = $this->findMatch($ilWACPath->getPath(), [
47 new AccessFileUploadAnswer($DIC, $readable),
48 new AccessQuestionImage($readable),
49 new AccessFileUploadPreview($DIC->database(), $DIC->access()),
50 ]);
51
52
53 return !$can_it->isOk() || $can_it->value();
54 }
55
56 private function findMatch(string $path, array $array): Result
57 {
58 return array_reduce($array, fn (Result $result, SimpleAccess $access) => $result->except(
59 fn () => $access->isPermitted($path)
60 ), new Error('Not a known path.'));
61 }
62
70 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, int $user_id = null): bool
71 {
72 global $DIC;
73 $ilUser = $DIC['ilUser'];
74 $lng = $DIC['lng'];
75 $rbacsystem = $DIC['rbacsystem'];
76 $ilAccess = $DIC['ilAccess'];
77
78 if (is_null($user_id)) {
79 $user_id = $ilUser->getId();
80 }
81
82 $is_admin = $rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
83
84
85 switch ($permission) {
86 case "visible":
87 case "read":
89 !$is_admin) {
90 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_test_not_complete"));
91 return false;
92 }
93 break;
94 }
95
96 switch ($cmd) {
97 case "eval_a":
98 case "eval_stat":
100 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_test_not_complete"));
101 return false;
102 }
103 break;
104
105 }
106
107 return true;
108 }
109
117 public static function _isPassed($user_id, $a_obj_id): bool
118 {
119 global $DIC;
120 $ilDB = $DIC['ilDB'];
121 $result = $ilDB->queryF(
122 "SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id",
123 array('integer','integer'),
124 array($user_id, $a_obj_id)
125 );
126 if (!$result->numRows()) {
127 $result = $ilDB->queryF(
128 "SELECT tst_active.active_id FROM tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s",
129 array('integer','integer'),
130 array($user_id, $a_obj_id)
131 );
132 $row = $ilDB->fetchAssoc($result);
133 if ($row !== null && $row['active_id'] > 0) {
134 assQuestion::_updateTestResultCache($row['active_id']);
135 } else {
136 return false;
137 }
138 }
139 $result = $ilDB->queryF(
140 "SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id",
141 array('integer','integer'),
142 array($user_id, $a_obj_id)
143 );
144 if (!$result->numRows()) {
145 $result = $ilDB->queryF(
146 "SELECT tst_pass_result.*, tst_tests.pass_scoring, tst_tests.test_id FROM tst_pass_result, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_pass_result.active_fi = tst_active.active_id ORDER BY tst_pass_result.pass",
147 array('integer','integer'),
148 array($user_id, $a_obj_id)
149 );
150
151 if (!$result->numRows()) {
152 return false;
153 }
154
155 $points = array();
156 while ($row = $ilDB->fetchAssoc($result)) {
157 array_push($points, $row);
158 }
159 $reached = 0;
160 $max = 0;
161 if ($points[0]["pass_scoring"] == 0) {
162 $reached = $points[count($points) - 1]["points"];
163 $max = $points[count($points) - 1]["maxpoints"];
164 if (!$max) {
165 $active_id = $points[count($points) - 1]["active_fi"];
166 $pass = $points[count($points) - 1]["pass"];
167 if (strlen($active_id) && strlen($pass)) {
168 $res = assQuestion::_updateTestPassResults($active_id, $pass, false, null, $a_obj_id);
169 $max = $res['maxpoints'];
170 $reached = $res['points'];
171 }
172 }
173 } else {
174 foreach ($points as $row) {
175 if ($row["points"] > $reached) {
176 $reached = $row["points"];
177 $max = $row["maxpoints"];
178 if (!$max) {
179 $active_id = $row["active_fi"];
180 $pass = $row["pass"];
181 if (strlen($active_id) && strlen($pass)) {
182 $res = assQuestion::_updateTestPassResults($active_id, $pass, false, null, $a_obj_id);
183 $max = $res['maxpoints'];
184 $reached = $res['points'];
185 }
186 }
187 }
188 }
189 }
190 $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
191 $mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
192 return ($mark["passed"]) ? true : false;
193 } else {
194 $row = $ilDB->fetchAssoc($result);
195 return ($row['passed']) ? true : false;
196 }
197 }
198
206 public static function isFailed($user_id, $a_obj_id): bool
207 {
208 global $DIC;
209 $ilDB = $DIC['ilDB'];
210
211 $ret = self::updateTestResultCache($user_id, $a_obj_id);
212
213 if (!$ret) {
214 return false;
215 }
216
217 $result = $ilDB->queryF(
218 "SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id",
219 array('integer','integer'),
220 array($user_id, $a_obj_id)
221 );
222
223 if (!$result->numRows()) {
224 $result = $ilDB->queryF(
225 "SELECT tst_pass_result.*, tst_tests.pass_scoring FROM tst_pass_result, tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s AND tst_pass_result.active_fi = tst_active.active_id ORDER BY tst_pass_result.pass",
226 array('integer','integer'),
227 array($user_id, $a_obj_id)
228 );
229
230 while ($row = $ilDB->fetchAssoc($result)) {
231 array_push($points, $row);
232 }
233 $reached = 0;
234 $max = 0;
235 if ($points[0]["pass_scoring"] == 0) {
236 $reached = $points[count($points) - 1]["points"];
237 $max = $points[count($points) - 1]["maxpoints"];
238 if (!$max) {
239 $active_id = $points[count($points) - 1]["active_fi"];
240 $pass = $points[count($points) - 1]["pass"];
241 if (strlen($active_id) && strlen($pass)) {
242 $res = assQuestion::_updateTestPassResults($active_id, $pass, false, null, $a_obj_id);
243 $max = $res['maxpoints'];
244 $reached = $res['points'];
245 }
246 }
247 } else {
248 foreach ($points as $row) {
249 if ($row["points"] > $reached) {
250 $reached = $row["points"];
251 $max = $row["maxpoints"];
252 if (!$max) {
253 $active_id = $row["active_fi"];
254 $pass = $row["pass"];
255 if (strlen($active_id) && strlen($pass)) {
256 $res = assQuestion::_updateTestPassResults($active_id, $pass, false, null, $a_obj_id);
257 $max = $res['maxpoints'];
258 $reached = $res['points'];
259 }
260 }
261 }
262 }
263 }
264 $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
265 $mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
266 return ($mark["failed"]) ? true : false;
267 } else {
268 $row = $ilDB->fetchAssoc($result);
269 return ($row['failed']) ? true : false;
270 }
271 }
272
273 protected static function updateTestResultCache($a_user_id, $a_obj_id): bool
274 {
275 global $DIC;
276 $ilDB = $DIC['ilDB'];
277
278 $result = $ilDB->queryF(
279 "SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests " .
280 "WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s " .
281 "AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id",
282 array('integer','integer'),
283 array($a_user_id, $a_obj_id)
284 );
285 if (!$result->numRows()) {
286 $result = $ilDB->queryF(
287 "SELECT tst_active.active_id FROM tst_active, tst_tests WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND tst_tests.obj_fi = %s",
288 array('integer','integer'),
289 array($a_user_id, $a_obj_id)
290 );
291 $row = $ilDB->fetchAssoc($result);
292 if ($row !== null && $row['active_id'] > 0) {
293 assQuestion::_updateTestResultCache($row['active_id']);
294 return true;
295 } else {
296 return false;
297 }
298 } else {
299 return true;
300 }
301 }
302
303
307 public static function getConditionOperators(): array
308 {
309 return array(
314 );
315 }
316
317
323 public static function checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id): bool
324 {
325 switch ($a_operator) {
327 return ilObjTestAccess::_isPassed($a_usr_id, $a_trigger_obj_id);
328 break;
329
331 return ilObjTestAccess::isFailed($a_usr_id, $a_trigger_obj_id);
332
334 return ilObjTestAccess::hasFinished($a_usr_id, $a_trigger_obj_id);
335
337 return !ilObjTestAccess::hasFinished($a_usr_id, $a_trigger_obj_id);
338
339 default:
340 return true;
341 }
342 return true;
343 }
344
357 public static function _getCommands(): array
358 {
359 global $DIC;
360 $DIC->language()->loadLanguageModule('assessment');
361
362 $commands = array(
363 array("permission" => "write", "cmd" => "questionsTabGateway", "lang_var" => "tst_edit_questions"),
364 array("permission" => "write", "cmd" => "ilObjTestSettingsGeneralGUI::showForm", "lang_var" => "settings"),
365 array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "tst_run",
366 "default" => true),
367 //array("permission" => "write", "cmd" => "", "lang_var" => "edit"),
368 array("permission" => "tst_statistics", "cmd" => "outEvaluation", "lang_var" => "tst_statistical_evaluation"),
369 array("permission" => "read", "cmd" => "userResultsGateway", "lang_var" => "tst_user_results"),
370 array("permission" => "write", "cmd" => "testResultsGateway", "lang_var" => "results"),
371 array("permission" => "eval_a", "cmd" => "testResultsGateway", "lang_var" => "results")
372 );
373
374 return $commands;
375 }
376
377 //
378 // object specific access related methods
379 //
380
384 public static function _lookupCreationComplete($a_obj_id): bool
385 {
386 global $DIC;
387 $ilDB = $DIC['ilDB'];
388
389 $result = $ilDB->queryF(
390 "SELECT complete FROM tst_tests WHERE obj_fi=%s",
391 array('integer'),
392 array($a_obj_id)
393 );
394 if ($result->numRows() == 1) {
395 $row = $ilDB->fetchAssoc($result);
396 }
397
398 return isset($row['complete']) && $row['complete'];
399 }
400
406 private static $hasFinishedCache = array();
407
415 public static function hasFinished($a_user_id, $a_obj_id): bool
416 {
417 if (!isset(self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"])) {
418 require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
419 require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
420 require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
421
422 global $DIC;
423 $ilDB = $DIC['ilDB'];
424 $lng = $DIC['lng'];
425
426 $testOBJ = ilObjectFactory::getInstanceByObjId($a_obj_id);
427
428 $partData = new ilTestParticipantData($ilDB, $lng);
429 $partData->setUserIdsFilter(array($a_user_id));
430 $partData->load($testOBJ->getTestId());
431
432 $activeId = $partData->getActiveIdByUserId($a_user_id);
433
435 $testSessionFactory = new ilTestSessionFactory($testOBJ);
436 $testSession = $testSessionFactory->getSession($activeId);
438 $testPassesSelector = new ilTestPassesSelector($ilDB, $testOBJ);
439 $testPassesSelector->setActiveId($activeId);
440 $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
441
442 self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"] = count($testPassesSelector->getClosedPasses());
443 }
444
445 return (bool) self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"];
446 }
447
455 public static function _getTestIDFromObjectID($object_id)
456 {
457 global $DIC;
458 $ilDB = $DIC['ilDB'];
459 $test_id = false;
460 $result = $ilDB->queryF(
461 "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
462 array('integer'),
463 array($object_id)
464 );
465 if ($result->numRows()) {
466 $row = $ilDB->fetchAssoc($result);
467 $test_id = $row["test_id"];
468 }
469 return $test_id;
470 }
471
478 public static function _lookupObjIdForTestId($a_test_id): int
479 {
480 global $DIC;
481 $ilDB = $DIC['ilDB'];
482
483 $result = $ilDB->queryF(
484 "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
485 array('integer'),
486 array($a_test_id)
487 );
488
489 $row = $ilDB->fetchAssoc($result);
490 return $row["obj_fi"];
491 }
492
500 public static function _getRandomTestsForQuestionPool($qpl_id): array
501 {
502 global $DIC;
503 $ilDB = $DIC['ilDB'];
504
505 $query = "
506 SELECT DISTINCT t.obj_fi
507 FROM tst_tests t
508 INNER JOIN tst_rnd_quest_set_qpls r
509 ON t.test_id = r.test_fi
510 WHERE r.pool_fi = %s
511 ";
512
513 $result = $ilDB->queryF($query, array('integer'), array($qpl_id));
514
515 $tests = array();
516 while ($row = $ilDB->fetchAssoc($result)) {
517 $tests[] = $row['obj_fi'];
518 }
519
520 return $tests;
521 }
522 // fim.
523
530 public static function _lookupOnlineTestAccess($a_test_id, $a_user_id)
531 {
532 global $DIC;
533 $ilDB = $DIC['ilDB'];
534 $lng = $DIC['lng'];
535
536 $result = $ilDB->queryF(
537 "SELECT tst_tests.* FROM tst_tests WHERE tst_tests.obj_fi = %s",
538 array('integer'),
539 array($a_test_id)
540 );
541 if ($result->numRows()) {
542 $row = $ilDB->fetchAssoc($result);
543 if ($row["fixed_participants"]) {
544 $result = $ilDB->queryF(
545 "SELECT * FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
546 array('integer','integer'),
547 array($row["test_id"], $a_user_id)
548 );
549 if ($result->numRows()) {
550 $row = $ilDB->fetchAssoc($result);
551 if (trim($row['clientip']) != "") {
552 $row['clientip'] = preg_replace("/[^0-9.?*,:]+/", "", $row['clientip']);
553 $row['clientip'] = str_replace(".", "\\.", $row['clientip']);
554 $row['clientip'] = str_replace(array("?","*",","), array("[0-9]","[0-9]*","|"), $row['clientip']);
555 if (!preg_match("/^" . $row['clientip'] . "$/", $_SERVER["REMOTE_ADDR"])) {
556 $lng->loadLanguageModule('assessment');
557 return $lng->txt("user_wrong_clientip");
558 } else {
559 return true;
560 }
561 } else {
562 return true;
563 }
564 } else {
565 return $lng->txt("tst_user_not_invited");
566 }
567 } else {
568 return true;
569 }
570 } else {
571 return true;
572 }
573 }
574
582 public static function _getParticipantData($active_id): string
583 {
584 global $DIC;
585 $lng = $DIC['lng'];
586 $ilDB = $DIC['ilDB'];
587
588 $result = $ilDB->queryF(
589 "SELECT * FROM tst_active WHERE active_id = %s",
590 array("integer"),
591 array($active_id)
592 );
593 $row = $ilDB->fetchAssoc($result);
594 $user_id = $row["user_fi"];
595 $test_id = $row["test_fi"];
596 $importname = $row['importname'];
597
598 $result = $ilDB->queryF(
599 "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
600 array("integer"),
601 array($test_id)
602 );
603 $row = $ilDB->fetchAssoc($result);
604 $obj_id = $row["obj_fi"];
605
606 $is_anonymous = ilObjTest::_lookupAnonymity($obj_id);
607
608 $uname = ilObjUser::_lookupName($user_id);
609
610 $name = "";
611 if (strlen($importname)) {
612 $name = $importname . ' (' . $lng->txt('imported') . ')';
613 } elseif (strlen($uname["firstname"] . $uname["lastname"]) == 0) {
614 $name = $lng->txt("deleted_user");
615 } else {
616 if ($user_id == ANONYMOUS_USER_ID) {
617 $name = "";
618 } else {
619 $name = trim($uname["lastname"] . ", " . $uname["firstname"]);
620 }
621 if ($is_anonymous) {
622 $name = $lng->txt("anonymous");
623 }
624 }
625 return $name;
626 }
627
634 public static function _getParticipantId($active_id): int
635 {
636 global $DIC;
637 $lng = $DIC['lng'];
638 $ilDB = $DIC['ilDB'];
639
640 $result = $ilDB->queryF(
641 "SELECT user_fi FROM tst_active WHERE active_id = %s",
642 array("integer"),
643 array($active_id)
644 );
645 $row = $ilDB->fetchAssoc($result);
646 return $row["user_fi"];
647 }
648
649
664 public static function _getPassedUsers($a_obj_id): array
665 {
666 global $DIC;
667 $ilDB = $DIC['ilDB'];
668
669 $passed_users = array();
670 // Maybe SELECT DISTINCT(tst_active.user_fi)... ?
671 $userresult = $ilDB->queryF(
672 "
673 SELECT tst_active.active_id, COUNT(tst_sequence.active_fi) sequences, tst_active.last_finished_pass,
674 CASE WHEN
675 (tst_tests.nr_of_tries - 1) = tst_active.last_finished_pass
676 THEN '1'
677 ELSE '0'
678 END is_last_pass
679 FROM tst_tests
680 INNER JOIN tst_active
681 ON tst_active.test_fi = tst_tests.test_id
682 LEFT JOIN tst_sequence
683 ON tst_sequence.active_fi = tst_active.active_id
684 WHERE tst_tests.obj_fi = %s
685 GROUP BY tst_active.active_id
686 ",
687 array('integer'),
688 array($a_obj_id)
689 );
690 $all_participants = array();
691 $notAttempted = array();
692 $lastPassUsers = array();
693 while ($row = $ilDB->fetchAssoc($userresult)) {
694 if ($row['sequences'] == 0) {
695 $notAttempted[$row['active_id']] = $row['active_id'];
696 }
697 if ($row['is_last_pass']) {
698 $lastPassUsers[$row['active_id']] = $row['active_id'];
699 }
700
701 $all_participants[$row['active_id']] = $row['active_id'];
702 }
703
704 $result = $ilDB->query("SELECT tst_result_cache.*, tst_active.user_fi FROM tst_result_cache, tst_active WHERE tst_active.active_id = tst_result_cache.active_fi AND " . $ilDB->in('active_fi', $all_participants, false, 'integer'));
705 $found_all = ($result->numRows() == count($all_participants)) ? true : false;
706 if (!$found_all) {
707 // if the result cache entries do not exist, create them
708 $found_participants = array();
709 while ($data = $ilDB->fetchAssoc($result)) {
710 array_push($found_participants, $data['active_fi']);
711 }
712 foreach ($all_participants as $active_id) {
713 if (!in_array($active_id, $found_participants)) {
715 }
716 }
717 $result = $ilDB->query("SELECT tst_result_cache.*, tst_active.user_fi FROM tst_result_cache, tst_active WHERE tst_active.active_id = tst_result_cache.active_fi AND " . $ilDB->in('active_fi', $all_participants, false, 'integer'));
718 }
719 while ($data = $ilDB->fetchAssoc($result)) {
720 if (isset($notAttempted[$data['active_fi']])) {
721 $data['failed'] = 0;
722 $data['passed'] = 0;
723 $data['not_attempted'] = 1;
724 }
725
726 $data['user_id'] = $data['user_fi'];
727 array_push($passed_users, $data);
728 }
729 return $passed_users;
730 }
731
735 public static function _checkGoto(string $target): bool
736 {
737 global $DIC;
738 $ilAccess = $DIC['ilAccess'];
739
740 $t_arr = explode("_", $target);
741
742 if ($t_arr[0] != "tst" || ((int) $t_arr[1]) <= 0) {
743 return false;
744 }
745
746 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
747 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
748 return true;
749 }
750 return false;
751 }
752
758 public static function _isOffline(int $obj_id): bool
759 {
760 // global $DIC;
761 // $ilUser = $DIC['ilUser'];
762 // return (self::_lookupOnlineTestAccess($obj_id, $ilUser->getId()) !== true) ||
763 // (!ilObjTestAccess::_lookupCreationComplete($obj_id));
764 return ilObject::lookupOfflineStatus($obj_id);
765 }
766
767
768 public static function visibleUserResultExists($testObjId, $userId): bool
769 {
770 $testOBJ = ilObjectFactory::getInstanceByObjId($testObjId, false);
771
772 if (!($testOBJ instanceof ilObjTest)) {
773 return false;
774 }
775
776 require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
777 $testSessionFactory = new ilTestSessionFactory($testOBJ);
778 $testSession = $testSessionFactory->getSessionByUserId($userId);
779
780 return $testOBJ->canShowTestResults($testSession);
781 }
782}
static _getMatchingMarkFromObjId($a_obj_id, float $percentage)
Returns the matching mark for a given percentage.
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Error.php:18
return true
static _updateTestResultCache(int $active_id, ilAssQuestionProcessLocker $processLocker=null)
@TODO Move this to a proper place.
Class ilObjTestAccess.
canBeDelivered(ilWACPath $ilWACPath)
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static hasFinished($a_user_id, $a_obj_id)
Returns (request cached) information if a specific user has finished at least one test pass.
findMatch(string $path, array $array)
static getConditionOperators()
Get possible conditions operators.
static _isOffline(int $obj_id)
returns the objects's OFFline status
static _getParticipantData($active_id)
Retrieves a participant name from active id.
static _getParticipantId($active_id)
Get user id for active id.
static _getPassedUsers($a_obj_id)
Returns an array containing the users who passed the test.
static _getCommands()
get commands
static _checkGoto(string $target)
check whether goto script will succeed
static updateTestResultCache($a_user_id, $a_obj_id)
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, int $user_id=null)
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
static _lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
static _isPassed($user_id, $a_obj_id)
Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id.
static visibleUserResultExists($testObjId, $userId)
static isFailed($user_id, $a_obj_id)
Returns TRUE if the user with the user id $user_id failed the test with the object id $a_obj_id.
static _lookupCreationComplete($a_obj_id)
checks wether all necessary parts of the test are given
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition
static _getRandomTestsForQuestionPool($qpl_id)
Get all tests using a question pool for random selection.
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
static _lookupName(int $a_user_id)
lookup user name
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:15
except(callable $f)
Feed the error into a callable and replace this with the result or do nothing if this is a value.
Interface for condition handling.
$ref_id
Definition: ltiauth.php:67
$path
Definition: ltiservices.php:32
$res
Definition: ltiservices.php:69
if($format !==null) $name
Definition: metadata.php:247
$query
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$lng