@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getItemToAdd($item){ |
52 | 52 | $itemO=parent::getItemToAdd($item); |
53 | - if($itemO instanceof AbstractCheckbox) |
|
54 | - $itemO->addClass("item"); |
|
53 | + if($itemO instanceof AbstractCheckbox) { |
|
54 | + $itemO->addClass("item"); |
|
55 | + } |
|
55 | 56 | return $itemO; |
56 | 57 | } |
57 | 58 | |
@@ -106,14 +107,15 @@ discard block |
||
106 | 107 | if (isset($masterItem)) { |
107 | 108 | if(\is_array($masterItem)){ |
108 | 109 | $masterO=new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0],@$masterItem[1]); |
109 | - if(isset($name)) |
|
110 | - $masterO->setName($name); |
|
110 | + if(isset($name)) { |
|
111 | + $masterO->setName($name); |
|
112 | + } |
|
111 | 113 | if(isset($masterItem[1])){ |
112 | 114 | if(\array_search($masterItem[1], $values)!==false){ |
113 | 115 | $masterO->getDataField()->setProperty("checked", ""); |
114 | 116 | } |
115 | 117 | } |
116 | - }else{ |
|
118 | + } else{ |
|
117 | 119 | $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
118 | 120 | } |
119 | 121 | if($notAllChecked){ |
@@ -130,8 +132,9 @@ discard block |
||
130 | 132 | if (\array_search($val, $values) !== false) { |
131 | 133 | $itemO->getDataField()->setProperty("checked", ""); |
132 | 134 | } |
133 | - if(isset($name)) |
|
134 | - $itemO->setName($name); |
|
135 | + if(isset($name)) { |
|
136 | + $itemO->setName($name); |
|
137 | + } |
|
135 | 138 | $itemO->setClass("item"); |
136 | 139 | $fields[]=$itemO; |
137 | 140 | } |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | } |
29 | 29 | $retour.="$.".$method."(url,".self::_correctParams($params).").done(function( data ) {\n"; |
30 | 30 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n"; |
31 | - if ($immediatly) |
|
32 | - $this->jquery_code_for_compile[]=$retour; |
|
31 | + if ($immediatly) { |
|
32 | + $this->jquery_code_for_compile[]=$retour; |
|
33 | + } |
|
33 | 34 | return $retour; |
34 | 35 | } |
35 | 36 | |
@@ -39,15 +40,17 @@ discard block |
||
39 | 40 | $url=$this->_correctAjaxUrl($url); |
40 | 41 | $retour="url='".$url."';"; |
41 | 42 | $slash="/"; |
42 | - if(JString::endswith($url, "/")===true) |
|
43 | - $slash=""; |
|
43 | + if(JString::endswith($url, "/")===true) { |
|
44 | + $slash=""; |
|
45 | + } |
|
44 | 46 | if(JString::isNotNull($attr)){ |
45 | - if ($attr==="value") |
|
46 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
47 | - elseif ($attr==="html") |
|
48 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
49 | - elseif($attr!==null && $attr!=="") |
|
50 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
47 | + if ($attr==="value") { |
|
48 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
49 | + } elseif ($attr==="html") { |
|
50 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
51 | + } elseif($attr!==null && $attr!=="") { |
|
52 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
53 | + } |
|
51 | 54 | } |
52 | 55 | return $retour; |
53 | 56 | } |
@@ -57,13 +60,14 @@ discard block |
||
57 | 60 | if ($responseElement!=="") { |
58 | 61 | if(isset($ajaxTransition)){ |
59 | 62 | $call=$this->setAjaxDataCall($ajaxTransition); |
60 | - }elseif(isset($this->ajaxTransition)){ |
|
63 | + } elseif(isset($this->ajaxTransition)){ |
|
61 | 64 | $call=$this->ajaxTransition; |
62 | 65 | } |
63 | - if(\is_callable($call)) |
|
64 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
65 | - else |
|
66 | - $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
|
66 | + if(\is_callable($call)) { |
|
67 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
68 | + } else { |
|
69 | + $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
|
70 | + } |
|
67 | 71 | } |
68 | 72 | $retour.="\t".$jsCallback."\n"; |
69 | 73 | return $retour; |
@@ -77,8 +81,9 @@ discard block |
||
77 | 81 | } |
78 | 82 | |
79 | 83 | protected function _correctAjaxUrl($url) { |
80 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
81 | - $url=substr($url, 0, strlen($url)-1); |
|
84 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
85 | + $url=substr($url, 0, strlen($url)-1); |
|
86 | + } |
|
82 | 87 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
83 | 88 | $url=$this->getUrl($url); |
84 | 89 | } |
@@ -184,8 +189,9 @@ discard block |
||
184 | 189 | $retour.="\t".$jsCallback."\n". |
185 | 190 | "\t$(document).trigger('jsonReady',[data]);\n". |
186 | 191 | "});\n"; |
187 | - if ($immediatly) |
|
188 | - $this->jquery_code_for_compile[]=$retour; |
|
192 | + if ($immediatly) { |
|
193 | + $this->jquery_code_for_compile[]=$retour; |
|
194 | + } |
|
189 | 195 | return $retour; |
190 | 196 | } |
191 | 197 | |
@@ -250,7 +256,7 @@ discard block |
||
250 | 256 | if($context===null){ |
251 | 257 | $parent="$('".$maskSelector."').parent()"; |
252 | 258 | $newElm = "$('#'+newId)"; |
253 | - }else{ |
|
259 | + } else{ |
|
254 | 260 | $parent=$context; |
255 | 261 | $newElm = $context.".find('#'+newId)"; |
256 | 262 | } |
@@ -263,8 +269,9 @@ discard block |
||
263 | 269 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
264 | 270 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
265 | 271 | $retour.="\t".$jsCallback."\n"."});\n"; |
266 | - if ($immediatly) |
|
267 | - $this->jquery_code_for_compile[]=$retour; |
|
272 | + if ($immediatly) { |
|
273 | + $this->jquery_code_for_compile[]=$retour; |
|
274 | + } |
|
268 | 275 | return $retour; |
269 | 276 | } |
270 | 277 | |
@@ -494,8 +501,9 @@ discard block |
||
494 | 501 | }});\n"; |
495 | 502 | $retour.="$('#".$form."').submit();\n"; |
496 | 503 | } |
497 | - if ($immediatly) |
|
498 | - $this->jquery_code_for_compile[]=$retour; |
|
504 | + if ($immediatly) { |
|
505 | + $this->jquery_code_for_compile[]=$retour; |
|
506 | + } |
|
499 | 507 | return $retour; |
500 | 508 | } |
501 | 509 |