Passed
Push — master ( 008e10...57c450 )
by Jean-Christophe
02:05
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -61,16 +61,19 @@  discard block
 block discarded – undo
61 61
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
62 62
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
63 63
 		}
64
-		if(\is_array($this->_deleteBehavior))
65
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
66
-		if(\is_array($this->_editBehavior))
67
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
64
+		if(\is_array($this->_deleteBehavior)) {
65
+					$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
66
+		}
67
+		if(\is_array($this->_editBehavior)) {
68
+					$this->_generateBehavior("edit",$this->_editBehavior,$js);
69
+		}
68 70
 		if(\is_array($this->_displayBehavior)){
69 71
 			$this->_generateBehavior("display",$this->_displayBehavior,$js);
70 72
 		}
71 73
 		parent::run($js);
72
-		if(isset($this->_pagination))
73
-			$this->_associatePaginationBehavior($js,$offset);
74
+		if(isset($this->_pagination)) {
75
+					$this->_associatePaginationBehavior($js,$offset);
76
+		}
74 77
 		$this->_associateSearchFieldBehavior($js,$offset);
75 78
 			
76 79
 	}
@@ -105,8 +108,9 @@  discard block
 block discarded – undo
105 108
 			$table->setRowCount(0, \sizeof($captions));
106 109
 			$this->_generateHeader($table,$captions);
107 110
 
108
-			if(isset($this->_compileParts))
109
-				$table->setCompileParts($this->_compileParts);
111
+			if(isset($this->_compileParts)) {
112
+							$table->setCompileParts($this->_compileParts);
113
+			}
110 114
 
111 115
 			$this->_generateContent($table);
112 116
 
@@ -136,8 +140,9 @@  discard block
 block discarded – undo
136 140
 	}
137 141
 
138 142
 	protected function _applyStyleAttributes($table){
139
-		if(isset($this->_hiddenColumns))
140
-			$this->_hideColumns();
143
+		if(isset($this->_hiddenColumns)) {
144
+					$this->_hideColumns();
145
+		}
141 146
 			if(isset($this->_colWidths)){
142 147
 				foreach ($this->_colWidths as $colIndex=>$width){
143 148
 					$table->setColWidth($colIndex,$width);
@@ -173,7 +178,7 @@  discard block
 block discarded – undo
173 178
 				$table->fromDatabaseObjects($objects, function($instance) use($table,$fields){
174 179
 					return $this->_generateRow($instance, $fields,$table);
175 180
 				});
176
-			}else{
181
+			} else{
177 182
 				$activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null));
178 183
 				$uuids=[];
179 184
 				$table->fromDatabaseObjects($objects, function($instance) use($table,$fields,&$activeValues,$groupByFields,&$uuids){
@@ -235,8 +240,9 @@  discard block
 block discarded – undo
235 240
 			$field=$ck->getField();
236 241
 			$field->setProperty("value",$dataAjax);
237 242
 			$field->setProperty("name", "selection[]");
238
-			if(isset($checkedClass))
239
-				$field->setClass($checkedClass);
243
+			if(isset($checkedClass)) {
244
+							$field->setClass($checkedClass);
245
+			}
240 246
 			\array_unshift($values, $ck);
241 247
 		}
242 248
 		$result=$table->newRow();
@@ -253,8 +259,9 @@  discard block
 block discarded – undo
253 259
 
254 260
 	protected function _generatePagination($table){
255 261
 		if(isset($this->_toolbar)){
256
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
257
-				$this->_toolbar->setFloated("left");
262
+			if($this->_toolbarPosition==PositionInTable::FOOTER) {
263
+							$this->_toolbar->setFloated("left");
264
+			}
258 265
 		}
259 266
 		$footer=$table->getFooter();
260 267
 		$footer->mergeCol();
@@ -286,8 +293,9 @@  discard block
 block discarded – undo
286 293
 
287 294
 	protected function _getFieldName($index){
288 295
 		$fieldName=parent::_getFieldName($index);
289
-		if(\is_object($fieldName))
290
-			$fieldName="field-".$index;
296
+		if(\is_object($fieldName)) {
297
+					$fieldName="field-".$index;
298
+		}
291 299
 		return $fieldName."[]";
292 300
 	}
293 301
 
@@ -327,7 +335,7 @@  discard block
 block discarded – undo
327 335
 		$hasPart=$table->hasPart($part);
328 336
 		if($hasPart){
329 337
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
330
-		}else{
338
+		} else{
331 339
 			$row=$table->getPart($part)->getRow(0);
332 340
 		}
333 341
 		$row->mergeCol();
@@ -359,7 +367,7 @@  discard block
 block discarded – undo
359 367
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
360 368
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
361 369
 			$this->_urls["display"]=JArray::getValue($urls, "display",3);
362
-		}else{
370
+		} else{
363 371
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls];
364 372
 		}
365 373
 		return $this;
@@ -442,8 +450,9 @@  discard block
 block discarded – undo
442 450
 
443 451
 	protected function getTargetSelector($op) {
444 452
 		$result=$this->_targetSelector;
445
-		if(!isset($result[$op]))
446
-			$result="#".$this->identifier;
453
+		if(!isset($result[$op])) {
454
+					$result="#".$this->identifier;
455
+		}
447 456
 		return $result[$op];
448 457
 	}
449 458
 
@@ -461,8 +470,9 @@  discard block
 block discarded – undo
461 470
 	}
462 471
 
463 472
 	public function getRefreshSelector() {
464
-		if(isset($this->_refreshSelector))
465
-			return $this->_refreshSelector;
473
+		if(isset($this->_refreshSelector)) {
474
+					return $this->_refreshSelector;
475
+		}
466 476
 		return "#".$this->identifier." tbody";
467 477
 	}
468 478
 
@@ -481,8 +491,9 @@  discard block
 block discarded – undo
481 491
 	 */
482 492
 	public function show($modelInstance){
483 493
 		if(\is_array($modelInstance)){
484
-			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
485
-				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
494
+			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
495
+							$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
496
+			}
486 497
 		}
487 498
 		$this->_modelInstance=$modelInstance;
488 499
 	}
@@ -522,8 +533,9 @@  discard block
 block discarded – undo
522 533
 	}
523 534
 
524 535
 	public function hideColumn($colIndex){
525
-		if(!\is_array($this->_hiddenColumns))
526
-			$this->_hiddenColumns=[];
536
+		if(!\is_array($this->_hiddenColumns)) {
537
+					$this->_hiddenColumns=[];
538
+		}
527 539
 		$this->_hiddenColumns[]=$colIndex;
528 540
 		return $this;
529 541
 	}
Please login to merge, or discard this patch.