Completed
Push — master ( ca057c...baf19c )
by Jean-Christophe
03:05
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +85 added lines, -85 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
 
@@ -300,24 +300,24 @@  discard block
 block discarded – undo
300 300
 	 * @param array $attributes associative array (<b>ajax</b> key is for ajax post)
301 301
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
302 302
 	 */
303
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
304
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
305
-			$button=new HtmlButton($id,$value,$cssStyle);
306
-			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
307
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
303
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
304
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){
305
+			$button=new HtmlButton($id, $value, $cssStyle);
306
+			$button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]);
307
+			if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
308 308
 				$this->_visibleOver($button);
309 309
 			return $button;
310
-		}, $index,$attributes);
310
+		}, $index, $attributes);
311 311
 	}
312 312
 
313
-	protected function _visibleOver($element){
313
+	protected function _visibleOver($element) {
314 314
 		$this->_visibleHover=true;
315
-		return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;");
315
+		return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;");
316 316
 	}
317 317
 
318 318
 	protected function getTargetSelector() {
319 319
 		$result=$this->_targetSelector;
320
-		if(!isset($result))
320
+		if (!isset($result))
321 321
 			$result="#".$this->identifier;
322 322
 		return $result;
323 323
 	}
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 	protected function getCheckedMessage() {
336
-		$result= $this->_checkedMessage;
337
-		if(!isset($result)){
338
-			$result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"];
336
+		$result=$this->_checkedMessage;
337
+		if (!isset($result)) {
338
+			$result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"];
339 339
 		}
340 340
 		return $result;
341 341
 	}
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
 	 * @param array $checkedMessage
356 356
 	 * @param callable $callback
357 357
 	 */
358
-	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
359
-		if(isset($checkedMessage))
358
+	public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) {
359
+		if (isset($checkedMessage))
360 360
 			$this->_checkedMessage=$checkedMessage;
361 361
 		$checkedMessage=$this->getCheckedMessage();
362 362
 		$this->_hasCheckboxes=true;
363 363
 		$this->_hasCheckedMessage=true;
364
-		$element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]);
365
-		$this->addInToolbar($element,$callback);
364
+		$element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]);
365
+		$this->addInToolbar($element, $callback);
366 366
 	}
367 367
 
368 368
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
  * @property boolean $_visibleHover;
11 11
  * @property InstanceViewer $_instanceViewer
12 12
  */
13
-trait DataTableFieldAsTrait{
13
+trait DataTableFieldAsTrait {
14 14
 	abstract public function addField($field);
15
-	abstract public function insertField($index,$field);
16
-	abstract public function insertInField($index,$field);
15
+	abstract public function insertField($index, $field);
16
+	abstract public function insertInField($index, $field);
17 17
 	/**
18 18
 	 * @param string $caption
19 19
 	 * @param callable $callback
20 20
 	 * @param boolean $visibleHover
21 21
 	 * @return callable
22 22
 	 */
23
-	private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){
24
-		return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback);
23
+	private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) {
24
+		return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback);
25 25
 	}
26 26
 
27 27
 	/**
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 	 * @param callable $callback
31 31
 	 * @return callable
32 32
 	 */
33
-	private function getCallable($thisCallback,$parameters,$callback=null){
34
-		$result=function($instance) use($thisCallback,$parameters,$callback){
35
-			$object=call_user_func_array(array($this,$thisCallback), $parameters);
36
-			if(isset($callback)){
37
-				if(\is_callable($callback)){
38
-					$callback($object,$instance);
33
+	private function getCallable($thisCallback, $parameters, $callback=null) {
34
+		$result=function($instance) use($thisCallback, $parameters, $callback){
35
+			$object=call_user_func_array(array($this, $thisCallback), $parameters);
36
+			if (isset($callback)) {
37
+				if (\is_callable($callback)) {
38
+					$callback($object, $instance);
39 39
 				}
40 40
 			}
41
-			if($object instanceof HtmlSemDoubleElement){
42
-				$object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier());
43
-				if($object->propertyContains("class","visibleover")){
41
+			if ($object instanceof HtmlSemDoubleElement) {
42
+				$object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier());
43
+				if ($object->propertyContains("class", "visibleover")) {
44 44
 					$this->_visibleHover=true;
45
-					$object->setProperty("style","visibility:hidden;");
45
+					$object->setProperty("style", "visibility:hidden;");
46 46
 				}
47 47
 			}
48 48
 			return $object;
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param string $caption
55 55
 	 * @return HtmlButton
56 56
 	 */
57
-	private function getFieldButton($caption,$visibleHover=true){
58
-		$bt= new HtmlButton("",$caption);
59
-		if($visibleHover)
57
+	private function getFieldButton($caption, $visibleHover=true) {
58
+		$bt=new HtmlButton("", $caption);
59
+		if ($visibleHover)
60 60
 			$this->_visibleOver($bt);
61 61
 			return $bt;
62 62
 	}
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @param boolean $visibleHover
69 69
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
70 70
 	 */
71
-	public function addFieldButton($caption,$visibleHover=true,$callback=null){
72
-		$this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback));
71
+	public function addFieldButton($caption, $visibleHover=true, $callback=null) {
72
+		$this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback));
73 73
 		return $this;
74 74
 	}
75 75
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @param callable $callback
81 81
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
82 82
 	 */
83
-	public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){
84
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
83
+	public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) {
84
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
85 85
 		return $this;
86 86
 	}
87 87
 
@@ -92,53 +92,53 @@  discard block
 block discarded – undo
92 92
 	 * @param callable $callback
93 93
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
94 94
 	 */
95
-	public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){
96
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
95
+	public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) {
96
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
97 97
 		return $this;
98 98
 	}
99 99
 
100
-	private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){
101
-		$this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
100
+	private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) {
101
+		$this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
102 102
 		return $this;
103 103
 	}
104 104
 
105
-	private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){
106
-		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
105
+	private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) {
106
+		$this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
107 107
 		return $this;
108 108
 	}
