ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLightboxGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
17  protected $tpl;
18 
19  protected $id = "";
20 
27  public function __construct($a_id)
28  {
29  global $DIC;
30 
31  $this->tpl = $DIC["tpl"];
32  $this->setId($a_id);
33  }
34 
40  public function setId($a_val)
41  {
42  $this->id = $a_val;
43  }
44 
50  public function getId()
51  {
52  return $this->id;
53  }
54 
60  public function setWidth($a_val)
61  {
62  $this->width = $a_val;
63  }
64 
70  public function getWidth()
71  {
72  return $this->width;
73  }
74 
78  public static function getLocalLightboxJsPath()
79  {
80  return "./Services/UIComponent/Lightbox/js/Lightbox.js";
81  }
82 
86  public function addLightbox($a_tpl = null)
87  {
88  $tpl = $this->tpl;
89 
90  if ($a_tpl == null) {
91  $a_tpl = $tpl;
92  }
93 
94  $a_tpl->addJavaScript(self::getLocalLightboxJsPath());
95  $a_tpl->addLightbox($this->getHTML(), $this->getId());
96  }
97 
104  public function getHTML()
105  {
106  $tpl = new ilTemplate("tpl.lightbox.html", true, true, "Services/UIComponent/Lightbox");
107  $tpl->setVariable("LIGHTBOX_CONTENT", "");
108  $tpl->setVariable("ID", $this->getId());
109  if ($this->getWidth() != "") {
110  $tpl->setVariable("WIDTH", "width: " . $this->getWidth() . ";");
111  }
112  return $tpl->get();
113  }
114 }
getWidth()
Get width.
global $DIC
Definition: saml.php:7
Lighbox handling.
setWidth($a_val)
Set width.
setId($a_val)
Set Id.
static getLocalLightboxJsPath()
Get local path of jQuery file.
special template class to simplify handling of ITX/PEAR
__construct($a_id)
Constructor.
addLightbox($a_tpl=null)
Init lightbox.