@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | $itemSelector=JString::getValueBetween($jsCode); |
| 28 | 28 | if($event=="execute"){ |
| 29 | 29 | $this->jquery_code_for_compile []=$jsCode; |
| 30 | - }else if($event=="beforeExecute"){ |
|
| 30 | + } else if($event=="beforeExecute"){ |
|
| 31 | 31 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
| 32 | - }else{ |
|
| 32 | + } else{ |
|
| 33 | 33 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
| 34 | 34 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
| 35 | 35 | } |
@@ -37,10 +37,12 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | protected function _createSelector($itemSelector,$selector){ |
| 40 | - if(!isset($itemSelector)) |
|
| 41 | - $itemSelector=$this->itemSelector; |
|
| 42 | - if(isset($itemSelector) && $itemSelector!=="") |
|
| 43 | - $selector.=" ".$itemSelector; |
|
| 40 | + if(!isset($itemSelector)) { |
|
| 41 | + $itemSelector=$this->itemSelector; |
|
| 42 | + } |
|
| 43 | + if(isset($itemSelector) && $itemSelector!=="") { |
|
| 44 | + $selector.=" ".$itemSelector; |
|
| 45 | + } |
|
| 44 | 46 | return $selector; |
| 45 | 47 | } |
| 46 | 48 | |
@@ -83,8 +85,9 @@ discard block |
||
| 83 | 85 | |
| 84 | 86 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 85 | 87 | if (\is_array($typeCtrl)) { |
| 86 | - if (array_search($value, $typeCtrl)===false) |
|
| 87 | - 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)."}"); |
|
| 88 | + if (array_search($value, $typeCtrl)===false) { |
|
| 89 | + 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)."}"); |
|
| 90 | + } |
|
| 88 | 91 | } else { |
| 89 | 92 | if (!$typeCtrl($value)) { |
| 90 | 93 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function compile(JsUtils $js=null) { |
| 17 | - if ($js==null) |
|
| 18 | - return; |
|
| 17 | + if ($js==null) { |
|
| 18 | + return; |
|
| 19 | + } |
|
| 19 | 20 | $params="{}"; |
| 20 | 21 | $jsCallback=NULL; |
| 21 | 22 | $attr="id"; |
@@ -45,8 +46,9 @@ discard block |
||
| 45 | 46 | $result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback); |
| 46 | 47 | break; |
| 47 | 48 | } |
| 48 | - if(isset($eventItemSelector)) |
|
| 49 | - $result="{{".$eventItemSelector."}}".$result; |
|
| 49 | + if(isset($eventItemSelector)) { |
|
| 50 | + $result="{{".$eventItemSelector."}}".$result; |
|
| 51 | + } |
|
| 50 | 52 | return $result; |
| 51 | 53 | } |
| 52 | 54 | |
@@ -55,10 +55,12 @@ discard block |
||
| 55 | 55 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 56 | 56 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 57 | 57 | } |
| 58 | - if(\is_array($this->_deleteBehavior)) |
|
| 59 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 60 | - if(\is_array($this->_editBehavior)) |
|
| 61 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 58 | + if(\is_array($this->_deleteBehavior)) { |
|
| 59 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 60 | + } |
|
| 61 | + if(\is_array($this->_editBehavior)) { |
|
| 62 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 63 | + } |
|
| 62 | 64 | return parent::run($js); |
| 63 | 65 | } |
| 64 | 66 | |
@@ -94,12 +96,14 @@ discard block |
||
| 94 | 96 | $table->setRowCount(0, \sizeof($captions)); |
| 95 | 97 | $this->_generateHeader($table,$captions); |
| 96 | 98 | |
| 97 | - if(isset($this->_compileParts)) |
|
| 98 | - $table->setCompileParts($this->_compileParts); |
|
| 99 | + if(isset($this->_compileParts)) { |
|
| 100 | + $table->setCompileParts($this->_compileParts); |
|
| 101 | + } |
|
| 99 | 102 | |
| 100 | 103 | if(isset($this->_searchField) && isset($js)){ |
| 101 | - if(isset($this->_urls["refresh"])) |
|
| 102 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 104 | + if(isset($this->_urls["refresh"])) { |
|
| 105 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 106 | + } |
|
| 103 | 107 | } |
| 104 | 108 | |
| 105 | 109 | $this->_generateContent($table); |
@@ -159,8 +163,9 @@ discard block |
||
| 159 | 163 | $field=$ck->getField(); |
| 160 | 164 | $field->setProperty("value",$id); |
| 161 | 165 | $field->setProperty("name", "selection[]"); |
| 162 | - if(isset($checkedClass)) |
|
| 163 | - $field->setClass($checkedClass); |
|
| 166 | + if(isset($checkedClass)) { |
|
| 167 | + $field->setClass($checkedClass); |
|
| 168 | + } |
|
| 164 | 169 | \array_unshift($values, $ck); |
| 165 | 170 | } |
| 166 | 171 | $result=$table->newRow(); |
@@ -173,8 +178,9 @@ discard block |
||
| 173 | 178 | |
| 174 | 179 | protected function _generatePagination($table,$js=NULL){ |
| 175 | 180 | if(isset($this->_toolbar)){ |
| 176 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
| 177 | - $this->_toolbar->setFloated("left"); |
|
| 181 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
| 182 | + $this->_toolbar->setFloated("left"); |
|
| 183 | + } |
|
| 178 | 184 | } |
| 179 | 185 | $footer=$table->getFooter(); |
| 180 | 186 | $footer->mergeCol(); |
@@ -231,7 +237,7 @@ discard block |
||
| 231 | 237 | $hasPart=$table->hasPart($part); |
| 232 | 238 | if($hasPart){ |
| 233 | 239 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 234 | - }else{ |
|
| 240 | + } else{ |
|
| 235 | 241 | $row=$table->getPart($part)->getRow(0); |
| 236 | 242 | } |
| 237 | 243 | $row->mergeCol(); |
@@ -256,7 +262,7 @@ discard block |
||
| 256 | 262 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
| 257 | 263 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
| 258 | 264 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
| 259 | - }else{ |
|
| 265 | + } else{ |
|
| 260 | 266 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
| 261 | 267 | } |
| 262 | 268 | return $this; |
@@ -330,8 +336,9 @@ discard block |
||
| 330 | 336 | |
| 331 | 337 | protected function getTargetSelector() { |
| 332 | 338 | $result=$this->_targetSelector; |
| 333 | - if(!isset($result)) |
|
| 334 | - $result="#".$this->identifier; |
|
| 339 | + if(!isset($result)) { |
|
| 340 | + $result="#".$this->identifier; |
|
| 341 | + } |
|
| 335 | 342 | return $result; |
| 336 | 343 | } |
| 337 | 344 | |
@@ -346,8 +353,9 @@ discard block |
||
| 346 | 353 | } |
| 347 | 354 | |
| 348 | 355 | public function getRefreshSelector() { |
| 349 | - if(isset($this->_refreshSelector)) |
|
| 350 | - return $this->_refreshSelector; |
|
| 356 | + if(isset($this->_refreshSelector)) { |
|
| 357 | + return $this->_refreshSelector; |
|
| 358 | + } |
|
| 351 | 359 | return "#".$this->identifier." tbody"; |
| 352 | 360 | } |
| 353 | 361 | |
@@ -362,8 +370,9 @@ discard block |
||
| 362 | 370 | */ |
| 363 | 371 | public function show($modelInstance){ |
| 364 | 372 | if(\is_array($modelInstance)){ |
| 365 | - if(\is_array(array_values($modelInstance)[0])) |
|
| 366 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
| 373 | + if(\is_array(array_values($modelInstance)[0])) { |
|
| 374 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
| 375 | + } |
|
| 367 | 376 | } |
| 368 | 377 | $this->_modelInstance=$modelInstance; |
| 369 | 378 | } |
@@ -271,8 +271,9 @@ discard block |
||
| 271 | 271 | $result= $this->getBody()->_addRow($result); |
| 272 | 272 | } |
| 273 | 273 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
| 274 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 275 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 274 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
| 275 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 276 | + } |
|
| 276 | 277 | } |
| 277 | 278 | return $result; |
| 278 | 279 | } |
@@ -293,8 +294,9 @@ discard block |
||
| 293 | 294 | |
| 294 | 295 | public function run(JsUtils $js){ |
| 295 | 296 | $result= parent::run($js); |
| 296 | - if(isset($this->_footer)) |
|
| 297 | - $this->_footer->run($js); |
|
| 297 | + if(isset($this->_footer)) { |
|
| 298 | + $this->_footer->run($js); |
|
| 299 | + } |
|
| 298 | 300 | return $result; |
| 299 | 301 | } |
| 300 | 302 | |