ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilContainerReferenceAccess.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
30  public static function _isAccessible(int $a_ref_id): bool
31  {
32  global $DIC;
33 
34  $ilDB = $DIC->database();
35  $tree = $DIC->repositoryTree();
36  $access = $DIC->access();
37 
38  $obj_id = ilObject::_lookupObjId($a_ref_id);
39  $query = "SELECT target_obj_id FROM container_reference " .
40  "WHERE obj_id = " . $ilDB->quote($obj_id, 'integer') . " ";
41  $res = $ilDB->query($query);
42  $target_id = 0;
43  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
44  $target_id = (int) $row->target_obj_id;
45  }
46  $target_ref_ids = ilObject::_getAllReferences($target_id);
47  $target_ref_id = current($target_ref_ids);
48  return
49  !$tree->isDeleted($target_ref_id) &&
50  $access->checkAccess('read', '', $target_ref_id);
51  }
52 }
$res
Definition: ltiservices.php:69
static _getAllReferences(int $id)
get all reference ids for object ID
$target_id
Definition: goto.php:52
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query
static _isAccessible(int $a_ref_id)
Check if target is accessible and not deleted.