phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
DialogButton.php
Go to the documentation of this file.
1<?php
2namespace Ajax\ui\components;
3
7
15
16 private function addFunction($jsCode) {
17 if (! JString::startsWith($jsCode, "function"))
18 $jsCode = "%function(){" . $jsCode . "}%";
19 return $jsCode;
20 }
21
22 public function __construct($caption, $jsCode, $event = "click") {
23 parent::__construct(NULL);
24 $this->params["text"] = $caption;
25 $this->params[$event] = $this->addFunction($jsCode);
26 }
27
28 public function __toString() {
29 return $this->getScript();
30 }
31
32 /*
33 * (non-PHPdoc)
34 * @see \Ajax\common\BaseComponent::getScript()
35 */
36 public function getScript() {
37 return json_encode($this->params, JSON_UNESCAPED_SLASHES);
38 }
39
40 public static function cancelButton($caption = "Annuler") {
41 return new DialogButton($caption, "$( this ).dialog( 'close' );");
42 }
43
55 public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption = "Okay", $parameters = []) {
56 return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters) . ";$( this ).dialog( 'close' );");
57 }
58}
JQuery PHP library.
Definition JsUtils.php:23
Base component for JQuery UI visuals components.
JQuery UI Button for the Dialog Component.
__construct($caption, $jsCode, $event="click")
static submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[])
static cancelButton($caption="Annuler")