ILIAS  release_8 Revision v8.24
class.ilPermanentLinkGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected ilLanguage $lng;
27 protected ilCtrl $ctrl;
29 protected bool $align_center = true;
30 protected bool $includepermanentlinktext = false;
31 protected string $type = "";
32 protected string $id = "";
33 protected string $append = "";
34 protected string $target = "";
35 protected string $title = "";
36
40 public function __construct(
41 string $a_type,
42 int $a_id,
43 string $a_append = "",
44 string $a_target = ""
45 ) {
46 global $DIC;
47
48 $this->lng = $DIC->language();
49 $this->ctrl = $DIC->ctrl();
50 $this->obj_data_cache = $DIC["ilObjDataCache"];
51 $this->setType($a_type);
52 $this->setId($a_id);
53 $this->setAppend($a_append);
54 $this->setIncludePermanentLinkText(true);
55 $this->setTarget($a_target);
56 }
57
61 public function setIncludePermanentLinkText(bool $a_includepermanentlinktext): void
62 {
63 $this->includepermanentlinktext = $a_includepermanentlinktext;
64 }
65
69 public function getIncludePermanentLinkText(): bool
70 {
72 }
73
74 public function setType(string $a_type): void
75 {
76 $this->type = $a_type;
77 }
78
79 public function getType(): string
80 {
81 return $this->type;
82 }
83
84 public function setId(string $a_id): void
85 {
86 $this->id = $a_id;
87 }
88
89 public function getId(): string
90 {
91 return $this->id;
92 }
93
94 public function setAppend(string $a_append): void
95 {
96 $this->append = $a_append;
97 }
98
99 public function getAppend(): string
100 {
101 return $this->append;
102 }
103
104 public function setTarget(string $a_target): void
105 {
106 $this->target = $a_target;
107 }
108
109 public function getTarget(): string
110 {
111 return $this->target;
112 }
113
114 public function setTitle(string $a_val): void
115 {
116 $this->title = $a_val;
117 }
118
119 public function getTitle(): string
120 {
121 return $this->title;
122 }
123
124 public function getHTML(): string
125 {
127 $ilObjDataCache = $this->obj_data_cache;
128
129 $tpl = new ilTemplate(
130 "tpl.permanent_link.html",
131 true,
132 true,
133 "Services/PermanentLink"
134 );
135
137 $this->getId(),
138 $this->getType(),
139 true,
140 $this->getAppend()
141 );
142 if ($this->getIncludePermanentLinkText()) {
143 $tpl->setVariable("TXT_PERMA", $lng->txt("perma_link") . ":");
144 }
145
146 $title = '';
147
148 if ($this->getTitle() != "") {
149 $title = $this->getTitle();
150 } elseif (is_numeric($this->getId())) {
151 $obj_id = $ilObjDataCache->lookupObjId((int) $this->getId());
152 $title = $ilObjDataCache->lookupTitle($obj_id);
153 }
154
155 $tpl->setVariable("TXT_BOOKMARK_DEFAULT", $title);
156
157 $tpl->setVariable("LINK", $href);
158
159 $tpl->setVariable("ALIGN", "left");
160
161 if ($this->getTarget() != "") {
162 $tpl->setVariable("TARGET", 'target="' . $this->getTarget() . '"');
163 }
164
165 return $tpl->get();
166 }
167}
Class ilCtrl provides processing control methods.
language handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(string $a_type, int $a_id, string $a_append="", string $a_target="")
Example: type = "wiki", id (ref_id) = "234", append = "_Start_Page".
ilObjectDataCache $obj_data_cache
setIncludePermanentLinkText(bool $a_includepermanentlinktext)
Set Include permanent link text.
getIncludePermanentLinkText()
Include permanent link text.
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: feed.php:28
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41