Completed
Push — master ( 0b3773...ca057c )
by Jean-Christophe
03:07
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -51,10 +51,12 @@  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
 
@@ -77,8 +79,9 @@  discard block
 block discarded – undo
77 79
 	}
78 80
 
79 81
 	protected function _generateBehavior($op,JsUtils $js){
80
-		if(isset($this->_urls[$op]))
81
-			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
82
+		if(isset($this->_urls[$op])) {
83
+					$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
84
+		}
82 85
 	}
83 86
 
84 87
 	/**
@@ -103,12 +106,14 @@  discard block
 block discarded – undo
103 106
 
104 107
 			$table->setRowCount(0, \sizeof($captions));
105 108
 			$table->setHeaderValues($captions);
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
 			if(isset($this->_searchField) && isset($js)){
110
-				if(isset($this->_urls["refresh"]))
111
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
114
+				if(isset($this->_urls["refresh"])) {
115
+									$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
116
+				}
112 117
 			}
113 118
 
114 119
 			$this->_generateContent($table);
@@ -133,8 +138,9 @@  discard block
 block discarded – undo
133 138
 	private function _generateMainCheckbox(&$captions){
134 139
 		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
135 140
 		$checkedMessageCall="";
136
-		if($this->_hasCheckedMessage)
137
-			$checkedMessageCall="updateChecked();";
141
+		if($this->_hasCheckedMessage) {
142
+					$checkedMessageCall="updateChecked();";
143
+		}
138 144
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall);
139 145
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall);
140 146
 		\array_unshift($captions, $ck);
@@ -171,8 +177,9 @@  discard block
 block discarded – undo
171 177
 		$menu->floatRight();
172 178
 		$menu->setActiveItem($this->_pagination->getPage()-1);
173 179
 		$footer->setValues($menu);
174
-		if(isset($this->_urls["refresh"]))
175
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
180
+		if(isset($this->_urls["refresh"])) {
181
+					$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
182
+		}
176 183
 	}
177 184
 
178 185
 	protected function _getFieldName($index){
@@ -215,7 +222,7 @@  discard block
 block discarded – undo
215 222
 		$hasPart=$table->hasPart($part);
216 223
 		if($hasPart){
217 224
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
218
-		}else{
225
+		} else{
219 226
 			$row=$table->getPart($part)->getRow(0);
220 227
 		}
221 228
 		$row->mergeCol();
@@ -240,7 +247,7 @@  discard block
 block discarded – undo
240 247
 			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
241 248
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
242 249
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
243
-		}else{
250
+		} else{
244 251
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
245 252
 		}
246 253
 		return $this;
@@ -305,8 +312,9 @@  discard block
 block discarded – undo
305 312
 	 */
306 313
 	private function getFieldButton($caption,$visibleHover=true){
307 314
 		$bt= new HtmlButton("",$caption);
308
-		if($visibleHover)
309
-			$this->_visibleOver($bt);
315
+		if($visibleHover) {
316
+					$this->_visibleOver($bt);
317
+		}
310 318
 		return $bt;
311 319
 	}
312 320
 
@@ -359,8 +367,9 @@  discard block
 block discarded – undo
359 367
 	private function getDefaultButton($icon,$class=null,$visibleHover=true){
360 368
 		$bt=$this->getFieldButton("",$visibleHover);
361 369
 		$bt->asIcon($icon);
362
-		if(isset($class))
363
-			$bt->addToProperty("class", $class);
370
+		if(isset($class)) {
371
+					$bt->addToProperty("class", $class);
372
+		}
364 373
 		return $bt;
365 374
 	}
366 375
 
@@ -431,8 +440,9 @@  discard block
 block discarded – undo
431 440
 		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
432 441
 			$button=new HtmlButton($id,$value,$cssStyle);
433 442
 			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
434
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
435
-				$this->_visibleOver($button);
443
+			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) {
444
+							$this->_visibleOver($button);
445
+			}
436 446
 			return $button;
437 447
 		}, $index,$attributes);
438 448
 	}
@@ -444,8 +454,9 @@  discard block
 block discarded – undo
444 454
 
445 455
 	protected function getTargetSelector() {
446 456
 		$result=$this->_targetSelector;
447
-		if(!isset($result))
448
-			$result="#".$this->identifier;
457
+		if(!isset($result)) {
458
+					$result="#".$this->identifier;
459
+		}
449 460
 		return $result;
450 461
 	}
451 462
 
@@ -483,8 +494,9 @@  discard block
 block discarded – undo
483 494
 	 * @param callable $callback
484 495
 	 */
485 496
 	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
486
-		if(isset($checkedMessage))
487
-			$this->_checkedMessage=$checkedMessage;
497
+		if(isset($checkedMessage)) {
498
+					$this->_checkedMessage=$checkedMessage;
499
+		}
488 500
 		$checkedMessage=$this->getCheckedMessage();
489 501
 		$this->_hasCheckboxes=true;
490 502
 		$this->_hasCheckedMessage=true;
Please login to merge, or discard this patch.