ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilPanelGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
16 
19 
20  const FOOTER_STYLE_BLOCK = 0;
21 
22  protected $heading = "";
23  protected $body = "";
24  protected $footer = "";
25  protected $panel_style = 0;
26  protected $heading_style = 0;
27  protected $footer_style = 0;
28 
32  protected function __construct()
33  {
34  }
35 
41  public static function getInstance()
42  {
43  return new ilPanelGUI();
44  }
45 
51  public function setHeading($a_val)
52  {
53  $this->heading = $a_val;
54  }
55 
61  public function getHeading()
62  {
63  return $this->heading;
64  }
65 
71  public function setBody($a_val)
72  {
73  $this->body = $a_val;
74  }
75 
81  public function getBody()
82  {
83  return $this->body;
84  }
85 
91  public function setFooter($a_val)
92  {
93  $this->footer = $a_val;
94  }
95 
101  public function getFooter()
102  {
103  return $this->footer;
104  }
105 
111  public function setPanelStyle($a_val)
112  {
113  $this->panel_style = $a_val;
114  }
115 
121  public function getPanelStyle()
122  {
123  return $this->panel_style;
124  }
125 
131  public function setHeadingStyle($a_val)
132  {
133  $this->heading_style = $a_val;
134  }
135 
141  public function getHeadingStyle()
142  {
143  return $this->heading_style;
144  }
145 
151  public function setFooterStyle($a_val)
152  {
153  $this->footer_style = $a_val;
154  }
155 
161  public function getFooterStyle()
162  {
163  return $this->footer_style;
164  }
165 
171  public function getHTML()
172  {
173  $tpl = new ilTemplate("tpl.panel.html", true, true, "Services/UIComponent/Panel");
174 
175  $head_outer_div_style = "";
176  if ($this->getHeading() != "") {
177  $tpl->setCurrentBlock("heading");
178  $tpl->setVariable("HEADING", $this->getHeading());
179 
180  switch ($this->getHeadingStyle()) {
181  case self::HEADING_STYLE_BLOCK:
182  $tpl->setVariable("HEAD_DIV_STYLE", "panel-heading ilBlockHeader");
183  $tpl->setVariable("HEAD_H3_STYLE", "ilBlockHeader");
184  $head_outer_div_style = "il_Block";
185  break;
186 
187  case self::HEADING_STYLE_SUBHEADING:
188  $tpl->setVariable("HEAD_DIV_STYLE", "panel-heading ilHeader");
189  $tpl->setVariable("HEAD_H3_STYLE", "ilHeader");
190  break;
191  }
192 
193  $tpl->parseCurrentBlock();
194  }
195 
196  $tpl->setVariable("BODY", $this->getBody());
197 
198  if ($this->getFooter() != "") {
199  $tpl->setCurrentBlock("footer");
200  $tpl->setVariable("FOOTER", $this->getFooter());
201 
202  switch ($this->getFooterStyle()) {
203  case self::FOOTER_STYLE_BLOCK:
204  $tpl->setVariable("FOOT_DIV_STYLE", "panel-footer ilBlockInfo");
205  break;
206  }
207 
208  $tpl->parseCurrentBlock();
209  }
210 
211  switch ($this->getPanelStyle()) {
212  case self::PANEL_STYLE_SECONDARY:
213  $tpl->setVariable("PANEL_STYLE", "panel panel-default " . $head_outer_div_style);
214  break;
215 
216  default:
217  $tpl->setVariable("PANEL_STYLE", "panel panel-primary " . $head_outer_div_style);
218  break;
219  }
220 
221  return $tpl->get();
222  }
223 }
setFooter($a_val)
Set footer.
__construct()
Constructor.
$tpl
Definition: ilias.php:10
const PANEL_STYLE_PRIMARY
getHeadingStyle()
Get heading style.
Simple panel class.
setBody($a_val)
Set body.
getHTML()
Get HTML.
Set header footer
Definition: 04printing.php:58
setFooterStyle($a_val)
Set footer style.
setPanelStyle($a_val)
Set panel style.
special template class to simplify handling of ITX/PEAR
getFooter()
Get body.
getFooterStyle()
Get footer style.
const HEADING_STYLE_SUBHEADING
static getInstance()
Get instance.
setHeadingStyle($a_val)
Set heading style.
setHeading($a_val)
Set heading.
const PANEL_STYLE_SECONDARY
getBody()
Get body.
const HEADING_STYLE_BLOCK
getPanelStyle()
Get panel style.
const FOOTER_STYLE_BLOCK
getHeading()
Get heading.