phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Collapse.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Ajax\JsUtils;
8 
15  protected $collapsed;
16 
17  public function __construct(JsUtils $js) {
18  parent::__construct($js);
19  $this->uiName="collapse";
20  }
21 
22  public function attach($identifier) {
23  parent::attach($identifier);
24  $this->js->attr($identifier, "data-toggle", "collapse", true);
25  }
26 
27  public function show() {
28  $this->jsCodes []=new JsCode(' $(function () {$("%identifier%").click();});');
29  }
30 
36  public function onShow($jsCode) {
37  return $this->addEvent("show.bs.collapse", $jsCode);
38  }
39 
45  public function onShown($jsCode) {
46  return $this->addEvent("shown.bs.collapse", $jsCode);
47  }
48 
54  public function onHide($jsCode) {
55  return $this->addEvent("hide.bs.collapse", $jsCode);
56  }
57 
63  public function onHidden($jsCode) {
64  return $this->addEvent("hidden.bs.collapse", $jsCode);
65  }
66 
67  protected function compileEvents() {
68  foreach ( $this->events as $event => $jsCode ) {
69  $this->jquery_code_for_compile []="$( \"".$this->collapsed."\" ).on(\"".$event."\" , function (e) {".$jsCode."});";
70  }
71  }
72 
73  public function setCollapsed($collapsed) {
74  $this->collapsed=$collapsed;
75  return $this;
76  }
77 }
onHide($jsCode)
This event is fired immediately when the hide method has been called.
Definition: Collapse.php:54
Base class for js code.
Definition: JsCode.php:10
Composant Twitter Bootstrap Collapse.
Definition: Collapse.php:14
onHidden($jsCode)
This event is fired when a collapse element has been hidden from the user (will wait for CSS transiti...
Definition: Collapse.php:63
onShow($jsCode)
This event fires immediately when the show instance method is called.
Definition: Collapse.php:36
JQuery PHP library.
Definition: JsUtils.php:23
onShown($jsCode)
This event is fired when a collapse element has been made visible to the user (will wait for CSS tran...
Definition: Collapse.php:45