phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlCollapse.php
Go to the documentation of this file.
1<?php
2
3namespace Ajax\bootstrap\html;
4
9
17 protected $collapse;
18
19 public function __construct($element=NULL) {
20 parent::__construct($element);
21 $this->_template="%element%%collapse%";
22 $this->element->setProperty("data-toogle", "collapse");
23 $this->element->setProperty("aria-expanded", "false");
24 }
25
26 public function attachTo($identifier) {
27 $this->element->setProperty("aria-controls", $identifier);
28 if ($this->element->getTagName()==="a")
29 $this->element->setProperty("href", "#".$identifier);
30 else
31 $this->element->setProperty("data-target", "#".$identifier);
32 }
33
34 public function getAttachedZone() {
35 $id=$this->element->getProperty("aria-controls");
36 if (!isset($id))
37 if ($this->element->getTagName()==="a")
38 $id=$this->element->getProperty("href");
39 if (!isset($id)||$id==="#") {
40 $id="collapse-".$this->element->getIdentifier();
41 $this->attachTo($id);
42 }
43 $id=$this->cleanIdentifier($id);
44 return $id;
45 }
46
48 $this->attachTo($element->getIdentifier());
49 $this->collapse=$element;
50 }
51
52 public function createCollapsedZone($content="", $attachTo=NULL) {
53 if (isset($attachTo))
54 $this->attachTo($attachTo);
55 $collapsedZone=new HtmlBsDoubleElement($this->getAttachedZone());
56 $collapsedZone->setProperty("class", "collapse");
57 $collapsedZone->setContent($content);
58 return $collapsedZone;
59 }
60
61 public function addCollapsedZone($content="", $attachTo=NULL) {
62 $this->collapse=$this->createCollapsedZone($content, $attachTo);
63 return $this->collapse;
64 }
65
66 /*
67 * (non-PHPdoc)
68 * @see BaseHtml::run()
69 */
70 public function run(JsUtils $js) {
71 $this->_bsComponent=$js->bootstrap()->collapse("#".$this->element->getIdentifier());
72 $this->addEventsOnRun($js);
74 }
75
76 public function __toString() {
77 return $this->compile();
78 }
79}
JQuery PHP library.
Definition JsUtils.php:23
bootstrap(Bootstrap $bootstrap=NULL)
getter or setter of the Twitter Bootstrap variable
Definition JsUtils.php:140
Twitter Bootstrap Collapse component.
setAttachedZone(HtmlDoubleElement $element)
addCollapsedZone($content="", $attachTo=NULL)
createCollapsedZone($content="", $attachTo=NULL)
compile(JsUtils $js=NULL, &$view=NULL)
Definition BaseHtml.php:207