ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  }
36 
42  static function getInstance()
43  {
44  return new ilPanelGUI();
45  }
46 
52  function setHeading($a_val)
53  {
54  $this->heading = $a_val;
55  }
56 
62  function getHeading()
63  {
64  return $this->heading;
65  }
66 
72  function setBody($a_val)
73  {
74  $this->body = $a_val;
75  }
76 
82  function getBody()
83  {
84  return $this->body;
85  }
86 
92  function setFooter($a_val)
93  {
94  $this->footer = $a_val;
95  }
96 
102  function getFooter()
103  {
104  return $this->footer;
105  }
106 
112  function setPanelStyle($a_val)
113  {
114  $this->panel_style = $a_val;
115  }
116 
122  function getPanelStyle()
123  {
124  return $this->panel_style;
125  }
126 
132  function setHeadingStyle($a_val)
133  {
134  $this->heading_style = $a_val;
135  }
136 
142  function getHeadingStyle()
143  {
144  return $this->heading_style;
145  }
146 
152  function setFooterStyle($a_val)
153  {
154  $this->footer_style = $a_val;
155  }
156 
162  function getFooterStyle()
163  {
164  return $this->footer_style;
165  }
166 
172  function getHTML()
173  {
174  $tpl = new ilTemplate("tpl.panel.html", true, true, "Services/UIComponent/Panel");
175 
176  $head_outer_div_style = "";
177  if ($this->getHeading() != "")
178  {
179  $tpl->setCurrentBlock("heading");
180  $tpl->setVariable("HEADING", $this->getHeading());
181 
182  switch ($this->getHeadingStyle())
183  {
184  case self::HEADING_STYLE_BLOCK:
185  $tpl->setVariable("HEAD_DIV_STYLE", "panel-heading ilBlockHeader");
186  $tpl->setVariable("HEAD_H3_STYLE", "ilBlockHeader");
187  $head_outer_div_style = "il_Block";
188  break;
189 
190  case self::HEADING_STYLE_SUBHEADING:
191  $tpl->setVariable("HEAD_DIV_STYLE", "panel-heading ilHeader");
192  $tpl->setVariable("HEAD_H3_STYLE", "ilHeader");
193  break;
194  }
195 
196  $tpl->parseCurrentBlock();
197  }
198 
199  $tpl->setVariable("BODY", $this->getBody());
200 
201  if ($this->getFooter() != "")
202  {
203  $tpl->setCurrentBlock("footer");
204  $tpl->setVariable("FOOTER", $this->getFooter());
205 
206  switch ($this->getFooterStyle())
207  {
208  case self::FOOTER_STYLE_BLOCK:
209  $tpl->setVariable("FOOT_DIV_STYLE", "panel-footer ilBlockInfo");
210  break;
211  }
212 
213  $tpl->parseCurrentBlock();
214  }
215 
216  switch ($this->getPanelStyle())
217  {
218  case self::PANEL_STYLE_SECONDARY:
219  $tpl->setVariable("PANEL_STYLE", "panel panel-default ".$head_outer_div_style);
220  break;
221 
222  default:
223  $tpl->setVariable("PANEL_STYLE", "panel panel-primary ".$head_outer_div_style);
224  break;
225  }
226 
227  return $tpl->get();
228  }
229 
230 
231 }
232 
233 ?>