ILIAS  release_8 Revision v8.24
class.ilADTInternalLinkPresentationBridge.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
6
13{
15
16 protected ilObjUser $user;
17
18 public function __construct(ilADT $a_adt)
19 {
20 global $DIC;
21 parent::__construct($a_adt);
22
23 $this->access = $DIC->access();
24 $this->user = $DIC->user();
25 }
26
32 protected function isValidADT(ilADT $a_adt): bool
33 {
34 return $a_adt instanceof ilADTInternalLink;
35 }
36
41 public function getHTML(): string
42 {
43 if ($this->getADT()->isNull()) {
44 return '';
45 }
46
47 if (!$this->getADT()->isValid()) {
48 return '';
49 }
50
51 if ($this->access->checkAccess('read', '', $this->getADT()->getTargetRefId())) {
52 $title = ilObject::_lookupTitle(ilObject::_lookupObjId($this->getADT()->getTargetRefId()));
53 $link = ilLink::_getLink($this->getADT()->getTargetRefId());
54
55 return $this->decorate(
56 '<a href="' . $link . '">' . $title . '</a>'
57 );
58 }
59 if ($this->access->checkAccess('visible', '', $this->getADT()->getTargetRefId())) {
60 $title = ilObject::_lookupTitle(ilObject::_lookupObjId($this->getADT()->getTargetRefId()));
61
62 return $this->decorate($title);
63 }
64 return '';
65 }
66
71 public function getSortable()
72 {
73 if (!$this->getADT()->isNull()) {
74 return $this->getADT()->getTargetRefId();
75 }
76 return 0;
77 }
78}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ADT base class.
Definition: class.ilADT.php:12
User class.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc