@@ -24,10 +24,12 @@ discard block |
||
24 | 24 | if (isset($value)) { |
25 | 25 | $value=Javascript::prep_value($value); |
26 | 26 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
27 | - } else |
|
28 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
29 | - if ($immediatly) |
|
30 | - $this->jquery_code_for_compile[]=$str; |
|
27 | + } else { |
|
28 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
29 | + } |
|
30 | + if ($immediatly) { |
|
31 | + $this->jquery_code_for_compile[]=$str; |
|
32 | + } |
|
31 | 33 | return $str; |
32 | 34 | } |
33 | 35 | |
@@ -42,8 +44,9 @@ discard block |
||
42 | 44 | $element=Javascript::prep_element($element); |
43 | 45 | $value=Javascript::prep_value($value); |
44 | 46 | $str="$({$element}).after({$value});"; |
45 | - if ($immediatly) |
|
46 | - $this->jquery_code_for_compile[]=$str; |
|
47 | + if ($immediatly) { |
|
48 | + $this->jquery_code_for_compile[]=$str; |
|
49 | + } |
|
47 | 50 | return $str; |
48 | 51 | } |
49 | 52 | |
@@ -79,8 +82,9 @@ discard block |
||
79 | 82 | |
80 | 83 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
81 | 84 | |
82 | - if ($immediatly) |
|
83 | - $this->jquery_code_for_compile[]=$str; |
|
85 | + if ($immediatly) { |
|
86 | + $this->jquery_code_for_compile[]=$str; |
|
87 | + } |
|
84 | 88 | return $str; |
85 | 89 | } |
86 | 90 | |
@@ -105,8 +109,9 @@ discard block |
||
105 | 109 | |
106 | 110 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
107 | 111 | |
108 | - if ($immediatly) |
|
109 | - $this->jquery_code_for_compile[]=$str; |
|
112 | + if ($immediatly) { |
|
113 | + $this->jquery_code_for_compile[]=$str; |
|
114 | + } |
|
110 | 115 | return $str; |
111 | 116 | } |
112 | 117 | |
@@ -131,8 +136,9 @@ discard block |
||
131 | 136 | |
132 | 137 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
133 | 138 | |
134 | - if ($immediatly) |
|
135 | - $this->jquery_code_for_compile[]=$str; |
|
139 | + if ($immediatly) { |
|
140 | + $this->jquery_code_for_compile[]=$str; |
|
141 | + } |
|
136 | 142 | return $str; |
137 | 143 | } |
138 | 144 | |
@@ -157,8 +163,9 @@ discard block |
||
157 | 163 | |
158 | 164 | $str="$({$element}).hide({$speed}{$callback});"; |
159 | 165 | |
160 | - if ($immediatly) |
|
161 | - $this->jquery_code_for_compile[]=$str; |
|
166 | + if ($immediatly) { |
|
167 | + $this->jquery_code_for_compile[]=$str; |
|
168 | + } |
|
162 | 169 | return $str; |
163 | 170 | } |
164 | 171 | |
@@ -185,8 +192,9 @@ discard block |
||
185 | 192 | |
186 | 193 | $str="$({$element}).slideUp({$speed}{$callback});"; |
187 | 194 | |
188 | - if ($immediatly) |
|
189 | - $this->jquery_code_for_compile[]=$str; |
|
195 | + if ($immediatly) { |
|
196 | + $this->jquery_code_for_compile[]=$str; |
|
197 | + } |
|
190 | 198 | return $str; |
191 | 199 | } |
192 | 200 | |
@@ -211,8 +219,9 @@ discard block |
||
211 | 219 | |
212 | 220 | $str="$({$element}).slideDown({$speed}{$callback});"; |
213 | 221 | |
214 | - if ($immediatly) |
|
215 | - $this->jquery_code_for_compile[]=$str; |
|
222 | + if ($immediatly) { |
|
223 | + $this->jquery_code_for_compile[]=$str; |
|
224 | + } |
|
216 | 225 | return $str; |
217 | 226 | } |
218 | 227 | |
@@ -237,8 +246,9 @@ discard block |
||
237 | 246 | |
238 | 247 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
239 | 248 | |
240 | - if ($immediatly) |
|
241 | - $this->jquery_code_for_compile[]=$str; |
|
249 | + if ($immediatly) { |
|
250 | + $this->jquery_code_for_compile[]=$str; |
|
251 | + } |
|
242 | 252 | return $str; |
243 | 253 | } |
244 | 254 | |
@@ -255,8 +265,9 @@ discard block |
||
255 | 265 | $element=Javascript::prep_element($element); |
256 | 266 | $str="$({$element}).toggle();"; |
257 | 267 | |
258 | - if ($immediatly) |
|
259 | - $this->jquery_code_for_compile[]=$str; |
|
268 | + if ($immediatly) { |
|
269 | + $this->jquery_code_for_compile[]=$str; |
|
270 | + } |
|
260 | 271 | return $str; |
261 | 272 | } |
262 | 273 | |
@@ -272,8 +283,9 @@ discard block |
||
272 | 283 | $element=Javascript::prep_element($element); |
273 | 284 | $str="$({$element}).trigger(\"$event\");"; |
274 | 285 | |
275 | - if ($immediatly) |
|
276 | - $this->jquery_code_for_compile[]=$str; |
|
286 | + if ($immediatly) { |
|
287 | + $this->jquery_code_for_compile[]=$str; |
|
288 | + } |
|
277 | 289 | return $str; |
278 | 290 | } |
279 | 291 | |
@@ -298,8 +310,9 @@ discard block |
||
298 | 310 | |
299 | 311 | $str="$({$element}).show({$speed}{$callback});"; |
300 | 312 | |
301 | - if ($immediatly) |
|
302 | - $this->jquery_code_for_compile[]=$str; |
|
313 | + if ($immediatly) { |
|
314 | + $this->jquery_code_for_compile[]=$str; |
|
315 | + } |
|
303 | 316 | return $str; |
304 | 317 | } |
305 | 318 | |
@@ -317,8 +330,9 @@ discard block |
||
317 | 330 | $str.="else{".$jsCodeIfFalse."}"; |
318 | 331 | } |
319 | 332 | |
320 | - if ($immediatly) |
|
321 | - $this->jquery_code_for_compile[]=$str; |
|
333 | + if ($immediatly) { |
|
334 | + $this->jquery_code_for_compile[]=$str; |
|
335 | + } |
|
322 | 336 | return $str; |
323 | 337 | } |
324 | 338 | |
@@ -335,11 +349,13 @@ discard block |
||
335 | 349 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
336 | 350 | $param=Javascript::prep_value($param); |
337 | 351 | $callback=""; |
338 | - if ($jsCallback!="") |
|
339 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
352 | + if ($jsCallback!="") { |
|
353 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
354 | + } |
|
340 | 355 | $script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
341 | - if ($immediatly) |
|
342 | - $this->jquery_code_for_compile[]=$script; |
|
356 | + if ($immediatly) { |
|
357 | + $this->jquery_code_for_compile[]=$script; |
|
358 | + } |
|
343 | 359 | return $script; |
344 | 360 | } |
345 | 361 | |
@@ -368,8 +384,9 @@ discard block |
||
368 | 384 | */ |
369 | 385 | public function _exec($js, $immediatly=false) { |
370 | 386 | $script=$js."\n"; |
371 | - if ($immediatly) |
|
372 | - $this->jquery_code_for_compile[]=$script; |
|
387 | + if ($immediatly) { |
|
388 | + $this->jquery_code_for_compile[]=$script; |
|
389 | + } |
|
373 | 390 | return $script; |
374 | 391 | } |
375 | 392 |
@@ -157,8 +157,9 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
159 | 159 | $result=$this->addInToolbar($caption,$callback); |
160 | - if(isset($icon)) |
|
161 | - $result->addIcon($icon); |
|
160 | + if(isset($icon)) { |
|
161 | + $result->addIcon($icon); |
|
162 | + } |
|
162 | 163 | return $result; |
163 | 164 | } |
164 | 165 | |
@@ -172,7 +173,7 @@ discard block |
||
172 | 173 | foreach ($items as $icon=>$item){ |
173 | 174 | $this->addItemInToolbar($item,$icon,$callback); |
174 | 175 | } |
175 | - }else{ |
|
176 | + } else{ |
|
176 | 177 | foreach ($items as $item){ |
177 | 178 | $this->addItemInToolbar($item,null,$callback); |
178 | 179 | } |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | foreach ( $this->events as $event => $jsCode ) { |
25 | 25 | if($event=="execute"){ |
26 | 26 | $this->jquery_code_for_compile []=$jsCode; |
27 | - }else if($event=="beforeExecute"){ |
|
27 | + } else if($event=="beforeExecute"){ |
|
28 | 28 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
29 | - }else{ |
|
29 | + } else{ |
|
30 | 30 | $selector=$this->attachTo; |
31 | 31 | if(isset($this->itemSelector)){ |
32 | 32 | $selector.=" ".$this->itemSelector; |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | protected function setParamCtrl($key, $value, $typeCtrl) { |
77 | 77 | if (\is_array($typeCtrl)) { |
78 | - if (array_search($value, $typeCtrl)===false) |
|
79 | - throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
78 | + if (array_search($value, $typeCtrl)===false) { |
|
79 | + throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
80 | + } |
|
80 | 81 | } else { |
81 | 82 | if (!$typeCtrl($value)) { |
82 | 83 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getParam($key) { |
41 | 41 | $value=null; |
42 | - if (array_key_exists($key, $this->params)) |
|
43 | - $value=$this->params [$key]; |
|
42 | + if (array_key_exists($key, $this->params)) { |
|
43 | + $value=$this->params [$key]; |
|
44 | + } |
|
44 | 45 | return $value; |
45 | 46 | } |
46 | 47 | |
@@ -49,16 +50,18 @@ discard block |
||
49 | 50 | } |
50 | 51 | |
51 | 52 | public function compile(JsUtils $js=NULL) { |
52 | - if ($js==NULL) |
|
53 | - $js=$this->js; |
|
53 | + if ($js==NULL) { |
|
54 | + $js=$this->js; |
|
55 | + } |
|
54 | 56 | $script=$this->getScript(); |
55 | 57 | $js->addToCompile($script); |
56 | 58 | } |
57 | 59 | |
58 | 60 | protected function setParamCtrl($key, $value, $typeCtrl) { |
59 | 61 | if (\is_array($typeCtrl)) { |
60 | - if (array_search($value, $typeCtrl)===false) |
|
61 | - throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
62 | + if (array_search($value, $typeCtrl)===false) { |
|
63 | + throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
64 | + } |
|
62 | 65 | } else { |
63 | 66 | if (!$typeCtrl($value)) { |
64 | 67 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key); |
@@ -70,9 +73,9 @@ discard block |
||
70 | 73 | public function setParams($params) { |
71 | 74 | foreach ( $params as $k => $v ) { |
72 | 75 | $method="set".ucfirst($k); |
73 | - if (method_exists($this, $method)) |
|
74 | - $this->$method($v); |
|
75 | - else { |
|
76 | + if (method_exists($this, $method)) { |
|
77 | + $this->$method($v); |
|
78 | + } else { |
|
76 | 79 | $this->setParam($k, $v); |
77 | 80 | trigger_error("`".$k."` property n'existe pas", E_USER_NOTICE); |
78 | 81 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | foreach ($items as $k=>$v){ |
23 | 23 | $this->addItem([$k,$v]); |
24 | 24 | } |
25 | - }else{ |
|
25 | + } else{ |
|
26 | 26 | foreach ($items as $item){ |
27 | 27 | $this->addItem($item); |
28 | 28 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @return \Ajax\common\html\HtmlDoubleElement |
71 | 71 | */ |
72 | 72 | public function getItem($index) { |
73 | - if (is_int($index)) |
|
74 | - return $this->content[$index]; |
|
75 | - else { |
|
73 | + if (is_int($index)) { |
|
74 | + return $this->content[$index]; |
|
75 | + } else { |
|
76 | 76 | $elm=$this->getElementById($index, $this->content); |
77 | 77 | return $elm; |
78 | 78 | } |
@@ -134,10 +134,11 @@ discard block |
||
134 | 134 | $i=0; |
135 | 135 | foreach ($properties as $k=>$v){ |
136 | 136 | $c=$this->content[$i++]; |
137 | - if(isset($c)) |
|
138 | - $c->setProperty($k,$v); |
|
139 | - else |
|
140 | - return $this; |
|
137 | + if(isset($c)) { |
|
138 | + $c->setProperty($k,$v); |
|
139 | + } else { |
|
140 | + return $this; |
|
141 | + } |
|
141 | 142 | } |
142 | 143 | return $this; |
143 | 144 | } |
@@ -151,8 +152,7 @@ discard block |
||
151 | 152 | $c=$this->content[$i++]; |
152 | 153 | if(isset($c)){ |
153 | 154 | $c->setProperty($property,$value); |
154 | - } |
|
155 | - else{ |
|
155 | + } else{ |
|
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | } |
@@ -12,18 +12,21 @@ |
||
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setValue($value); |
14 | 14 | $this->setPlaceholder($placeholder); |
15 | - if(isset($rows)) |
|
16 | - $this->setRows($rows); |
|
15 | + if(isset($rows)) { |
|
16 | + $this->setRows($rows); |
|
17 | + } |
|
17 | 18 | } |
18 | 19 | public function setValue($value) { |
19 | - if(isset($value)) |
|
20 | - $this->setContent($value); |
|
20 | + if(isset($value)) { |
|
21 | + $this->setContent($value); |
|
22 | + } |
|
21 | 23 | return $this; |
22 | 24 | } |
23 | 25 | |
24 | 26 | public function setPlaceholder($value){ |
25 | - if(JString::isNotNull($value)) |
|
26 | - $this->setProperty("placeholder", $value); |
|
27 | + if(JString::isNotNull($value)) { |
|
28 | + $this->setProperty("placeholder", $value); |
|
29 | + } |
|
27 | 30 | return $this; |
28 | 31 | } |
29 | 32 |
@@ -29,15 +29,17 @@ |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getProperty($name) { |
53 | - if (array_key_exists($name, $this->properties)) |
|
54 | - return $this->properties[$name]; |
|
53 | + if (array_key_exists($name, $this->properties)) { |
|
54 | + return $this->properties[$name]; |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
61 | 62 | } |
62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
63 | 64 | $v=@$this->properties[$name]; |
64 | - if (isset($v) && $v !== "") |
|
65 | - $v=$v . $separator . $value; |
|
66 | - else |
|
67 | - $v=$value; |
|
65 | + if (isset($v) && $v !== "") { |
|
66 | + $v=$v . $separator . $value; |
|
67 | + } else { |
|
68 | + $v=$value; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | return $this->setProperty($name, $v); |
70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
119 | 121 | } |
120 | 122 | |
121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
123 | - return $this->setProperty($name, $value); |
|
124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
125 | + return $this->setProperty($name, $value); |
|
126 | + } |
|
124 | 127 | return $this; |
125 | 128 | } |
126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
150 | 153 | } |
151 | 154 | |
152 | 155 | public function removeProperty($name) { |
153 | - if (\array_key_exists($name, $this->properties)) |
|
154 | - unset($this->properties[$name]); |
|
156 | + if (\array_key_exists($name, $this->properties)) { |
|
157 | + unset($this->properties[$name]); |
|
158 | + } |
|
155 | 159 | return $this; |
156 | 160 | } |
157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
171 | 175 | } |
172 | 176 | |
173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
174 | - if (@class_exists($typeCtrl, true)) |
|
175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
178 | + if (@class_exists($typeCtrl, true)) { |
|
179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
180 | + } |
|
176 | 181 | if (\is_array($typeCtrl)) { |
177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
178 | 183 | } |
@@ -213,8 +218,9 @@ discard block |
||
213 | 218 | |
214 | 219 | public function fromArray($array) { |
215 | 220 | foreach ( $this as $key => $value ) { |
216 | - if(array_key_exists($key, $array)===true) |
|
217 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
221 | + if(array_key_exists($key, $array)===true) { |
|
222 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
223 | + } |
|
218 | 224 | } |
219 | 225 | foreach ( $array as $key => $value ) { |
220 | 226 | if($this->_callSetter($key, $key, $value, $array)===false){ |
@@ -265,15 +271,18 @@ discard block |
||
265 | 271 | $flag=false; |
266 | 272 | $index=0; |
267 | 273 | while ( !$flag && $index < sizeof($elements) ) { |
268 | - if ($elements[$index] instanceof BaseHtml) |
|
269 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
274 | + if ($elements[$index] instanceof BaseHtml) { |
|
275 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
276 | + } |
|
270 | 277 | $index++; |
271 | 278 | } |
272 | - if ($flag === true) |
|
273 | - return $elements[$index - 1]; |
|
279 | + if ($flag === true) { |
|
280 | + return $elements[$index - 1]; |
|
281 | + } |
|
274 | 282 | } elseif ($elements instanceof BaseHtml) { |
275 | - if ($elements->getIdentifier() === $identifier) |
|
276 | - return $elements; |
|
283 | + if ($elements->getIdentifier() === $identifier) { |
|
284 | + return $elements; |
|
285 | + } |
|
277 | 286 | } |
278 | 287 | return null; |
279 | 288 | } |
@@ -283,15 +292,18 @@ discard block |
||
283 | 292 | $flag=false; |
284 | 293 | $index=0; |
285 | 294 | while ( !$flag && $index < sizeof($elements) ) { |
286 | - if ($elements[$index] instanceof BaseHtml) |
|
287 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
295 | + if ($elements[$index] instanceof BaseHtml) { |
|
296 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
297 | + } |
|
288 | 298 | $index++; |
289 | 299 | } |
290 | - if ($flag === true) |
|
291 | - return $elements[$index - 1]; |
|
300 | + if ($flag === true) { |
|
301 | + return $elements[$index - 1]; |
|
302 | + } |
|
292 | 303 | } elseif ($elements instanceof BaseHtml) { |
293 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
294 | - return $elements; |
|
304 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
305 | + return $elements; |
|
306 | + } |
|
295 | 307 | } |
296 | 308 | return null; |
297 | 309 | } |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | } |
47 | 47 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
48 | 48 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$jsCallback)."});\n"; |
49 | - if ($immediatly) |
|
50 | - $this->jquery_code_for_compile[]=$retour; |
|
49 | + if ($immediatly) { |
|
50 | + $this->jquery_code_for_compile[]=$retour; |
|
51 | + } |
|
51 | 52 | return $retour; |
52 | 53 | } |
53 | 54 | |
@@ -55,15 +56,17 @@ discard block |
||
55 | 56 | $url=$this->_correctAjaxUrl($url); |
56 | 57 | $retour="url='".$url."';\n"; |
57 | 58 | $slash="/"; |
58 | - if(JString::endswith($url, "/")===true) |
|
59 | - $slash=""; |
|
59 | + if(JString::endswith($url, "/")===true) { |
|
60 | + $slash=""; |
|
61 | + } |
|
60 | 62 | if(JString::isNotNull($attr)){ |
61 | - if ($attr==="value") |
|
62 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
63 | - elseif ($attr==="html") |
|
64 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
65 | - elseif($attr!=null && $attr!=="") |
|
66 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
63 | + if ($attr==="value") { |
|
64 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
65 | + } elseif ($attr==="html") { |
|
66 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
67 | + } elseif($attr!=null && $attr!=="") { |
|
68 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
69 | + } |
|
67 | 70 | } |
68 | 71 | return $retour; |
69 | 72 | } |
@@ -85,8 +88,9 @@ discard block |
||
85 | 88 | } |
86 | 89 | |
87 | 90 | protected function _correctAjaxUrl($url) { |
88 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
89 | - $url=substr($url, 0, strlen($url)-1); |
|
91 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
92 | + $url=substr($url, 0, strlen($url)-1); |
|
93 | + } |
|
90 | 94 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
91 | 95 | $url=$this->jsUtils->getUrl($url); |
92 | 96 | } |
@@ -110,8 +114,9 @@ discard block |
||
110 | 114 | $retour.="\t".$jsCallback."\n". |
111 | 115 | "\t$(document).trigger('jsonReady',[data]);\n". |
112 | 116 | "});\n"; |
113 | - if ($immediatly) |
|
114 | - $this->jquery_code_for_compile[]=$retour; |
|
117 | + if ($immediatly) { |
|
118 | + $this->jquery_code_for_compile[]=$retour; |
|
119 | + } |
|
115 | 120 | return $retour; |
116 | 121 | } |
117 | 122 | |
@@ -150,7 +155,7 @@ discard block |
||
150 | 155 | if($context===null){ |
151 | 156 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
152 | 157 | $newElm = "$('#'+newId)"; |
153 | - }else{ |
|
158 | + } else{ |
|
154 | 159 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
155 | 160 | $newElm = $context.".find('#'+newId)"; |
156 | 161 | } |
@@ -160,8 +165,9 @@ discard block |
||
160 | 165 | $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"; |
161 | 166 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
162 | 167 | $retour.="\t".$jsCallback."\n"."});\n"; |
163 | - if ($immediatly) |
|
164 | - $this->jquery_code_for_compile[]=$retour; |
|
168 | + if ($immediatly) { |
|
169 | + $this->jquery_code_for_compile[]=$retour; |
|
170 | + } |
|
165 | 171 | return $retour; |
166 | 172 | } |
167 | 173 | /** |
@@ -202,8 +208,9 @@ discard block |
||
202 | 208 | }});\n"; |
203 | 209 | $retour.="$('#".$form."').submit();\n"; |
204 | 210 | } |
205 | - if ($immediatly) |
|
206 | - $this->jquery_code_for_compile[]=$retour; |
|
211 | + if ($immediatly) { |
|
212 | + $this->jquery_code_for_compile[]=$retour; |
|
213 | + } |
|
207 | 214 | return $retour; |
208 | 215 | } |
209 | 216 |