ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilADTInternalLinkPresentationBridge.php
Go to the documentation of this file.
1 <?php
2 
3 declare(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 }
decorate($a_value)
Decorate value.
ADT base class.
Definition: class.ilADT.php:11
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...