Passed
Push — master ( 727fe8...731c7d )
by Jean-Christophe
02:56
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -59,16 +59,19 @@  discard block
 block discarded – undo
59 59
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
60 60
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
61 61
 		}
62
-		if(\is_array($this->_deleteBehavior))
63
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
64
-		if(\is_array($this->_editBehavior))
65
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
62
+		if(\is_array($this->_deleteBehavior)) {
63
+					$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
64
+		}
65
+		if(\is_array($this->_editBehavior)) {
66
+					$this->_generateBehavior("edit",$this->_editBehavior,$js);
67
+		}
66 68
 		if(\is_array($this->_displayBehavior)){
67 69
 			$this->_generateBehavior("display",$this->_displayBehavior,$js);
68 70
 		}
69 71
 		parent::run($js);
70
-		if(isset($this->_pagination))
71
-			$this->_associatePaginationBehavior($js,$offset);
72
+		if(isset($this->_pagination)) {
73
+					$this->_associatePaginationBehavior($js,$offset);
74
+		}
72 75
 		$this->_associateSearchFieldBehavior($js,$offset);
73 76
 			
74 77
 	}
@@ -103,8 +106,9 @@  discard block
 block discarded – undo
103 106
 			$table->setRowCount(0, \sizeof($captions));
104 107
 			$this->_generateHeader($table,$captions);
105 108
 
106
-			if(isset($this->_compileParts))
107
-				$table->setCompileParts($this->_compileParts);
109
+			if(isset($this->_compileParts)) {
110
+							$table->setCompileParts($this->_compileParts);
111
+			}
108 112
 
109 113
 			$this->_generateContent($table);
110 114
 
@@ -134,8 +138,9 @@  discard block
 block discarded – undo
134 138
 	}
135 139
 
136 140
 	protected function _applyStyleAttributes($table){
137
-		if(isset($this->_hiddenColumns))
138
-			$this->_hideColumns();
141
+		if(isset($this->_hiddenColumns)) {
142
+					$this->_hideColumns();
143
+		}
139 144
 			if(isset($this->_colWidths)){
140 145
 				foreach ($this->_colWidths as $colIndex=>$width){
141 146
 					$table->setColWidth($colIndex,$width);
@@ -195,8 +200,9 @@  discard block
 block discarded – undo
195 200
 			$field=$ck->getField();
196 201
 			$field->setProperty("value",$dataAjax);
197 202
 			$field->setProperty("name", "selection[]");
198
-			if(isset($checkedClass))
199
-				$field->setClass($checkedClass);
203
+			if(isset($checkedClass)) {
204
+							$field->setClass($checkedClass);
205
+			}
200 206
 			\array_unshift($values, $ck);
201 207
 		}
202 208
 		$result=$table->newRow();
@@ -210,8 +216,9 @@  discard block
 block discarded – undo
210 216
 
211 217
 	protected function _generatePagination($table){
212 218
 		if(isset($this->_toolbar)){
213
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
214
-				$this->_toolbar->setFloated("left");
219
+			if($this->_toolbarPosition==PositionInTable::FOOTER) {
220
+							$this->_toolbar->setFloated("left");
221
+			}
215 222
 		}
216 223
 		$footer=$table->getFooter();
217 224
 		$footer->mergeCol();
@@ -235,8 +242,9 @@  discard block
 block discarded – undo
235 242
 
236 243
 	protected function _getFieldName($index){
237 244
 		$fieldName=parent::_getFieldName($index);
238
-		if(\is_object($fieldName))
239
-			$fieldName="field-".$index;
245
+		if(\is_object($fieldName)) {
246
+					$fieldName="field-".$index;
247
+		}
240 248
 		return $fieldName."[]";
241 249
 	}
242 250
 
@@ -276,7 +284,7 @@  discard block
 block discarded – undo
276 284
 		$hasPart=$table->hasPart($part);
277 285
 		if($hasPart){
278 286
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
279
-		}else{
287
+		} else{
280 288
 			$row=$table->getPart($part)->getRow(0);
281 289
 		}
282 290
 		$row->mergeCol();
@@ -308,7 +316,7 @@  discard block
 block discarded – undo
308 316
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
309 317
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
310 318
 			$this->_urls["display"]=JArray::getValue($urls, "display",3);
311
-		}else{
319
+		} else{
312 320
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls];
313 321
 		}
314 322
 		return $this;
@@ -391,8 +399,9 @@  discard block
 block discarded – undo
391 399
 
392 400
 	protected function getTargetSelector($op) {
393 401
 		$result=$this->_targetSelector;
394
-		if(!isset($result[$op]))
395
-			$result="#".$this->identifier;
402
+		if(!isset($result[$op])) {
403
+					$result="#".$this->identifier;
404
+		}
396 405
 		return $result[$op];
397 406
 	}
398 407
 
@@ -410,8 +419,9 @@  discard block
 block discarded – undo
410 419
 	}
411 420
 
412 421
 	public function getRefreshSelector() {
413
-		if(isset($this->_refreshSelector))
414
-			return $this->_refreshSelector;
422
+		if(isset($this->_refreshSelector)) {
423
+					return $this->_refreshSelector;
424
+		}
415 425
 		return "#".$this->identifier." tbody";
416 426
 	}
417 427
 
@@ -430,8 +440,9 @@  discard block
 block discarded – undo
430 440
 	 */
431 441
 	public function show($modelInstance){
432 442
 		if(\is_array($modelInstance)){
433
-			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
434
-				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
443
+			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
444
+							$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
445
+			}
435 446
 		}
436 447
 		$this->_modelInstance=$modelInstance;
437 448
 	}
@@ -471,8 +482,9 @@  discard block
 block discarded – undo
471 482
 	}
472 483
 
473 484
 	public function hideColumn($colIndex){
474
-		if(!\is_array($this->_hiddenColumns))
475
-			$this->_hiddenColumns=[];
485
+		if(!\is_array($this->_hiddenColumns)) {
486
+					$this->_hiddenColumns=[];
487
+		}
476 488
 		$this->_hiddenColumns[]=$colIndex;
477 489
 		return $this;
478 490
 	}
Please login to merge, or discard this patch.