ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjTestAccess.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Services/Object/classes/class.ilObjectAccess.php";
5 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
6 include_once './Services/AccessControl/interfaces/interface.ilConditionHandling.php';
7 
21 {
37  public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
38  {
39  global $ilUser, $lng, $rbacsystem, $ilAccess;
40 
41  if ($a_user_id == "") {
42  $a_user_id = $ilUser->getId();
43  }
44 
45  $is_admin = $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
46 
47  // check "global" online switch
48  if (!self::_isOnline($a_obj_id) && !$is_admin) {
49  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
50  return false;
51  }
52 
53  switch ($a_permission) {
54  case "visible":
55  case "read":
57  !$is_admin) {
58  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_test_not_complete"));
59  return false;
60  }
61  break;
62  }
63 
64  switch ($a_cmd) {
65  case "eval_a":
66  case "eval_stat":
68  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_test_not_complete"));
69  return false;
70  }
71  break;
72 
73  }
74 
75  return true;
76  }
77 
85  public static function _isPassed($user_id, $a_obj_id)
86  {
87  global $ilDB;
88  $result = $ilDB->queryF(
89  "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",
90  array('integer','integer'),
91  array($user_id, $a_obj_id)
92  );
93  if (!$result->numRows()) {
94  $result = $ilDB->queryF(
95  "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",
96  array('integer','integer'),
97  array($user_id, $a_obj_id)
98  );
99  $row = $ilDB->fetchAssoc($result);
100  if ($row['active_id'] > 0) {
101  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
103  } else {
104  return false;
105  }
106  }
107  $result = $ilDB->queryF(
108  "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",
109  array('integer','integer'),
110  array($user_id, $a_obj_id)
111  );
112  if (!$result->numRows()) {
113  $result = $ilDB->queryF(
114  "SELECT tst_pass_result.*, tst_tests.pass_scoring, tst_tests.random_test, 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",
115  array('integer','integer'),
116  array($user_id, $a_obj_id)
117  );
118  $points = array();
119  while ($row = $ilDB->fetchAssoc($result)) {
120  array_push($points, $row);
121  }
122  $reached = 0;
123  $max = 0;
124  if ($points[0]["pass_scoring"] == 0) {
125  $reached = $points[count($points)-1]["points"];
126  $max = $points[count($points)-1]["maxpoints"];
127  if (!$max) {
128  $active_id = $points[count($points)-1]["active_fi"];
129  $pass = $points[count($points)-1]["pass"];
130  if (strlen($active_id) && strlen($pass)) {
131  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
132  $res = assQuestion::_updateTestPassResults($active_id, $pass, null, $a_obj_id);
133  $max = $res['maxpoints'];
134  $reached = $res['points'];
135  }
136  }
137  } else {
138  foreach ($points as $row) {
139  if ($row["points"] > $reached) {
140  $reached = $row["points"];
141  $max = $row["maxpoints"];
142  if (!$max) {
143  $active_id = $row["active_fi"];
144  $pass = $row["pass"];
145  if (strlen($active_id) && strlen($pass)) {
146  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
147  $res = assQuestion::_updateTestPassResults($active_id, $pass, null, $a_obj_id);
148  $max = $res['maxpoints'];
149  $reached = $res['points'];
150  }
151  }
152  }
153  }
154  }
155  include_once "./Modules/Test/classes/class.assMarkSchema.php";
156  $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
157  $mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
158  return ($mark["passed"]) ? true : false;
159  } else {
160  $row = $ilDB->fetchAssoc($result);
161  return ($row['passed']) ? true : false;
162  }
163  }
164 
172  public static function isFailed($user_id, $a_obj_id)
173  {
174  global $ilDB;
175 
176  $ret = self::updateTestResultCache($user_id, $a_obj_id);
177 
178  if (!$ret) {
179  return false;
180  }
181 
182  $result = $ilDB->queryF(
183  "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",
184  array('integer','integer'),
185  array($user_id, $a_obj_id)
186  );
187 
188  if (!$result->numRows()) {
189  $result = $ilDB->queryF(
190  "SELECT tst_pass_result.*, tst_tests.pass_scoring, tst_tests.random_test, 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",
191  array('integer','integer'),
192  array($user_id, $a_obj_id)
193  );
194 
195  while ($row = $ilDB->fetchAssoc($result)) {
196  array_push($points, $row);
197  }
198  $reached = 0;
199  $max = 0;
200  if ($points[0]["pass_scoring"] == 0) {
201  $reached = $points[count($points)-1]["points"];
202  $max = $points[count($points)-1]["maxpoints"];
203  if (!$max) {
204  $active_id = $points[count($points)-1]["active_fi"];
205  $pass = $points[count($points)-1]["pass"];
206  if (strlen($active_id) && strlen($pass)) {
207  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
208  $res = assQuestion::_updateTestPassResults($active_id, $pass, null, $a_obj_id);
209  $max = $res['maxpoints'];
210  $reached = $res['points'];
211  }
212  }
213  } else {
214  foreach ($points as $row) {
215  if ($row["points"] > $reached) {
216  $reached = $row["points"];
217  $max = $row["maxpoints"];
218  if (!$max) {
219  $active_id = $row["active_fi"];
220  $pass = $row["pass"];
221  if (strlen($active_id) && strlen($pass)) {
222  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
223  $res = assQuestion::_updateTestPassResults($active_id, $pass, null, $a_obj_id);
224  $max = $res['maxpoints'];
225  $reached = $res['points'];
226  }
227  }
228  }
229  }
230  }
231  include_once "./Modules/Test/classes/class.assMarkSchema.php";
232  $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
233  $mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
234  return ($mark["failed"]) ? true : false;
235  } else {
236  $row = $ilDB->fetchAssoc($result);
237  return ($row['failed']) ? true : false;
238  }
239  }
240 
246  protected static function updateTestResultCache($a_user_id, $a_obj_id)
247  {
248  global $ilDB;
249 
250  $result = $ilDB->queryF(
251  "SELECT tst_result_cache.* FROM tst_result_cache, tst_active, tst_tests " .
252  "WHERE tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s " .
253  "AND tst_tests.obj_fi = %s AND tst_result_cache.active_fi = tst_active.active_id",
254  array('integer','integer'),
255  array($a_user_id, $a_obj_id)
256  );
257  if (!$result->numRows()) {
258  $result = $ilDB->queryF(
259  "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",
260  array('integer','integer'),
261  array($a_user_id, $a_obj_id)
262  );
263  $row = $ilDB->fetchAssoc($result);
264  if ($row['active_id'] > 0) {
265  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
267  return true;
268  } else {
269  return false;
270  }
271  } else {
272  return true;
273  }
274  }
275 
276 
280  public static function getConditionOperators()
281  {
282  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
283  return array(
288  );
289  }
290 
291 
297  public static function checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
298  {
299  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
300 
301  switch ($a_operator) {
303  return ilObjTestAccess::_isPassed($a_usr_id, $a_obj_id);
304  break;
305 
307  return ilObjTestAccess::isFailed($a_usr_id, $a_obj_id);
308 
310  return ilObjTestAccess::hasFinished($a_usr_id, $a_obj_id);
311 
313  return !ilObjTestAccess::hasFinished($a_usr_id, $a_obj_id);
314 
315  default:
316  return true;
317  }
318  return true;
319  }
320 
333  public static function _getCommands()
334  {
335  $commands = array(
336  array("permission" => "write", "cmd" => "questionsTabGateway", "lang_var" => "tst_edit_questions"),
337  array("permission" => "write", "cmd" => "ilObjTestSettingsGeneralGUI::showForm", "lang_var" => "settings"),
338  array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "tst_run",
339  "default" => true),
340  //array("permission" => "write", "cmd" => "", "lang_var" => "edit"),
341  array("permission" => "tst_statistics", "cmd" => "outEvaluation", "lang_var" => "tst_statistical_evaluation"),
342  array("permission" => "read", "cmd" => "userResultsGateway", "lang_var" => "tst_test_results")
343  );
344 
345  return $commands;
346  }
347 
348  //
349  // object specific access related methods
350  //
351 
355  public static function _lookupCreationComplete($a_obj_id)
356  {
357  global $ilDB;
358 
359  $result = $ilDB->queryF(
360  "SELECT complete FROM tst_tests WHERE obj_fi=%s",
361  array('integer'),
362  array($a_obj_id)
363  );
364  if ($result->numRows() == 1) {
365  $row = $ilDB->fetchAssoc($result);
366  }
367 
368  return ($row['complete']) ? true : false;
369  }
370 
376  private static $hasFinishedCache = array();
377 
385  public static function hasFinished($a_user_id, $a_obj_id)
386  {
387  if (!isset(self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"])) {
388  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
389  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
390  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
391 
392  global $ilDB, $lng;
393 
394  $testOBJ = ilObjectFactory::getInstanceByObjId($a_obj_id);
395 
396  $partData = new ilTestParticipantData($ilDB, $lng);
397  $partData->setUserIds(array($a_user_id));
398  $partData->load($testOBJ->getTestId());
399 
400  $activeId = $partData->getActiveIdByUserId($a_user_id);
401 
402  $testSessionFactory = new ilTestSessionFactory($testOBJ);
403  $testSession = $testSessionFactory->getSession($activeId);
404 
405  $testPassesSelector = new ilTestPassesSelector($ilDB, $testOBJ);
406  $testPassesSelector->setActiveId($activeId);
407  $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
408 
409  self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"] = count($testPassesSelector->getClosedPasses());
410  }
411 
412  return (bool) self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"];
413  }
414 
422  public static function _getTestIDFromObjectID($object_id)
423  {
424  global $ilDB;
425  $test_id = false;
426  $result = $ilDB->queryF(
427  "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
428  array('integer'),
429  array($object_id)
430  );
431  if ($result->numRows()) {
432  $row = $ilDB->fetchAssoc($result);
433  $test_id = $row["test_id"];
434  }
435  return $test_id;
436  }
437 
444  public static function _lookupObjIdForTestId($a_test_id)
445  {
446  global $ilDB;
447 
448  $result = $ilDB->queryF(
449  "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
450  array('integer'),
451  array($a_test_id)
452  );
453 
454  $row = $ilDB->fetchAssoc($result);
455  return $row["obj_fi"];
456  }
457 
465  public static function _getRandomTestsForQuestionPool($qpl_id)
466  {
467  global $ilDB;
468 
469  $query = "
470  SELECT DISTINCT t.obj_fi
471  FROM tst_tests t
472  INNER JOIN tst_rnd_quest_set_qpls r
473  ON t.test_id = r.test_fi
474  WHERE r.pool_fi = %s
475  ";
476 
477  $result = $ilDB->queryF($query, array('integer'), array($qpl_id));
478 
479  $tests = array();
480  while ($row = $ilDB->fetchAssoc($result)) {
481  $tests[] = $row['obj_fi'];
482  }
483 
484  return $tests;
485  }
486  // fim.
487 
494  public static function _lookupOnlineTestAccess($a_test_id, $a_user_id)
495  {
496  global $ilDB, $lng;
497 
498  $result = $ilDB->queryF(
499  "SELECT tst_tests.* FROM tst_tests WHERE tst_tests.obj_fi = %s",
500  array('integer'),
501  array($a_test_id)
502  );
503  if ($result->numRows()) {
504  $row = $ilDB->fetchAssoc($result);
505  if ($row["fixed_participants"]) {
506  $result = $ilDB->queryF(
507  "SELECT * FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
508  array('integer','integer'),
509  array($row["test_id"], $a_user_id)
510  );
511  if ($result->numRows()) {
512  $row = $ilDB->fetchAssoc($result);
513  if (trim($row['clientip']) != "") {
514  $row['clientip'] = preg_replace("/[^0-9.?*,:]+/", "", $row['clientip']);
515  $row['clientip'] = str_replace(".", "\\.", $row['clientip']);
516  $row['clientip'] = str_replace(array("?","*",","), array("[0-9]","[0-9]*","|"), $row['clientip']);
517  if (!preg_match("/^" . $row['clientip'] . "$/", $_SERVER["REMOTE_ADDR"])) {
518  $lng->loadLanguageModule('assessment');
519  return $lng->txt("user_wrong_clientip");
520  } else {
521  return true;
522  }
523  } else {
524  return true;
525  }
526  } else {
527  return $lng->txt("tst_user_not_invited");
528  }
529  } else {
530  return true;
531  }
532  } else {
533  return true;
534  }
535  }
536 
544  public static function _getParticipantData($active_id)
545  {
546  global $lng, $ilDB;
547 
548  $result = $ilDB->queryF(
549  "SELECT * FROM tst_active WHERE active_id = %s",
550  array("integer"),
551  array($active_id)
552  );
553  $row = $ilDB->fetchAssoc($result);
554  $user_id = $row["user_fi"];
555  $test_id = $row["test_fi"];
556  $importname = $row['importname'];
557 
558  $result = $ilDB->queryF(
559  "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
560  array("integer"),
561  array($test_id)
562  );
563  $row = $ilDB->fetchAssoc($result);
564  $obj_id = $row["obj_fi"];
565 
566  include_once "./Modules/Test/classes/class.ilObjTest.php";
567  $is_anonymous = ilObjTest::_lookupAnonymity($obj_id);
568 
569  include_once './Services/User/classes/class.ilObjUser.php';
570  $uname = ilObjUser::_lookupName($user_id);
571 
572  $name = "";
573  if (strlen($importname)) {
574  $name = $importname . ' (' . $lng->txt('imported') . ')';
575  } elseif (strlen($uname["firstname"] . $uname["lastname"]) == 0) {
576  $name = $lng->txt("deleted_user");
577  } else {
578  if ($user_id == ANONYMOUS_USER_ID) {
579  $name = $lastname;
580  } else {
581  $name = trim($uname["lastname"] . ", " . $uname["firstname"] . " " . $uname["title"]);
582  }
583  if ($is_anonymous) {
584  $name = $lng->txt("anonymous");
585  }
586  }
587  return $name;
588  }
589 
596  public static function _getParticipantId($active_id)
597  {
598  global $lng, $ilDB;
599 
600  $result = $ilDB->queryF(
601  "SELECT user_fi FROM tst_active WHERE active_id = %s",
602  array("integer"),
603  array($active_id)
604  );
605  $row = $ilDB->fetchAssoc($result);
606  return $row["user_fi"];
607  }
608 
609 
624  public static function _getPassedUsers($a_obj_id)
625  {
626  global $ilDB;
627 
628  $passed_users = array();
629  // Maybe SELECT DISTINCT(tst_active.user_fi)... ?
630  $userresult = $ilDB->queryF(
631  "
632  SELECT tst_active.active_id, COUNT(tst_sequence.active_fi) sequences, tst_active.last_finished_pass,
633  CASE WHEN
634  (tst_tests.nr_of_tries - 1) = tst_active.last_finished_pass
635  THEN '1'
636  ELSE '0'
637  END is_last_pass
638  FROM tst_tests
639  INNER JOIN tst_active
640  ON tst_active.test_fi = tst_tests.test_id
641  LEFT JOIN tst_sequence
642  ON tst_sequence.active_fi = tst_active.active_id
643  WHERE tst_tests.obj_fi = %s
644  GROUP BY tst_active.active_id
645  ",
646  array('integer'),
647  array($a_obj_id)
648  );
649  $all_participants = array();
650  $notAttempted = array();
651  $lastPassUsers = array();
652  while ($row = $ilDB->fetchAssoc($userresult)) {
653  if ($row['sequences'] == 0) {
654  $notAttempted[$row['active_id']] = $row['active_id'];
655  }
656  if ($row['is_last_pass']) {
657  $lastPassUsers[$row['active_id']] = $row['active_id'];
658  }
659 
660  $all_participants[$row['active_id']] = $row['active_id'];
661  }
662 
663  $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'));
664  $found_all = ($result->numRows() == count($all_participants)) ? true : false;
665  if (!$found_all) {
666  // if the result cache entries do not exist, create them
667  $found_participants = array();
668  while ($data = $ilDB->fetchAssoc($result)) {
669  array_push($found_participants, $data['active_fi']);
670  }
671  foreach ($all_participants as $active_id) {
672  if (!in_array($active_id, $found_participants)) {
673  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
675  }
676  }
677  $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'));
678  }
679  while ($data = $ilDB->fetchAssoc($result)) {
680  if (isset($notAttempted[$data['active_fi']])) {
681  $data['failed'] = 0;
682  $data['passed'] = 0;
683  $data['not_attempted'] = 1;
684  }
685 
686  if ($data['failed'] && !isset($lastPassUsers[$data['active_fi']])) {
687  $data['passed'] = 0;
688  $data['failed'] = 0;
689  $data['in_progress'] = 1;
690  }
691 
692  $data['user_id'] = $data['user_fi'];
693  array_push($passed_users, $data);
694  }
695  return $passed_users;
696  }
697 
701  public static function _checkGoto($a_target)
702  {
703  global $ilAccess;
704 
705  $t_arr = explode("_", $a_target);
706 
707  if ($t_arr[0] != "tst" || ((int) $t_arr[1]) <= 0) {
708  return false;
709  }
710 
711  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
712  return true;
713  }
714  return false;
715  }
716 
725  public static function _isOffline($a_obj_id)
726  {
727  // global $ilUser;
728  // return (self::_lookupOnlineTestAccess($a_obj_id, $ilUser->getId()) !== true) ||
729  // (!ilObjTestAccess::_lookupCreationComplete($a_obj_id));
730  return !self::_isOnline($a_obj_id);
731  }
732 
739  public static function _isOnline($a_obj_id)
740  {
741  global $ilDB;
742 
743  $query = "
744  SELECT test_id
745  FROM tst_tests
746  WHERE obj_fi = %s
747  AND online_status = 1
748  ";
749 
750  $result = $ilDB->queryF($query, array('integer'), array($a_obj_id));
751 
752  return $result->numRows() == 1;
753  }
754 
755  public static function visibleUserResultExists($testObjId, $userId)
756  {
757  $testOBJ = ilObjectFactory::getInstanceByObjId($testObjId, false);
758 
759  if (!($testOBJ instanceof ilObjTest)) {
760  return false;
761  }
762 
763  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
764  $testSessionFactory = new ilTestSessionFactory($testOBJ);
765  $testSession = $testSessionFactory->getSessionByUserId($userId);
766 
767  return $testOBJ->canShowTestResults($testSession);
768  }
769 
777  public static function hasVisibleCertificate($testObjId, $userId)
778  {
779  $testOBJ = ilObjectFactory::getInstanceByObjId($testObjId, false);
780 
781  if (!($testOBJ instanceof ilObjTest) || !$userId) {
782  return false;
783  }
784 
785  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
786  $testSessionFactory = new ilTestSessionFactory($testOBJ);
787  $testSession = $testSessionFactory->getSessionByUserId($userId);
788 
789  if (!$testSession->getActiveId()) {
790  return false;
791  }
792 
793  return $testOBJ->canShowCertificate($testSession, $testSession->getUserId(), $testSession->getActiveId());
794  }
795 }
static _lookupName($a_user_id)
lookup user name
static _lookupCreationComplete($a_obj_id)
checks wether all necessary parts of the test are given
static _updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
Move this to a proper place.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
static _getParticipantData($active_id)
Retrieves a participant name from active id.
static _getParticipantId($active_id)
Get user id for active id.
$result
const IL_NO_OBJECT_ACCESS
Interface for condition handling.
static _isOffline($a_obj_id)
returns the objects&#39;s OFFline status
static _isOnline($a_obj_id)
returns the objects&#39;s ONline status
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
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 _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
if($format !==null) $name
Definition: metadata.php:146
static _getRandomTestsForQuestionPool($qpl_id)
Get all tests using a question pool for random selection.
static _lookupObjIdForTestId($a_test_id)
Lookup object id for test id.
static _getMatchingMarkFromObjId($a_obj_id, $percentage)
Returns the matching mark for a given percentage.
foreach($_POST as $key=> $value) $res
static visibleUserResultExists($testObjId, $userId)
$ilUser
Definition: imgupload.php:18
static _getPassedUsers($a_obj_id)
Returns an array containing the users who passed the test.
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static hasVisibleCertificate($testObjId, $userId)
Andre Michels amichels@databay.de
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...
$query
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjTestAccess.
Create styles array
The data for the language used.
static getConditionOperators()
Get possible conditions operators.
static updateTestResultCache($a_user_id, $a_obj_id)
Update test result cache.
Class ilObjectAccess.
global $lng
Definition: privfeed.php:17
global $ilDB
$ret
Definition: parser.php:6
static _getCommands()
get commands
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
check condition
static hasFinished($a_user_id, $a_obj_id)
Returns (request cached) information if a specific user has finished at least one test pass...
static _checkGoto($a_target)
check whether goto script will succeed