@@ -14,29 +14,29 @@ discard block |
||
14 | 14 | |
15 | 15 | protected $attachTo; |
16 | 16 | |
17 | - protected $buttons = array(); |
|
17 | + protected $buttons=array(); |
|
18 | 18 | |
19 | 19 | public function __construct(JsUtils $js) { |
20 | 20 | parent::__construct($js); |
21 | - $this->params = array( |
|
21 | + $this->params=array( |
|
22 | 22 | "dialogClass" => "no-close" |
23 | 23 | ); |
24 | 24 | $this->addCancelBtn("Annuler"); |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function getScript() { |
28 | - $allParams = $this->params; |
|
29 | - $jsonButtons = array(); |
|
28 | + $allParams=$this->params; |
|
29 | + $jsonButtons=array(); |
|
30 | 30 | foreach ($this->buttons as $button) { |
31 | - $jsonButtons[] = $button->getParams(); |
|
31 | + $jsonButtons[]=$button->getParams(); |
|
32 | 32 | } |
33 | - $allParams["buttons"] = $jsonButtons; |
|
34 | - $this->jquery_code_for_compile[] = "$( '" . $this->attachTo . "' ).dialog(" . $this->getParamsAsJSON($allParams) . ");"; |
|
35 | - $result = implode("", $this->jquery_code_for_compile); |
|
36 | - $result = str_ireplace("\"%", "", $result); |
|
37 | - $result = str_ireplace("%\"", "", $result); |
|
38 | - $result = str_ireplace("\\n", "", $result); |
|
39 | - $result = str_ireplace("\\t", "", $result); |
|
33 | + $allParams["buttons"]=$jsonButtons; |
|
34 | + $this->jquery_code_for_compile[]="$( '".$this->attachTo."' ).dialog(".$this->getParamsAsJSON($allParams).");"; |
|
35 | + $result=implode("", $this->jquery_code_for_compile); |
|
36 | + $result=str_ireplace("\"%", "", $result); |
|
37 | + $result=str_ireplace("%\"", "", $result); |
|
38 | + $result=str_ireplace("\\n", "", $result); |
|
39 | + $result=str_ireplace("\\t", "", $result); |
|
40 | 40 | return $result; |
41 | 41 | } |
42 | 42 | |
@@ -46,26 +46,26 @@ discard block |
||
46 | 46 | * identifiant CSS |
47 | 47 | */ |
48 | 48 | public function attach($identifier) { |
49 | - $this->attachTo = $identifier; |
|
49 | + $this->attachTo=$identifier; |
|
50 | 50 | } |
51 | 51 | |
52 | - public function addCancelBtn($caption = "Annuler", $position = NULL) { |
|
52 | + public function addCancelBtn($caption="Annuler", $position=NULL) { |
|
53 | 53 | $this->insertBtn(DialogButton::cancelButton($caption), $position); |
54 | 54 | } |
55 | 55 | |
56 | - public function addSubmitBtn(JsUtils $js, $url, $form, $responseElement, $caption = "Valider", $position = NULL) { |
|
56 | + public function addSubmitBtn(JsUtils $js, $url, $form, $responseElement, $caption="Valider", $position=NULL) { |
|
57 | 57 | $this->insertBtn(DialogButton::submitButton($js, $url, $form, $responseElement, $caption), $position); |
58 | 58 | } |
59 | 59 | |
60 | - public function addButton($caption, $jsCode, $position = NULL) { |
|
60 | + public function addButton($caption, $jsCode, $position=NULL) { |
|
61 | 61 | $this->insertBtn(new DialogButton($caption, $jsCode), $position); |
62 | 62 | } |
63 | 63 | |
64 | - private function insertBtn($insert, $position = NULL) { |
|
65 | - if ($position != NULL) { |
|
66 | - $this->buttons = array_splice($this->buttons, $position, 0, $insert); |
|
64 | + private function insertBtn($insert, $position=NULL) { |
|
65 | + if ($position!=NULL) { |
|
66 | + $this->buttons=array_splice($this->buttons, $position, 0, $insert); |
|
67 | 67 | } else { |
68 | - $this->buttons[] = $insert; |
|
68 | + $this->buttons[]=$insert; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->uiName = "spinner"; |
|
17 | + $this->uiName="spinner"; |
|
18 | 18 | } |
19 | 19 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function __construct(JsUtils $js) { |
17 | 17 | parent::__construct($js); |
18 | - $this->uiName = "tooltip"; |
|
18 | + $this->uiName="tooltip"; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->uiName = "menu"; |
|
17 | + $this->uiName="menu"; |
|
18 | 18 | } |
19 | 19 | } |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct(JsUtils $js) { |
18 | 18 | parent::__construct($js); |
19 | - $this->params = array( |
|
19 | + $this->params=array( |
|
20 | 20 | "active" => 0 |
21 | 21 | ); |
22 | - $this->uiName = "accordion"; |
|
22 | + $this->uiName="accordion"; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function setAnimate($value) { |
56 | 56 | if ($value instanceof Animation) |
57 | - $value = $value->getParams(); |
|
57 | + $value=$value->getParams(); |
|
58 | 58 | else if (is_string($value)) { |
59 | - $animation = new Animation(); |
|
59 | + $animation=new Animation(); |
|
60 | 60 | $animation->setEasing($value); |
61 | 61 | } |
62 | 62 | $this->setParam("animate", $value); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | public function setIcons($value) { |
147 | 147 | if (is_string($value)) { |
148 | 148 | if (JString::startsWith($value, "{")); |
149 | - $value = "%" . $value . "%"; |
|
149 | + $value="%".$value."%"; |
|
150 | 150 | } |
151 | 151 | $this->setParam("icons", $value); |
152 | 152 | return $this; |
@@ -53,9 +53,9 @@ |
||
53 | 53 | * @return $this |
54 | 54 | */ |
55 | 55 | public function setAnimate($value) { |
56 | - if ($value instanceof Animation) |
|
57 | - $value = $value->getParams(); |
|
58 | - else if (is_string($value)) { |
|
56 | + if ($value instanceof Animation) { |
|
57 | + $value = $value->getParams(); |
|
58 | + } else if (is_string($value)) { |
|
59 | 59 | $animation = new Animation(); |
60 | 60 | $animation->setEasing($value); |
61 | 61 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->uiName = "selectmenu"; |
|
17 | + $this->uiName="selectmenu"; |
|
18 | 18 | } |
19 | 19 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->uiName = "slider"; |
|
17 | + $this->uiName="slider"; |
|
18 | 18 | $this->setParam("value", 0); |
19 | 19 | } |
20 | 20 |
@@ -14,9 +14,9 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->params = array( |
|
17 | + $this->params=array( |
|
18 | 18 | "value" => 50 |
19 | 19 | ); |
20 | - $this->uiName = "progressbar"; |
|
20 | + $this->uiName="progressbar"; |
|
21 | 21 | } |
22 | 22 | } |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | class DialogButton extends BaseComponent { |
15 | 15 | |
16 | 16 | private function addFunction($jsCode) { |
17 | - if (! JString::startsWith($jsCode, "function")) |
|
18 | - $jsCode = "%function(){" . $jsCode . "}%"; |
|
17 | + if (!JString::startsWith($jsCode, "function")) |
|
18 | + $jsCode="%function(){".$jsCode."}%"; |
|
19 | 19 | return $jsCode; |
20 | 20 | } |
21 | 21 | |
22 | - public function __construct($caption, $jsCode, $event = "click") { |
|
22 | + public function __construct($caption, $jsCode, $event="click") { |
|
23 | 23 | parent::__construct(NULL); |
24 | - $this->params["text"] = $caption; |
|
25 | - $this->params[$event] = $this->addFunction($jsCode); |
|
24 | + $this->params["text"]=$caption; |
|
25 | + $this->params[$event]=$this->addFunction($jsCode); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function __toString() { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | return json_encode($this->params, JSON_UNESCAPED_SLASHES); |
38 | 38 | } |
39 | 39 | |
40 | - public static function cancelButton($caption = "Annuler") { |
|
40 | + public static function cancelButton($caption="Annuler") { |
|
41 | 41 | return new DialogButton($caption, "$( this ).dialog( 'close' );"); |
42 | 42 | } |
43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null) |
53 | 53 | * @return DialogButton |
54 | 54 | */ |
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' );"); |
|
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 | 57 | } |
58 | 58 | } |
@@ -14,8 +14,9 @@ |
||
14 | 14 | class DialogButton extends BaseComponent { |
15 | 15 | |
16 | 16 | private function addFunction($jsCode) { |
17 | - if (! JString::startsWith($jsCode, "function")) |
|
18 | - $jsCode = "%function(){" . $jsCode . "}%"; |
|
17 | + if (! JString::startsWith($jsCode, "function")) { |
|
18 | + $jsCode = "%function(){" . $jsCode . "}%"; |
|
19 | + } |
|
19 | 20 | return $jsCode; |
20 | 21 | } |
21 | 22 |