ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPermanentLinkGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
18{
22 protected $lng;
23
27 protected $ctrl;
28
32 protected $obj_data_cache;
33
34 protected $align_center = true;
35
39 public function __construct($a_type, $a_id, $a_append = "", $a_target = "")
40 {
41 global $DIC;
42
43 $this->lng = $DIC->language();
44 $this->ctrl = $DIC->ctrl();
45 $this->obj_data_cache = $DIC["ilObjDataCache"];
46 $this->setType($a_type);
47 $this->setId($a_id);
48 $this->setAppend($a_append);
49 $this->setIncludePermanentLinkText(true);
50 $this->setTarget($a_target);
51 }
52
58 public function setIncludePermanentLinkText($a_includepermanentlinktext)
59 {
60 $this->includepermanentlinktext = $a_includepermanentlinktext;
61 }
62
69 {
70 return $this->includepermanentlinktext;
71 }
72
78 public function setType($a_type)
79 {
80 $this->type = $a_type;
81 }
82
88 public function getType()
89 {
90 return $this->type;
91 }
92
98 public function setId($a_id)
99 {
100 $this->id = $a_id;
101 }
102
108 public function getId()
109 {
110 return $this->id;
111 }
112
118 public function setAppend($a_append)
119 {
120 $this->append = $a_append;
121 }
122
128 public function getAppend()
129 {
130 return $this->append;
131 }
132
138 public function setTarget($a_target)
139 {
140 $this->target = $a_target;
141 }
142
148 public function getTarget()
149 {
150 return $this->target;
151 }
152
158 public function setTitle($a_val)
159 {
160 $this->title = $a_val;
161 }
162
168 public function getTitle()
169 {
170 return $this->title;
171 }
172
178 public function setAlignCenter($a_val)
179 {
180 $this->align_center = $a_val;
181 }
182
188 public function getAlignCenter()
189 {
190 return $this->align_center;
191 }
192
196 public function getHTML()
197 {
199 $ilCtrl = $this->ctrl;
200 $ilObjDataCache = $this->obj_data_cache;
201
202 $tpl = new ilTemplate(
203 "tpl.permanent_link.html",
204 true,
205 true,
206 "Services/PermanentLink"
207 );
208
209 include_once('./Services/Link/classes/class.ilLink.php');
211 $this->getId(),
212 $this->getType(),
213 true,
214 $this->getAppend()
215 );
216 if ($this->getIncludePermanentLinkText()) {
217 $tpl->setVariable("TXT_PERMA", $lng->txt("perma_link") . ":");
218 }
219
220 $title = '';
221
222 if ($this->getTitle() != "") {
223 $title = $this->getTitle();
224 } elseif (is_numeric($this->getId())) {
225 $obj_id = $ilObjDataCache->lookupObjId($this->getId());
226 $title = $ilObjDataCache->lookupTitle($obj_id);
227 }
228
229 $tpl->setVariable("TXT_BOOKMARK_DEFAULT", $title);
230
231 $tpl->setVariable("LINK", $href);
232
233 if ($this->getAlignCenter()) {
234 $tpl->setVariable("ALIGN", "center");
235 } else {
236 $tpl->setVariable("ALIGN", "left");
237 }
238
239 if ($this->getTarget() != "") {
240 $tpl->setVariable("TARGET", 'target="' . $this->getTarget() . '"');
241 }
242
243 return $tpl->get();
244 }
245}
An exception for terminatinating execution or to throw for unit testing.
Class for permanent links.
setIncludePermanentLinkText($a_includepermanentlinktext)
Set Include permanent link text.
getAlignCenter()
Get center alignment.
__construct($a_type, $a_id, $a_append="", $a_target="")
Example: type = "wiki", id (ref_id) = "234", append = "_Start_Page".
setAppend($a_append)
Set Append.
setAlignCenter($a_val)
Set center alignment.
getIncludePermanentLinkText()
Get Include permanent link text.
getHTML()
Get HTML for link.
setTarget($a_target)
Set Target.
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: goto.php:24
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$type