@@ -23,8 +23,9 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function getTabItem($index) { |
| 26 | - if ($index<sizeof($this->content)) |
|
| 27 | - return $this->content [$index]; |
|
| 26 | + if ($index<sizeof($this->content)) { |
|
| 27 | + return $this->content [$index]; |
|
| 28 | + } |
|
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | public function getTabItems() { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $result=null; |
| 44 | 44 | if($index<sizeof($this->cols)+1){ |
| 45 | 45 | $result=$this->cols[$index-1]; |
| 46 | - }else if ($force){ |
|
| 46 | + } else if ($force){ |
|
| 47 | 47 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
| 48 | 48 | } |
| 49 | 49 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->cols = array_values($this->cols); |
| 97 | 97 | $width=$width-$widthCol; |
| 98 | 98 | } |
| 99 | - }else{ |
|
| 99 | + } else{ |
|
| 100 | 100 | $width=0; |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -69,7 +69,8 @@ |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function getPanel($index) { |
| 72 | - if ($index<sizeof($this->content)) |
|
| 73 | - return $this->content [$index]; |
|
| 72 | + if ($index<sizeof($this->content)) { |
|
| 73 | + return $this->content [$index]; |
|
| 74 | + } |
|
| 74 | 75 | } |
| 75 | 76 | } |
| 76 | 77 | \ No newline at end of file |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 43 | 43 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
| 44 | - if ($immediatly) |
|
| 45 | - $this->jquery_code_for_compile[]=$retour; |
|
| 44 | + if ($immediatly) { |
|
| 45 | + $this->jquery_code_for_compile[]=$retour; |
|
| 46 | + } |
|
| 46 | 47 | return $retour; |
| 47 | 48 | } |
| 48 | 49 | |
@@ -50,13 +51,15 @@ discard block |
||
| 50 | 51 | $url=$this->_correctAjaxUrl($url); |
| 51 | 52 | $retour="url='".$url."';\n"; |
| 52 | 53 | $slash="/"; |
| 53 | - if(JString::endswith($url, "/")===true) |
|
| 54 | - $slash=""; |
|
| 54 | + if(JString::endswith($url, "/")===true) { |
|
| 55 | + $slash=""; |
|
| 56 | + } |
|
| 55 | 57 | if(JString::isNotNull($attr)){ |
| 56 | - if ($attr=="value") |
|
| 57 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 58 | - else if($attr!=null && $attr!=="") |
|
| 59 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 58 | + if ($attr=="value") { |
|
| 59 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 60 | + } else if($attr!=null && $attr!=="") { |
|
| 61 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 62 | + } |
|
| 60 | 63 | } |
| 61 | 64 | return $retour; |
| 62 | 65 | } |
@@ -78,8 +81,9 @@ discard block |
||
| 78 | 81 | } |
| 79 | 82 | |
| 80 | 83 | protected function _correctAjaxUrl($url) { |
| 81 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
| 82 | - $url=substr($url, 0, strlen($url)-1); |
|
| 84 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
| 85 | + $url=substr($url, 0, strlen($url)-1); |
|
| 86 | + } |
|
| 83 | 87 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 84 | 88 | $url=$this->jsUtils->getUrl($url); |
| 85 | 89 | } |
@@ -103,8 +107,9 @@ discard block |
||
| 103 | 107 | $retour.="\t".$jsCallback."\n". |
| 104 | 108 | "\t$(document).trigger('jsonReady',[data]);\n". |
| 105 | 109 | "});\n"; |
| 106 | - if ($immediatly) |
|
| 107 | - $this->jquery_code_for_compile[]=$retour; |
|
| 110 | + if ($immediatly) { |
|
| 111 | + $this->jquery_code_for_compile[]=$retour; |
|
| 112 | + } |
|
| 108 | 113 | return $retour; |
| 109 | 114 | } |
| 110 | 115 | |
@@ -143,7 +148,7 @@ discard block |
||
| 143 | 148 | if($context===null){ |
| 144 | 149 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 145 | 150 | $newElm = "$('#'+newId)"; |
| 146 | - }else{ |
|
| 151 | + } else{ |
|
| 147 | 152 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 148 | 153 | $newElm = $context.".find('#'+newId)"; |
| 149 | 154 | } |
@@ -153,8 +158,9 @@ discard block |
||
| 153 | 158 | $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"; |
| 154 | 159 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 155 | 160 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 156 | - if ($immediatly) |
|
| 157 | - $this->jquery_code_for_compile[]=$retour; |
|
| 161 | + if ($immediatly) { |
|
| 162 | + $this->jquery_code_for_compile[]=$retour; |
|
| 163 | + } |
|
| 158 | 164 | return $retour; |
| 159 | 165 | } |
| 160 | 166 | /** |
@@ -195,8 +201,9 @@ discard block |
||
| 195 | 201 | }});\n"; |
| 196 | 202 | $retour.="$('#".$form."').submit();\n"; |
| 197 | 203 | } |
| 198 | - if ($immediatly) |
|
| 199 | - $this->jquery_code_for_compile[]=$retour; |
|
| 204 | + if ($immediatly) { |
|
| 205 | + $this->jquery_code_for_compile[]=$retour; |
|
| 206 | + } |
|
| 200 | 207 | return $retour; |
| 201 | 208 | } |
| 202 | 209 | |
@@ -19,10 +19,12 @@ discard block |
||
| 19 | 19 | if (isset($value)) { |
| 20 | 20 | $value=$this->_prep_value($value); |
| 21 | 21 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 22 | - } else |
|
| 23 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
| 24 | - if ($immediatly) |
|
| 25 | - $this->jquery_code_for_compile[]=$str; |
|
| 22 | + } else { |
|
| 23 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
| 24 | + } |
|
| 25 | + if ($immediatly) { |
|
| 26 | + $this->jquery_code_for_compile[]=$str; |
|
| 27 | + } |
|
| 26 | 28 | return $str; |
| 27 | 29 | } |
| 28 | 30 | |
@@ -37,8 +39,9 @@ discard block |
||
| 37 | 39 | $element=$this->_prep_element($element); |
| 38 | 40 | $value=$this->_prep_value($value); |
| 39 | 41 | $str="$({$element}).after({$value});"; |
| 40 | - if ($immediatly) |
|
| 41 | - $this->jquery_code_for_compile[]=$str; |
|
| 42 | + if ($immediatly) { |
|
| 43 | + $this->jquery_code_for_compile[]=$str; |
|
| 44 | + } |
|
| 42 | 45 | return $str; |
| 43 | 46 | } |
| 44 | 47 | |
@@ -74,8 +77,9 @@ discard block |
||
| 74 | 77 | |
| 75 | 78 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
| 76 | 79 | |
| 77 | - if ($immediatly) |
|
| 78 | - $this->jquery_code_for_compile[]=$str; |
|
| 80 | + if ($immediatly) { |
|
| 81 | + $this->jquery_code_for_compile[]=$str; |
|
| 82 | + } |
|
| 79 | 83 | return $str; |
| 80 | 84 | } |
| 81 | 85 | |
@@ -100,8 +104,9 @@ discard block |
||
| 100 | 104 | |
| 101 | 105 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
| 102 | 106 | |
| 103 | - if ($immediatly) |
|
| 104 | - $this->jquery_code_for_compile[]=$str; |
|
| 107 | + if ($immediatly) { |
|
| 108 | + $this->jquery_code_for_compile[]=$str; |
|
| 109 | + } |
|
| 105 | 110 | return $str; |
| 106 | 111 | } |
| 107 | 112 | |
@@ -126,8 +131,9 @@ discard block |
||
| 126 | 131 | |
| 127 | 132 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
| 128 | 133 | |
| 129 | - if ($immediatly) |
|
| 130 | - $this->jquery_code_for_compile[]=$str; |
|
| 134 | + if ($immediatly) { |
|
| 135 | + $this->jquery_code_for_compile[]=$str; |
|
| 136 | + } |
|
| 131 | 137 | return $str; |
| 132 | 138 | } |
| 133 | 139 | |
@@ -152,8 +158,9 @@ discard block |
||
| 152 | 158 | |
| 153 | 159 | $str="$({$element}).hide({$speed}{$callback});"; |
| 154 | 160 | |
| 155 | - if ($immediatly) |
|
| 156 | - $this->jquery_code_for_compile[]=$str; |
|
| 161 | + if ($immediatly) { |
|
| 162 | + $this->jquery_code_for_compile[]=$str; |
|
| 163 | + } |
|
| 157 | 164 | return $str; |
| 158 | 165 | } |
| 159 | 166 | |
@@ -180,8 +187,9 @@ discard block |
||
| 180 | 187 | |
| 181 | 188 | $str="$({$element}).slideUp({$speed}{$callback});"; |
| 182 | 189 | |
| 183 | - if ($immediatly) |
|
| 184 | - $this->jquery_code_for_compile[]=$str; |
|
| 190 | + if ($immediatly) { |
|
| 191 | + $this->jquery_code_for_compile[]=$str; |
|
| 192 | + } |
|
| 185 | 193 | return $str; |
| 186 | 194 | } |
| 187 | 195 | |
@@ -206,8 +214,9 @@ discard block |
||
| 206 | 214 | |
| 207 | 215 | $str="$({$element}).slideDown({$speed}{$callback});"; |
| 208 | 216 | |
| 209 | - if ($immediatly) |
|
| 210 | - $this->jquery_code_for_compile[]=$str; |
|
| 217 | + if ($immediatly) { |
|
| 218 | + $this->jquery_code_for_compile[]=$str; |
|
| 219 | + } |
|
| 211 | 220 | return $str; |
| 212 | 221 | } |
| 213 | 222 | |
@@ -232,8 +241,9 @@ discard block |
||
| 232 | 241 | |
| 233 | 242 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
| 234 | 243 | |
| 235 | - if ($immediatly) |
|
| 236 | - $this->jquery_code_for_compile[]=$str; |
|
| 244 | + if ($immediatly) { |
|
| 245 | + $this->jquery_code_for_compile[]=$str; |
|
| 246 | + } |
|
| 237 | 247 | return $str; |
| 238 | 248 | } |
| 239 | 249 | |
@@ -250,8 +260,9 @@ discard block |
||
| 250 | 260 | $element=$this->_prep_element($element); |
| 251 | 261 | $str="$({$element}).toggle();"; |
| 252 | 262 | |
| 253 | - if ($immediatly) |
|
| 254 | - $this->jquery_code_for_compile[]=$str; |
|
| 263 | + if ($immediatly) { |
|
| 264 | + $this->jquery_code_for_compile[]=$str; |
|
| 265 | + } |
|
| 255 | 266 | return $str; |
| 256 | 267 | } |
| 257 | 268 | |
@@ -267,8 +278,9 @@ discard block |
||
| 267 | 278 | $element=$this->_prep_element($element); |
| 268 | 279 | $str="$({$element}).trigger(\"$event\");"; |
| 269 | 280 | |
| 270 | - if ($immediatly) |
|
| 271 | - $this->jquery_code_for_compile[]=$str; |
|
| 281 | + if ($immediatly) { |
|
| 282 | + $this->jquery_code_for_compile[]=$str; |
|
| 283 | + } |
|
| 272 | 284 | return $str; |
| 273 | 285 | } |
| 274 | 286 | |
@@ -293,8 +305,9 @@ discard block |
||
| 293 | 305 | |
| 294 | 306 | $str="$({$element}).show({$speed}{$callback});"; |
| 295 | 307 | |
| 296 | - if ($immediatly) |
|
| 297 | - $this->jquery_code_for_compile[]=$str; |
|
| 308 | + if ($immediatly) { |
|
| 309 | + $this->jquery_code_for_compile[]=$str; |
|
| 310 | + } |
|
| 298 | 311 | return $str; |
| 299 | 312 | } |
| 300 | 313 | |
@@ -312,8 +325,9 @@ discard block |
||
| 312 | 325 | $str.="else{".$jsCodeIfFalse."}"; |
| 313 | 326 | } |
| 314 | 327 | |
| 315 | - if ($immediatly) |
|
| 316 | - $this->jquery_code_for_compile[]=$str; |
|
| 328 | + if ($immediatly) { |
|
| 329 | + $this->jquery_code_for_compile[]=$str; |
|
| 330 | + } |
|
| 317 | 331 | return $str; |
| 318 | 332 | } |
| 319 | 333 | |
@@ -330,11 +344,13 @@ discard block |
||
| 330 | 344 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
| 331 | 345 | $param=$this->_prep_value($param); |
| 332 | 346 | $callback=""; |
| 333 | - if ($jsCallback!="") |
|
| 334 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 347 | + if ($jsCallback!="") { |
|
| 348 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 349 | + } |
|
| 335 | 350 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
| 336 | - if ($immediatly) |
|
| 337 | - $this->jquery_code_for_compile[]=$script; |
|
| 351 | + if ($immediatly) { |
|
| 352 | + $this->jquery_code_for_compile[]=$script; |
|
| 353 | + } |
|
| 338 | 354 | return $script; |
| 339 | 355 | } |
| 340 | 356 | |
@@ -363,8 +379,9 @@ discard block |
||
| 363 | 379 | */ |
| 364 | 380 | public function _exec($js, $immediatly=false) { |
| 365 | 381 | $script=$js."\n"; |
| 366 | - if ($immediatly) |
|
| 367 | - $this->jquery_code_for_compile[]=$script; |
|
| 382 | + if ($immediatly) { |
|
| 383 | + $this->jquery_code_for_compile[]=$script; |
|
| 384 | + } |
|
| 368 | 385 | return $script; |
| 369 | 386 | } |
| 370 | 387 | |
@@ -23,10 +23,11 @@ discard block |
||
| 23 | 23 | foreach ( $this->events as $event => $jsCode ) { |
| 24 | 24 | if($event=="execute"){ |
| 25 | 25 | $this->jquery_code_for_compile []=$jsCode; |
| 26 | - }else if($event=="beforeExecute"){ |
|
| 26 | + } else if($event=="beforeExecute"){ |
|
| 27 | 27 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
| 28 | - }else |
|
| 29 | - $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
|
| 28 | + } else { |
|
| 29 | + $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
|
| 30 | + } |
|
| 30 | 31 | } |
| 31 | 32 | } |
| 32 | 33 | |
@@ -69,8 +70,9 @@ discard block |
||
| 69 | 70 | |
| 70 | 71 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 71 | 72 | if (is_array($typeCtrl)) { |
| 72 | - if (array_search($value, $typeCtrl)===false) |
|
| 73 | - 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)."}"); |
|
| 73 | + if (array_search($value, $typeCtrl)===false) { |
|
| 74 | + 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)."}"); |
|
| 75 | + } |
|
| 74 | 76 | } else { |
| 75 | 77 | if (!$typeCtrl($value)) { |
| 76 | 78 | 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 | } |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function compile($internal=false) { |
| 44 | - if ($internal===false&&$this->autoCompile===true) |
|
| 45 | - throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
| 44 | + if ($internal===false&&$this->autoCompile===true) { |
|
| 45 | + throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
| 46 | + } |
|
| 46 | 47 | foreach ( $this->components as $component ) { |
| 47 | 48 | $component->compile(); |
| 48 | 49 | } |
@@ -53,13 +54,16 @@ discard block |
||
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | public function addComponent(SimpleComponent $component, $attachTo, $params) { |
| 56 | - if ($this->autoCompile) |
|
| 57 | - $this->components []=$component; |
|
| 58 | - if (isset($attachTo)) |
|
| 59 | - $component->attach($attachTo); |
|
| 60 | - if (isset($params)) |
|
| 61 | - if (is_array($params)) |
|
| 57 | + if ($this->autoCompile) { |
|
| 58 | + $this->components []=$component; |
|
| 59 | + } |
|
| 60 | + if (isset($attachTo)) { |
|
| 61 | + $component->attach($attachTo); |
|
| 62 | + } |
|
| 63 | + if (isset($params)) { |
|
| 64 | + if (is_array($params)) |
|
| 62 | 65 | $component->setParams($params); |
| 66 | + } |
|
| 63 | 67 | return $component; |
| 64 | 68 | } |
| 65 | 69 | |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function getConstantValues($postFix="",$prefixBefore=false) { |
| 27 | - if ($postFix == "") |
|
| 28 | - return \array_values(self::getConstants()); |
|
| 29 | - else { |
|
| 27 | + if ($postFix == "") { |
|
| 28 | + return \array_values(self::getConstants()); |
|
| 29 | + } else { |
|
| 30 | 30 | if($prefixBefore===false){ |
| 31 | 31 | return \array_map(function ($elem) use($postFix) { |
| 32 | 32 | return $elem . " " . $postFix; |
| 33 | 33 | }, \array_values(self::getConstants())); |
| 34 | - }else{ |
|
| 34 | + } else{ |
|
| 35 | 35 | return \array_map(function ($elem) use($postFix) { |
| 36 | 36 | return $postFix." ".$elem; |
| 37 | 37 | }, \array_values(self::getConstants())); |