Completed
Push — master ( baf19c...6831db )
by Jean-Christophe
03:30
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -50,10 +50,12 @@  discard block
 block discarded – undo
50 50
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
51 51
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
52 52
 		}
53
-		if($this->_hasDelete)
54
-			$this->_generateBehavior("delete", $js);
55
-		if($this->_hasEdit)
56
-			$this->_generateBehavior("edit", $js);
53
+		if($this->_hasDelete) {
54
+					$this->_generateBehavior("delete", $js);
55
+		}
56
+		if($this->_hasEdit) {
57
+					$this->_generateBehavior("edit", $js);
58
+		}
57 59
 		return parent::run($js);
58 60
 	}
59 61
 
@@ -76,8 +78,9 @@  discard block
 block discarded – undo
76 78
 	}
77 79
 
78 80
 	protected function _generateBehavior($op,JsUtils $js){
79
-		if(isset($this->_urls[$op]))
80
-			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
81
+		if(isset($this->_urls[$op])) {
82
+					$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
83
+		}
81 84
 	}
82 85
 
83 86
 	/**
@@ -102,12 +105,14 @@  discard block
 block discarded – undo
102 105
 
103 106
 			$table->setRowCount(0, \sizeof($captions));
104 107
 			$table->setHeaderValues($captions);
105
-			if(isset($this->_compileParts))
106
-				$table->setCompileParts($this->_compileParts);
108
+			if(isset($this->_compileParts)) {
109
+							$table->setCompileParts($this->_compileParts);
110
+			}
107 111
 
108 112
 			if(isset($this->_searchField) && isset($js)){
109
-				if(isset($this->_urls["refresh"]))
110
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
113
+				if(isset($this->_urls["refresh"])) {
114
+									$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
115
+				}
111 116
 			}
112 117
 
113 118
 			$this->_generateContent($table);
@@ -132,8 +137,9 @@  discard block
 block discarded – undo
132 137
 	private function _generateMainCheckbox(&$captions){
133 138
 		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
134 139
 		$checkedMessageCall="";
135
-		if($this->_hasCheckedMessage)
136
-			$checkedMessageCall="updateChecked();";
140
+		if($this->_hasCheckedMessage) {
141
+					$checkedMessageCall="updateChecked();";
142
+		}
137 143
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall);
138 144
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall);
139 145
 		\array_unshift($captions, $ck);
@@ -170,8 +176,9 @@  discard block
 block discarded – undo
170 176
 		$menu->floatRight();
171 177
 		$menu->setActiveItem($this->_pagination->getPage()-1);
172 178
 		$footer->setValues($menu);
173
-		if(isset($this->_urls["refresh"]))
174
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
179
+		if(isset($this->_urls["refresh"])) {
180
+					$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
181
+		}
175 182
 	}
176 183
 
177 184
 	protected function _getFieldName($index){
@@ -214,7 +221,7 @@  discard block
 block discarded – undo
214 221
 		$hasPart=$table->hasPart($part);
215 222
 		if($hasPart){
216 223
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
217
-		}else{
224
+		} else{
218 225
 			$row=$table->getPart($part)->getRow(0);
219 226
 		}
220 227
 		$row->mergeCol();
@@ -239,7 +246,7 @@  discard block
 block discarded – undo
239 246
 			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
240 247
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
241 248
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
242
-		}else{
249
+		} else{
243 250
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
244 251
 		}
245 252
 		return $this;
@@ -295,8 +302,9 @@  discard block
 block discarded – undo
295 302
 
296 303
 	protected function getTargetSelector() {
297 304
 		$result=$this->_targetSelector;
298
-		if(!isset($result))
299
-			$result="#".$this->identifier;
305
+		if(!isset($result)) {
306
+					$result="#".$this->identifier;
307
+		}
300 308
 		return $result;
301 309
 	}
302 310
 
@@ -334,8 +342,9 @@  discard block
 block discarded – undo
334 342
 	 * @param callable $callback
335 343
 	 */
336 344
 	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
337
-		if(isset($checkedMessage))
338
-			$this->_checkedMessage=$checkedMessage;
345
+		if(isset($checkedMessage)) {
346
+					$this->_checkedMessage=$checkedMessage;
347
+		}
339 348
 		$checkedMessage=$this->getCheckedMessage();
340 349
 		$this->_hasCheckboxes=true;
341 350
 		$this->_hasCheckedMessage=true;
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	private function getFieldButton($caption,$visibleHover=true){
59 59
 		$bt= new HtmlButton("",$caption);
60
-		if($visibleHover)
61
-			$this->_visibleOver($bt);
60
+		if($visibleHover) {
61
+					$this->_visibleOver($bt);
62
+		}
62 63
 			return $bt;
63 64
 	}
64 65
 
@@ -75,8 +76,9 @@  discard block
 block discarded – undo
75 76
 		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
76 77
 			$button=new HtmlButton($id,$value,$cssStyle);
77 78
 			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
78
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
79
-				$this->_visibleOver($button);
79
+			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) {
80
+							$this->_visibleOver($button);
81
+			}
80 82
 				return $button;
81 83
 		}, $index,$attributes);
82 84
 	}
@@ -135,8 +137,9 @@  discard block
 block discarded – undo
135 137
 	private function getDefaultButton($icon,$class=null,$visibleHover=true){
136 138
 		$bt=$this->getFieldButton("",$visibleHover);
137 139
 		$bt->asIcon($icon);
138
-		if(isset($class))
139
-			$bt->addClass($class);
140
+		if(isset($class)) {
141
+					$bt->addClass($class);
142
+		}
140 143
 			return $bt;
141 144
 	}
142 145
 
Please login to merge, or discard this patch.