phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Modal.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Ajax\JsUtils;
8 
14 class Modal extends SimpleExtComponent {
15 
16  public function __construct(JsUtils $js) {
17  parent::__construct($js);
18  $this->uiName="modal";
19  }
20 
21  public function attach($identifier) {
22  parent::attach($identifier);
23  $this->js->addClass($identifier, "modal", true);
24  $this->js->attr($identifier, "role", "dialog", true);
25  $this->js->attr($identifier, "aria-labelledby", "myModalLabel", true);
26  $this->js->attr($identifier, "aria-hidden", "true", true);
27  }
28 
34  public function setShow($value) {
35  return $this->setParam("show", $value);
36  }
37 
44  public function setBackdrop($value) {
45  return $this->setParam("backdrop", $value);
46  }
47 
53  public function setKeyboard($value) {
54  return $this->setParam("keyboard", $value);
55  }
56 
57  public function setDraggable($value) {
58  if ($value) {
59  $this->jsCodes ["draggable"]=new Draggable();
60  $this->setBackdrop(false);
61  } else if (array_key_exists("draggable", $this->jsCodes)) {
62  unset($this->jsCodes ["draggable"]);
63  unset($this->params ["backdrop"]);
64  }
65  }
66 
73  public function onShow($jsCode) {
74  return $this->addEvent("show.bs.modal", $jsCode);
75  }
76 
83  public function onShown($jsCode) {
84  return $this->addEvent("shown.bs.modal", $jsCode);
85  }
86 
92  public function onHide($jsCode) {
93  return $this->addEvent("hide.bs.modal", $jsCode);
94  }
95 
101  public function onHidden($jsCode) {
102  return $this->addEvent("hidden.bs.modal", $jsCode);
103  }
104 
110  public function onLoaded($jsCode) {
111  return $this->addEvent("loaded.bs.modal", $jsCode);
112  }
113 }
Composant Twitter Bootstrap Modal.
Definition: Modal.php:14
setShow($value)
Shows the modal when initialized.
Definition: Modal.php:34
onLoaded($jsCode)
This event is fired when the modal has loaded content using the remote option.
Definition: Modal.php:110
onShown($jsCode)
This event is fired when the modal has been made visible to the user (will wait for CSS transitions t...
Definition: Modal.php:83
onHidden($jsCode)
This event is fired when the modal has finished being hidden from the user (will wait for CSS transit...
Definition: Modal.php:101
setKeyboard($value)
Closes the modal when escape key is pressed.
Definition: Modal.php:53
onShow($jsCode)
This event fires immediately when the show instance method is called.
Definition: Modal.php:73
JQuery PHP library.
Definition: JsUtils.php:23
onHide($jsCode)
This event is fired immediately when the hide instance method has been called.
Definition: Modal.php:92
setBackdrop($value)
Includes a modal-backdrop element.
Definition: Modal.php:44