ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilADTInternalLinkPresentationBridge.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
29 
30  protected ilObjUser $user;
31 
32  public function __construct(ilADT $a_adt)
33  {
34  global $DIC;
35  parent::__construct($a_adt);
36 
37  $this->access = $DIC->access();
38  $this->user = $DIC->user();
39  }
40 
46  protected function isValidADT(ilADT $a_adt): bool
47  {
48  return $a_adt instanceof ilADTInternalLink;
49  }
50 
55  public function getHTML(): string
56  {
57  if ($this->getADT()->isNull()) {
58  return '';
59  }
60 
61  if (!$this->getADT()->isValid()) {
62  return '';
63  }
64 
65  if ($this->access->checkAccess('read', '', $this->getADT()->getTargetRefId())) {
66  $title = ilObject::_lookupTitle(ilObject::_lookupObjId($this->getADT()->getTargetRefId()));
67  $link = ilLink::_getLink($this->getADT()->getTargetRefId());
68 
69  return $this->decorate(
70  '<a href="' . $link . '">' . $title . '</a>'
71  );
72  }
73  if ($this->access->checkAccess('visible', '', $this->getADT()->getTargetRefId())) {
74  $title = ilObject::_lookupTitle(ilObject::_lookupObjId($this->getADT()->getTargetRefId()));
75 
76  return $this->decorate($title);
77  }
78  return '';
79  }
80 
85  public function getSortable()
86  {
87  if (!$this->getADT()->isNull()) {
88  return $this->getADT()->getTargetRefId();
89  }
90  return 0;
91  }
92 }
decorate($a_value)
Decorate value.
ADT base class.
Definition: class.ilADT.php:25
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
ADT presentation bridge base class.