phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlPanel.php
Go to the documentation of this file.
1<?php
2
3namespace Ajax\bootstrap\html;
4
9
17 protected $header;
18 protected $footer;
19 protected $_collapsable;
20 protected $collapseBegin;
21 protected $collapseEnd;
22 protected $_showOnStartup;
23
24 public function __construct($identifier, $content=NULL, $header=NULL, $footer=NULL) {
25 parent::__construct($identifier, "div");
26 $this->_template=include 'templates/tplPanel.php';
27 $this->setProperty("class", "panel panel-default");
28 $this->_collapsable=false;
29 $this->_showOnStartup=false;
30 if ($content!==NULL) {
31 $this->setContent($content);
32 }
33 if ($header!==NULL) {
34 $this->addHeader($header);
35 }
36 if ($footer!==NULL) {
37 $this->addFooter($footer);
38 }
39 }
40
41 public function getHeader() {
42 return $this->header;
43 }
44
45 public function setHeader($header) {
46 $this->header=$header;
47 return $this;
48 }
49
50 public function getFooter() {
51 return $this->footer;
52 }
53
54 public function setFooter($footer) {
55 $this->footer=$footer;
56 return $this;
57 }
58
59 public function addHeader($content) {
60 $header=new HtmlBsDoubleElement("header-".$this->identifier);
61 $header->setTagName("div");
62 $header->setClass("panel-heading");
63 $header->setContent($content);
64 $this->header=$header;
65 return $header;
66 }
67
68 public function addHeaderH($content, $niveau="1") {
69 $headerH=new HtmlBsDoubleElement("header-h-".$this->identifier);
70 $headerH->setContent($content);
71 $headerH->setTagName("h".$niveau);
72 $headerH->setClass("panel-title");
73 return $this->addHeader($headerH);
74 }
75
76 public function addFooter($content) {
77 $footer=new HtmlBsDoubleElement("footer-".$this->identifier);
78 $footer->setTagName("div");
79 $footer->setClass("panel-footer");
80 $footer->setContent($content);
81 $this->footer=$footer;
82 return $this;
83 }
84
91 public function setStyle($cssStyle) {
92 if (!JString::startsWith($cssStyle, "panel"))
93 $cssStyle="panel".$cssStyle;
94 return $this->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("panel"));
95 }
96
97 /*
98 * (non-PHPdoc)
99 * @see BaseHtml::run()
100 */
101 public function run(JsUtils $js) {
102 if ($this->_collapsable) {
103 $this->_bsComponent=$js->bootstrap()->collapse("#lnk-".$this->identifier);
104 $this->_bsComponent->setCollapsed("#collapse-".$this->identifier);
105 if ($this->_showOnStartup===true) {
106 $this->_bsComponent->show();
107 }
108 }
109 return $this->_bsComponent;
110 }
111
112 public function setCollapsable($_collapsable) {
113 $this->_collapsable=$_collapsable;
114 if ($_collapsable) {
115 $this->header->setRole("tab");
116 $lnk=new HtmlLink("lnk-".$this->identifier);
117 $lnk->setHref("#collapse-".$this->identifier);
118 $lnk->setContent($this->header->getContent());
119 $this->header->setContent($lnk);
120 $this->collapseBegin='<div id="collapse-'.$this->identifier.'" class="panel-collapse collapse" role="tabpanel" aria-labelledby="header-'.$this->identifier.'">';
121 $this->collapseEnd="</div>";
122 } else {
123 $this->collapseBegin="";
124 $this->collapseEnd="";
125 }
126 return $this;
127 }
128
134 public function show($value) {
135 if ($this->_collapsable)
136 $this->_showOnStartup=$value;
137 }
138}
JQuery PHP library.
Definition JsUtils.php:23
bootstrap(Bootstrap $bootstrap=NULL)
getter or setter of the Twitter Bootstrap variable
Definition JsUtils.php:140
Composant Twitter Bootstrap panel.
Definition HtmlPanel.php:16
__construct($identifier, $content=NULL, $header=NULL, $footer=NULL)
Definition HtmlPanel.php:24
run(JsUtils $js)
SimpleExtComponent\Ajax\common\html\BaseHtmlrun()\Ajax\common\html\BaseHtmlrun()
setStyle($cssStyle)
define the Panel style avaible values : "panel-default","panel-primary","panel-success",...
Definition HtmlPanel.php:91
show($value)
Shows the panel body on startup if panel is collapsable.
addHeaderH($content, $niveau="1")
Definition HtmlPanel.php:68
Default HTML values for Twitter Bootstrap HTML components.
Definition CssRef.php:12