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
2
namespace
Ajax\ui\components
;
3
4
use
Ajax\JsUtils
;
5
use
Ajax\common\components\BaseComponent
;
6
use
Ajax\service\JString
;
7
14
class
DialogButton
extends
BaseComponent
{
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
}
Ajax\JsUtils
JQuery PHP library.
Definition
JsUtils.php:23
Ajax\common\components\BaseComponent
Base component for JQuery UI visuals components.
Definition
BaseComponent.php:12
Ajax\common\components\BaseComponent\$js
$js
Definition
BaseComponent.php:20
Ajax\service\JString
Definition
JString.php:4
Ajax\ui\components\DialogButton
JQuery UI Button for the Dialog Component.
Definition
DialogButton.php:14
Ajax\ui\components\DialogButton\__construct
__construct($caption, $jsCode, $event="click")
Definition
DialogButton.php:22
Ajax\ui\components\DialogButton\__toString
__toString()
Definition
DialogButton.php:28
Ajax\ui\components\DialogButton\submitButton
static submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[])
Definition
DialogButton.php:55
Ajax\ui\components\DialogButton\getScript
getScript()
Definition
DialogButton.php:36
Ajax\ui\components\DialogButton\addFunction
addFunction($jsCode)
Definition
DialogButton.php:16
Ajax\ui\components\DialogButton\cancelButton
static cancelButton($caption="Annuler")
Definition
DialogButton.php:40
Ajax\ui\components
Definition
Accordion.php:2
Ajax
ui
components
DialogButton.php
Generated on Sun Dec 10 2023 16:16:11 for
phpMv-UI
by
doxygen
1.9.8