109 109
 
110
-	private function getDefaultButton($icon,$class=null,$visibleHover=true){
111
-		$bt=$this->getFieldButton("",$visibleHover);
110
+	private function getDefaultButton($icon, $class=null, $visibleHover=true) {
111
+		$bt=$this->getFieldButton("", $visibleHover);
112 112
 		$bt->asIcon($icon);
113
-		if(isset($class))
113
+		if (isset($class))
114 114
 			$bt->addClass($class);
115 115
 			return $bt;
116 116
 	}
117 117
 
118
-	public function addDeleteButton($visibleHover=true,$generateBehavior=true,$callback=null){
118
+	public function addDeleteButton($visibleHover=true, $generateBehavior=true, $callback=null) {
119 119
 		$this->_hasDelete=$generateBehavior;
120
-		return $this->addDefaultButton("remove","delete red basic",$visibleHover,$callback);
120
+		return $this->addDefaultButton("remove", "delete red basic", $visibleHover, $callback);
121 121
 	}
122 122
 
123
-	public function addEditButton($visibleHover=true,$generateBehavior=true,$callback=null){
123
+	public function addEditButton($visibleHover=true, $generateBehavior=true, $callback=null) {
124 124
 		$this->_hasEdit=$generateBehavior;
125
-		return $this->addDefaultButton("edit","edit basic",$visibleHover,$callback);
125
+		return $this->addDefaultButton("edit", "edit basic", $visibleHover, $callback);
126 126
 	}
127 127
 
128
-	public function addEditDeleteButtons($visibleHover=true,$generateBehavior=true,$callbackEdit=null,$callbackDelete=null){
129
-		$this->addEditButton($visibleHover,$generateBehavior,$callbackEdit);
128
+	public function addEditDeleteButtons($visibleHover=true, $generateBehavior=true, $callbackEdit=null, $callbackDelete=null) {
129
+		$this->addEditButton($visibleHover, $generateBehavior, $callbackEdit);
130 130
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
131
-		$this->insertDeleteButtonIn($index,$visibleHover,$generateBehavior,$callbackDelete);
131
+		$this->insertDeleteButtonIn($index, $visibleHover, $generateBehavior, $callbackDelete);
132 132
 		return $this;
133 133
 	}
134 134
 
135
-	public function insertDeleteButtonIn($index,$visibleHover=true,$generateBehavior=true,$callback=null){
135
+	public function insertDeleteButtonIn($index, $visibleHover=true, $generateBehavior=true, $callback=null) {
136 136
 		$this->_hasDelete=$generateBehavior;
137
-		return $this->insertDefaultButtonIn($index,"remove","delete red basic",$visibleHover,$callback);
137
+		return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $visibleHover, $callback);
138 138
 	}
139 139
 
140
-	public function insertEditButtonIn($index,$visibleHover=true,$generateBehavior=true,$callback=null){
140
+	public function insertEditButtonIn($index, $visibleHover=true, $generateBehavior=true, $callback=null) {
141 141
 		$this->_hasEdit=$generateBehavior;
142
-		return $this->insertDefaultButtonIn($index,"edit","edit basic",$visibleHover,$callback);
142
+		return $this->insertDefaultButtonIn($index, "edit", "edit basic", $visibleHover, $callback);
143 143
 	}
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.