ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTInternalLinkPresentationBridge.php
Go to the documentation of this file.
1<?php
2
19declare(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}
ADT presentation bridge base class.
ADT base class.
Definition: class.ilADT.php:26
User class.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26