Completed
Push — master ( baf19c...6831db )
by Jean-Christophe
03:30
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  */
25 25
 class DataTable extends Widget {
26
-	use TableTrait,DataTableFieldAsTrait;
26
+	use TableTrait, DataTableFieldAsTrait;
27 27
 	protected $_searchField;
28 28
 	protected $_urls;
29 29
 	protected $_pagination;
@@ -36,30 +36,30 @@  discard block
 block discarded – undo
36 36
 	protected $_targetSelector;
37 37
 	protected $_checkedMessage;
38 38
 
39
-	public function __construct($identifier,$model,$modelInstance=NULL) {
40
-		parent::__construct($identifier, $model,$modelInstance);
41
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
39
+	public function __construct($identifier, $model, $modelInstance=NULL) {
40
+		parent::__construct($identifier, $model, $modelInstance);
41
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
42 42
 		$this->_urls=[];
43 43
 	}
44 44
 
45
-	public function run(JsUtils $js){
46
-		if($this->_hasCheckboxes && isset($js)){
45
+	public function run(JsUtils $js) {
46
+		if ($this->_hasCheckboxes && isset($js)) {
47 47
 			$this->_runCheckboxes($js);
48 48
 		}
49
-		if($this->_visibleHover){
50
-			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
51
-			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
49
+		if ($this->_visibleHover) {
50
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]);
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)
53
+		if ($this->_hasDelete)
54 54
 			$this->_generateBehavior("delete", $js);
55
-		if($this->_hasEdit)
55
+		if ($this->_hasEdit)
56 56
 			$this->_generateBehavior("edit", $js);
57 57
 		return parent::run($js);
58 58
 	}
59 59
 
60
-	protected function _runCheckboxes(JsUtils $js){
60
+	protected function _runCheckboxes(JsUtils $js) {
61 61
 		$checkedMessageCall="";
62
-		if($this->_hasCheckedMessage){
62
+		if ($this->_hasCheckedMessage) {
63 63
 			$msg=$this->getCheckedMessage();
64 64
 			$checkedMessageFunction="function updateChecked(){var msg='".$msg[0]."',count=\$('#{$this->identifier} [name=\"selection[]\"]:checked').length,all=\$('#{$this->identifier} [name=\"selection[]\"]').length;
65 65
 			if(count==1) msg='".$msg[1]."';
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 						\$('#checked-count-".$this->identifier."').contents().filter(function() {return this.nodeType == 3;}).each(function(){this.textContent = msg.replace('{count}',count);});
68 68
 								\$('#toolbar-{$this->identifier} .visibleOnChecked').toggle(count>0);}\$('#toolbar-".$this->identifier." .visibleOnChecked').hide();";
69 69
 			$checkedMessageCall="updateChecked();";
70
-			$js->exec($checkedMessageFunction,true);
70
+			$js->exec($checkedMessageFunction, true);
71 71
 		}
72 72
 		$js->execOn("change", "#".$this->identifier." [name='selection[]']", "
73 73
 				var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true;
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 				if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$checkedMessageCall);
76 76
 	}
77 77
 
78
-	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"]);
78
+	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 81
 	}
82 82
 
83 83
 	/**
@@ -89,70 +89,70 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 
92
-	public function compile(JsUtils $js=NULL,&$view=NULL){
93
-		if(!$this->_generated){
92
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
93
+		if (!$this->_generated) {
94 94
 			$this->_instanceViewer->setInstance($this->_model);
95 95
 			$captions=$this->_instanceViewer->getCaptions();
96 96
 
97 97
 			$table=$this->content["table"];
98 98
 
99
-			if($this->_hasCheckboxes){
99
+			if ($this->_hasCheckboxes) {
100 100
 				$this->_generateMainCheckbox($captions);
101 101
 			}
102 102
 
103 103
 			$table->setRowCount(0, \sizeof($captions));
104 104
 			$table->setHeaderValues($captions);
105
-			if(isset($this->_compileParts))
105
+			if (isset($this->_compileParts))
106 106
 				$table->setCompileParts($this->_compileParts);
107 107
 
108
-			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"]);
108
+			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"]);
111 111
 			}
112 112
 
113 113
 			$this->_generateContent($table);
114 114
 
115
-			if($this->_hasCheckboxes && $table->hasPart("thead")){
115
+			if ($this->_hasCheckboxes && $table->hasPart("thead")) {
116 116
 					$table->getHeader()->getCell(0, 0)->addClass("no-sort");
117 117
 			}
118 118
 
119
-			if(isset($this->_pagination) && $this->_pagination->getVisible()){
119
+			if (isset($this->_pagination) && $this->_pagination->getVisible()) {
120 120
 				$this->_generatePagination($table);
121 121
 			}
122
-			if(isset($this->_toolbar)){
122
+			if (isset($this->_toolbar)) {
123 123
 				$this->_setToolbarPosition($table, $captions);
124 124
 			}
125
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
125
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
126 126
 			$this->_compileForm();
127 127
 			$this->_generated=true;
128 128
 		}
129
-		return parent::compile($js,$view);
129
+		return parent::compile($js, $view);
130 130
 	}
131 131
 
132
-	private function _generateMainCheckbox(&$captions){
133
-		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
132
+	private function _generateMainCheckbox(&$captions) {
133
+		$ck=new HtmlCheckbox("main-ck-".$this->identifier, "");
134 134
 		$checkedMessageCall="";
135
-		if($this->_hasCheckedMessage)
135
+		if ($this->_hasCheckedMessage)
136 136
 			$checkedMessageCall="updateChecked();";
137 137
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall);
138 138
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall);
139 139
 		\array_unshift($captions, $ck);
140 140
 	}
141 141
 
142
-	protected function _generateContent($table){
142
+	protected function _generateContent($table) {
143 143
 		$objects=$this->_modelInstance;
144
-		if(isset($this->_pagination)){
144
+		if (isset($this->_pagination)) {
145 145
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
146 146
 		}
147 147
 		InstanceViewer::setIndex(0);
148 148
 		$table->fromDatabaseObjects($objects, function($instance) use($table){
149 149
 			$this->_instanceViewer->setInstance($instance);
150 150
 			InstanceViewer::$index++;
151
-			$values= $this->_instanceViewer->getValues();
152
-			if($this->_hasCheckboxes){
153
-				$ck=new HtmlCheckbox("ck-".$this->identifier,"");
151
+			$values=$this->_instanceViewer->getValues();
152
+			if ($this->_hasCheckboxes) {
153
+				$ck=new HtmlCheckbox("ck-".$this->identifier, "");
154 154
 				$field=$ck->getField();
155
-				$field->setProperty("value",$this->_instanceViewer->getIdentifier());
155
+				$field->setProperty("value", $this->_instanceViewer->getIdentifier());
156 156
 				$field->setProperty("name", "selection[]");
157 157
 				\array_unshift($values, $ck);
158 158
 			}
@@ -163,37 +163,37 @@  discard block
 block discarded – undo
163 163
 		});
164 164
 	}
165 165
 
166
-	private function _generatePagination($table){
166
+	private function _generatePagination($table) {
167 167
 		$footer=$table->getFooter();
168 168
 		$footer->mergeCol();
169
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
169
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
170 170
 		$menu->floatRight();
171 171
 		$menu->setActiveItem($this->_pagination->getPage()-1);
172 172
 		$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"]);
173
+		if (isset($this->_urls["refresh"]))
174
+			$menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
175 175
 	}
176 176
 
177
-	protected function _getFieldName($index){
177
+	protected function _getFieldName($index) {
178 178
 		return parent::_getFieldName($index)."[]";
179 179
 	}
180 180
 
181
-	protected function _getFieldCaption($index){
181
+	protected function _getFieldCaption($index) {
182 182
 		return null;
183 183
 	}
184 184
 
185
-	protected function _setToolbarPosition($table,$captions=NULL){
186
-		switch ($this->_toolbarPosition){
185
+	protected function _setToolbarPosition($table, $captions=NULL) {
186
+		switch ($this->_toolbarPosition) {
187 187
 			case PositionInTable::BEFORETABLE:
188 188
 			case PositionInTable::AFTERTABLE:
189
-				if(isset($this->_compileParts)===false){
189
+				if (isset($this->_compileParts)===false) {
190 190
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
191 191
 				}
192 192
 				break;
193 193
 			case PositionInTable::HEADER:
194 194
 			case PositionInTable::FOOTER:
195 195
 			case PositionInTable::BODY:
196
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
196
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
197 197
 				break;
198 198
 		}
199 199
 	}
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 	 * @param callable $callback function called after the field compilation
206 206
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
207 207
 	 */
208
-	public function afterCompile($index,$callback){
209
-		$this->_instanceViewer->afterCompile($index,$callback);
208
+	public function afterCompile($index, $callback) {
209
+		$this->_instanceViewer->afterCompile($index, $callback);
210 210
 		return $this;
211 211
 	}
212 212
 
213
-	private function addToolbarRow($part,$table,$captions){
213
+	private function addToolbarRow($part, $table, $captions) {
214 214
 		$hasPart=$table->hasPart($part);
215
-		if($hasPart){
215
+		if ($hasPart) {
216 216
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
217
-		}else{
217
+		} else {
218 218
 			$row=$table->getPart($part)->getRow(0);
219 219
 		}
220 220
 		$row->mergeCol();
221 221
 		$row->setValues([$this->_toolbar]);
222 222
 	}
223 223
 
224
-	public function getHtmlComponent(){
224
+	public function getHtmlComponent() {
225 225
 		return $this->content["table"];
226 226
 	}
227 227
 
@@ -235,18 +235,18 @@  discard block
 block discarded – undo
235 235
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
236 236
 	 */
237 237
 	public function setUrls($urls) {
238
-		if(\is_array($urls)){
239
-			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
240
-			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
241
-			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
242
-		}else{
243
-			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
238
+		if (\is_array($urls)) {
239
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
240
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
241
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
242
+		} else {
243
+			$this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls];
244 244
 		}
245 245
 		return $this;
246 246
 	}
247 247
 
248
-	public function paginate($items_per_page=10,$page=1){
249
-		$this->_pagination=new Pagination($items_per_page,4,$page);
248
+	public function paginate($items_per_page=10, $page=1) {
249
+		$this->_pagination=new Pagination($items_per_page, 4, $page);
250 250
 	}
251 251
 
252 252
 	public function getHasCheckboxes() {
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 		return $this;
259 259
 	}
260 260
 
261
-	public function refresh($compileParts=["tbody"]){
261
+	public function refresh($compileParts=["tbody"]) {
262 262
 		$this->_compileParts=$compileParts;
263 263
 		return $this;
264 264
 	}
265 265
 
266 266
 
267
-	public function addSearchInToolbar($position=Direction::RIGHT){
267
+	public function addSearchInToolbar($position=Direction::RIGHT) {
268 268
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
269 269
 	}
270 270
 
271
-	public function getSearchField(){
272
-		if(isset($this->_searchField)===false){
273
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
274
-			$this->_searchField->addIcon("search",Direction::RIGHT);
271
+	public function getSearchField() {
272
+		if (isset($this->_searchField)===false) {
273
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
274
+			$this->_searchField->addIcon("search", Direction::RIGHT);
275 275
 		}
276 276
 		return $this->_searchField;
277 277
 	}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		return $this;
288 288
 	}
289 289
 
290
-	public function asForm(){
290
+	public function asForm() {
291 291
 		return $this->getForm();
292 292
 	}
293 293
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 	protected function getTargetSelector() {
297 297
 		$result=$this->_targetSelector;
298
-		if(!isset($result))
298
+		if (!isset($result))
299 299
 			$result="#".$this->identifier;
300 300
 		return $result;
301 301
 	}
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	}
312 312
 
313 313
 	protected function getCheckedMessage() {
314
-		$result= $this->_checkedMessage;
315
-		if(!isset($result)){
316
-			$result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"];
314
+		$result=$this->_checkedMessage;
315
+		if (!isset($result)) {
316
+			$result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"];
317 317
 		}
318 318
 		return $result;
319 319
 	}
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 	 * @param array $checkedMessage
334 334
 	 * @param callable $callback
335 335
 	 */
336
-	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
337
-		if(isset($checkedMessage))
336
+	public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) {
337
+		if (isset($checkedMessage))
338 338
 			$this->_checkedMessage=$checkedMessage;
339 339
 		$checkedMessage=$this->getCheckedMessage();
340 340
 		$this->_hasCheckboxes=true;
341 341
 		$this->_hasCheckedMessage=true;
342
-		$element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]);
343
-		$this->addInToolbar($element,$callback);
342
+		$element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]);
343
+		$this->addInToolbar($element, $callback);
344 344
 	}
345 345
 
346 346
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@  discard block
 block discarded – undo
11 11
  * @property boolean $_visibleHover;
12 12
  * @property InstanceViewer $_instanceViewer
13 13
  */
14
-trait DataTableFieldAsTrait{
14
+trait DataTableFieldAsTrait {
15 15
 	abstract public function addField($field);
16
-	abstract public function insertField($index,$field);
17
-	abstract public function insertInField($index,$field);
16
+	abstract public function insertField($index, $field);
17
+	abstract public function insertInField($index, $field);
18 18
 	/**
19 19
 	 * @param string $caption
20 20
 	 * @param callable $callback
21 21
 	 * @param boolean $visibleHover
22 22
 	 * @return callable
23 23
 	 */
24
-	private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){
25
-		return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback);
24
+	private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) {
25
+		return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback);
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
 	 * @param callable $callback
32 32
 	 * @return callable
33 33
 	 */
34
-	private function getCallable($thisCallback,$parameters,$callback=null){
35
-		$result=function($instance) use($thisCallback,$parameters,$callback){
36
-			$object=call_user_func_array(array($this,$thisCallback), $parameters);
37
-			if(isset($callback)){
38
-				if(\is_callable($callback)){
39
-					$callback($object,$instance);
34
+	private function getCallable($thisCallback, $parameters, $callback=null) {
35
+		$result=function($instance) use($thisCallback, $parameters, $callback){
36
+			$object=call_user_func_array(array($this, $thisCallback), $parameters);
37
+			if (isset($callback)) {
38
+				if (\is_callable($callback)) {
39
+					$callback($object, $instance);
40 40
 				}
41 41
 			}
42
-			if($object instanceof HtmlSemDoubleElement){
43
-				$object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier());
44
-				if($object->propertyContains("class","visibleover")){
42
+			if ($object instanceof HtmlSemDoubleElement) {
43
+				$object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier());
44
+				if ($object->propertyContains("class", "visibleover")) {
45 45
 					$this->_visibleHover=true;
46
-					$object->setProperty("style","visibility:hidden;");
46
+					$object->setProperty("style", "visibility:hidden;");
47 47
 				}
48 48
 			}
49 49
 			return $object;
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 * @param string $caption
56 56
 	 * @return HtmlButton
57 57
 	 */
58
-	private function getFieldButton($caption,$visibleHover=true){
59
-		$bt= new HtmlButton("",$caption);
60
-		if($visibleHover)
58
+	private function getFieldButton($caption, $visibleHover=true) {
59
+		$bt=new HtmlButton("", $caption);
60
+		if ($visibleHover)
61 61
 			$this->_visibleOver($bt);
62 62
 			return $bt;
63 63
 	}
@@ -71,19 +71,19 @@  discard block
 block discarded – undo
71 71
 	 * @param array $attributes associative array (<b>ajax</b> key is for ajax post)
72 72
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
73 73
 	 */
74
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
75
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
76
-			$button=new HtmlButton($id,$value,$cssStyle);
77
-			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
78
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
74
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
75
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){
76
+			$button=new HtmlButton($id, $value, $cssStyle);
77
+			$button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]);
78
+			if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
79 79
 				$this->_visibleOver($button);
80 80
 				return $button;
81
-		}, $index,$attributes);
81
+		}, $index, $attributes);
82 82
 	}
83 83
 
84
-	protected function _visibleOver($element){
84
+	protected function _visibleOver($element) {
85 85
 		$this->_visibleHover=true;
86
-		return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;");
86
+		return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;");
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * @param boolean $visibleHover
94 94
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
95 95
 	 */
96
-	public function addFieldButton($caption,$visibleHover=true,$callback=null){
97
-		$this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback));
96
+	public function addFieldButton($caption, $visibleHover=true, $callback=null) {
97
+		$this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback));
98 98
 		return $this;
99 99
 	}
100 100
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param callable $callback
106 106
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
107 107
 	 */
108
-	public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){
109
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
108
+	public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) {
109
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
110 110
 		return $this;
111 111
 	}
112 112
 
@@ -117,53 +117,53 @@  discard block
 block discarded – undo
117 117
 	 * @param callable $callback
118 118
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
119 119
 	 */
120
-	public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){
121
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
120
+	public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) {
121
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
122 122
 		return $this;
123 123
 	}
124 124
 
125
-	private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){
126
-		$this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
125
+	private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) {
126
+		$this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){
131
-		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
130
+	private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) {
131
+		$this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
132 132
 		return $this;
133 133
 	}
134 134
 
135
-	private function getDefaultButton($icon,$class=null,$visibleHover=true){
136
-		$bt=$this->getFieldButton("",$visibleHover);
135
+	private function getDefaultButton($icon, $class=null, $visibleHover=true) {
136
+		$bt=$this->getFieldButton("", $visibleHover);
137 137
 		$bt->asIcon($icon);
138
-		if(isset($class))
138
+		if (isset($class))
139 139
 			$bt->addClass($class);
140 140
 			return $bt;
141 141
 	}
142 142
 
143
-	public function addDeleteButton($visibleHover=true,$generateBehavior=true,$callback=null){
143
+	public function addDeleteButton($visibleHover=true, $generateBehavior=true, $callback=null) {
144 144
 		$this->_hasDelete=$generateBehavior;
145
-		return $this->addDefaultButton("remove","delete red basic",$visibleHover,$callback);
145
+		return $this->addDefaultButton("remove", "delete red basic", $visibleHover, $callback);
146 146
 	}
147 147
 
148
-	public function addEditButton($visibleHover=true,$generateBehavior=true,$callback=null){
148
+	public function addEditButton($visibleHover=true, $generateBehavior=true, $callback=null) {
149 149
 		$this->_hasEdit=$generateBehavior;
150
-		return $this->addDefaultButton("edit","edit basic",$visibleHover,$callback);
150
+		return $this->addDefaultButton("edit", "edit basic", $visibleHover, $callback);
151 151
 	}
152 152
 
153
-	public function addEditDeleteButtons($visibleHover=true,$generateBehavior=true,$callbackEdit=null,$callbackDelete=null){
154
-		$this->addEditButton($visibleHover,$generateBehavior,$callbackEdit);
153
+	public function addEditDeleteButtons($visibleHover=true, $generateBehavior=true, $callbackEdit=null, $callbackDelete=null) {
154
+		$this->addEditButton($visibleHover, $generateBehavior, $callbackEdit);
155 155
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
156
-		$this->insertDeleteButtonIn($index,$visibleHover,$generateBehavior,$callbackDelete);
156
+		$this->insertDeleteButtonIn($index, $visibleHover, $generateBehavior, $callbackDelete);
157 157
 		return $this;
158 158
 	}
159 159
 
160
-	public function insertDeleteButtonIn($index,$visibleHover=true,$generateBehavior=true,$callback=null){
160
+	public function insertDeleteButtonIn($index, $visibleHover=true, $generateBehavior=true, $callback=null) {
161 161
 		$this->_hasDelete=$generateBehavior;
162
-		return $this->insertDefaultButtonIn($index,"remove","delete red basic",$visibleHover,$callback);
162
+		return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $visibleHover, $callback);
163 163
 	}
164 164
 
165
-	public function insertEditButtonIn($index,$visibleHover=true,$generateBehavior=true,$callback=null){
165
+	public function insertEditButtonIn($index, $visibleHover=true, $generateBehavior=true, $callback=null) {
166 166
 		$this->_hasEdit=$generateBehavior;
167
-		return $this->insertDefaultButtonIn($index,"edit","edit basic",$visibleHover,$callback);
167
+		return $this->insertDefaultButtonIn($index, "edit", "edit basic", $visibleHover, $callback);
168 168
 	}
169 169
 }
170 170
\ No newline at end of file
Please login to merge, or discard this patch.