ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjNotificationAdmin.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  protected int $root_ref_id = 0;
27  protected int $root_id = 0;
28 
29  public function __construct(int $a_id = 0, bool $a_call_by_reference = true)
30  {
31  $this->type = 'nota';
32  parent::__construct($a_id, $a_call_by_reference);
33  }
34 
35  public function getRootRefId(): int
36  {
37  $this->loadRootRefIdAndId();
38 
39  return $this->root_ref_id;
40  }
41 
42  public function getRootId(): int
43  {
44  $this->loadRootRefIdAndId();
45 
46  return $this->root_id;
47  }
48 
52  private function loadRootRefIdAndId(): void
53  {
54  if ($this->root_ref_id === 0 || $this->root_id === 0) {
55  $q = "SELECT object_reference.obj_id, object_reference.ref_id FROM object_data
56  INNER JOIN object_reference ON object_reference.obj_id = object_data.obj_id
57  WHERE type = %s";
58  $set = $this->db->queryF($q, [ilDBConstants::T_TEXT], [$this->type]);
59  if ($res = $this->db->fetchAssoc($set)) {
60  $this->root_id = (int) $res['obj_id'];
61  $this->root_ref_id = (int) $res['ref_id'];
62  } else {
63  throw new PDOException('Node "nota" not found.');
64  }
65  }
66  }
67 }
$res
Definition: ltiservices.php:66
__construct(int $a_id=0, bool $a_call_by_reference=true)
__construct(Container $dic, ilPlugin $plugin)
$q
Definition: shib_logout.php:23