ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPermanentLinkGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
38 {
42  function __construct($a_type, $a_id, $a_append = "", $a_target = "")
43  {
44  $this->setType($a_type);
45  $this->setId($a_id);
46  $this->setAppend($a_append);
47  $this->setIncludePermanentLinkText(true);
48  $this->setTarget($a_target);
49  }
50 
56  function setIncludePermanentLinkText($a_includepermanentlinktext)
57  {
58  $this->includepermanentlinktext = $a_includepermanentlinktext;
59  }
60 
67  {
68  return $this->includepermanentlinktext;
69  }
70 
76  function setType($a_type)
77  {
78  $this->type = $a_type;
79  }
80 
86  function getType()
87  {
88  return $this->type;
89  }
90 
96  function setId($a_id)
97  {
98  $this->id = $a_id;
99  }
100 
106  function getId()
107  {
108  return $this->id;
109  }
110 
116  function setAppend($a_append)
117  {
118  $this->append = $a_append;
119  }
120 
126  function getAppend()
127  {
128  return $this->append;
129  }
130 
136  function setTarget($a_target)
137  {
138  $this->target = $a_target;
139  }
140 
146  function getTarget()
147  {
148  return $this->target;
149  }
150 
154  function getHTML()
155  {
156  global $lng;
157 
158  $tpl = new ilTemplate("tpl.permanent_link.html", true, true,
159  "Services/PermanentLink");
160 
161  include_once('classes/class.ilLink.php');
162  $href = ilLink::_getStaticLink($this->getId(), $this->getType(),
163  true, $this->getAppend());
164 
165  // delicous link
166  $d_set = new ilSetting("delicious");
167  if ($d_set->get("add_info_links") == "1")
168  {
169  $tpl->setCurrentBlock("delicious");
170  $lng->loadLanguageModule("delic");
171  $tpl->setVariable("DEL_LINK", urlencode($href));
172  $tpl->setVariable("IMG_DEL", ilUtil::getImagePath("icon_delicious_s.gif"));
173  $tpl->setVariable("TXT_DEL", $lng->txt("delic_add_to_delicious"));
174  $tpl->parseCurrentBlock();
175  }
176 
177  if ($this->getIncludePermanentLinkText())
178  {
179  $tpl->setVariable("TXT_PERMA", $lng->txt("perma_link").": ");
180  }
181  $tpl->setVariable("LINK", $href);
182  if ($this->getTarget() != "")
183  {
184  $tpl->setVariable("TARGET", 'target="'.$this->getTarget().'"');
185  }
186 
187  return $tpl->get();
188  }
189 }
190 
191 ?>