Completed
Push — master ( 772d83...24138a )
by Jean-Christophe
10:15
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +32 added lines, -22 removed lines patch added patch discarded remove patch
@@ -51,16 +51,19 @@  discard block
 block discarded – undo
51 51
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
52 52
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
53 53
 		}
54
-		if($this->_hasDelete)
55
-			$this->_generateBehavior("delete", $js);
56
-		if($this->_hasEdit)
57
-			$this->_generateBehavior("edit", $js);
54
+		if($this->_hasDelete) {
55
+					$this->_generateBehavior("delete", $js);
56
+		}
57
+		if($this->_hasEdit) {
58
+					$this->_generateBehavior("edit", $js);
59
+		}
58 60
 		return parent::run($js);
59 61
 	}
60 62
 
61 63
 	protected function _generateBehavior($op,JsUtils $js){
62
-		if(isset($this->_urls[$op]))
63
-			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
64
+		if(isset($this->_urls[$op])) {
65
+					$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
66
+		}
64 67
 	}
65 68
 
66 69
 	/**
@@ -85,12 +88,14 @@  discard block
 block discarded – undo
85 88
 
86 89
 			$table->setRowCount(0, \sizeof($captions));
87 90
 			$table->setHeaderValues($captions);
88
-			if(isset($this->_compileParts))
89
-				$table->setCompileParts($this->_compileParts);
91
+			if(isset($this->_compileParts)) {
92
+							$table->setCompileParts($this->_compileParts);
93
+			}
90 94
 
91 95
 			if(isset($this->_searchField) && isset($js)){
92
-				if(isset($this->_urls["refresh"]))
93
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
96
+				if(isset($this->_urls["refresh"])) {
97
+									$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
98
+				}
94 99
 			}
95 100
 
96 101
 			$this->_generateContent($table);
@@ -150,8 +155,9 @@  discard block
 block discarded – undo
150 155
 		$menu->floatRight();
151 156
 		$menu->setActiveItem($this->_pagination->getPage()-1);
152 157
 		$footer->setValues($menu);
153
-		if(isset($this->_urls["refresh"]))
154
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
158
+		if(isset($this->_urls["refresh"])) {
159
+					$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
160
+		}
155 161
 	}
156 162
 
157 163
 	protected function _getFieldName($index){
@@ -194,7 +200,7 @@  discard block
 block discarded – undo
194 200
 		$hasPart=$table->hasPart($part);
195 201
 		if($hasPart){
196 202
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
197
-		}else{
203
+		} else{
198 204
 			$row=$table->getPart($part)->getRow(0);
199 205
 		}
200 206
 		$row->mergeCol();
@@ -219,7 +225,7 @@  discard block
 block discarded – undo
219 225
 			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
220 226
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
221 227
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
222
-		}else{
228
+		} else{
223 229
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
224 230
 		}
225 231
 		return $this;
@@ -284,8 +290,9 @@  discard block
 block discarded – undo
284 290
 	 */
285 291
 	private function getFieldButton($caption,$visibleHover=true){
286 292
 		$bt= new HtmlButton("",$caption);
287
-		if($visibleHover)
288
-			$this->_visibleOver($bt);
293
+		if($visibleHover) {
294
+					$this->_visibleOver($bt);
295
+		}
289 296
 		return $bt;
290 297
 	}
291 298
 
@@ -338,8 +345,9 @@  discard block
 block discarded – undo
338 345
 	private function getDefaultButton($icon,$class=null,$visibleHover=true){
339 346
 		$bt=$this->getFieldButton("",$visibleHover);
340 347
 		$bt->asIcon($icon);
341
-		if(isset($class))
342
-			$bt->addToProperty("class", $class);
348
+		if(isset($class)) {
349
+					$bt->addToProperty("class", $class);
350
+		}
343 351
 		return $bt;
344 352
 	}
345 353
 
@@ -410,8 +418,9 @@  discard block
 block discarded – undo
410 418
 		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
411 419
 			$button=new HtmlButton($id,$value,$cssStyle);
412 420
 			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
413
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
414
-				$this->_visibleOver($button);
421
+			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) {
422
+							$this->_visibleOver($button);
423
+			}
415 424
 			return $button;
416 425
 		}, $index,$attributes);
417 426
 	}
@@ -423,8 +432,9 @@  discard block
 block discarded – undo
423 432
 
424 433
 	protected function getTargetSelector() {
425 434
 		$result=$this->_targetSelector;
426
-		if(!isset($result))
427
-			$result="#".$this->identifier;
435
+		if(!isset($result)) {
436
+					$result="#".$this->identifier;
437
+		}
428 438
 		return $result;
429 439
 	}
430 440
 
Please login to merge, or discard this patch.