ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilHTLMStakeholder.php
Go to the documentation of this file.
1 <?php
2 
21 
26 {
27  public function getId(): string
28  {
29  return 'htlm';
30  }
31 
32  public function getOwnerOfNewResources(): int
33  {
34  return $this->default_owner;
35  }
36 
37  public function getLocationURIForResourceUsage(ResourceIdentification $identification): ?string
38  {
39  $db = $this->resolveDB();
40  if ($db === null) {
41  return null;
42  }
43  $res = $db->queryF(
44  'SELECT ref_id FROM file_based_lm
45  JOIN object_reference ON file_based_lm.id = object_reference.obj_id
46  WHERE rid = %s',
47  ['text'],
48  [$identification->serialize()]
49  );
50  if ($row = $db->fetchAssoc($res)) {
51  return ilLink::_getStaticLink((int) $row['ref_id']);
52  }
53  }
54 
55  public function isResourceInUse(ResourceIdentification $identification): bool
56  {
57  $db = $this->resolveDB();
58  if ($db === null) {
59  return true; // we assume it is in use
60  }
61  $res = $db->queryF(
62  'SELECT ref_id FROM file_based_lm WHERE rid = %s',
63  ['text'],
64  [$identification->serialize()]
65  );
66  return $db->numRows($res) > 0;
67  }
68 
69  private function resolveDB(): ?ilDBInterface
70  {
71  global $DIC;
72  if ($DIC->isDependencyAvailable('database')) {
73  return $DIC->database();
74  }
75  return null;
76  }
77 
78 }
$res
Definition: ltiservices.php:66
getLocationURIForResourceUsage(ResourceIdentification $identification)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
isResourceInUse(ResourceIdentification $identification)
global $DIC
Definition: shib_login.php:22