Completed
Push — master ( b92773...4d236d )
by Jean-Christophe
03:15
created
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -14,41 +14,41 @@  discard block
 block discarded – undo
14 14
  * @property InstanceViewer $_instanceViewer
15 15
  */
16 16
 
17
-trait FieldAsTrait{
17
+trait FieldAsTrait {
18 18
 
19 19
 	protected abstract function _getFieldIdentifier($prefix);
20
-	public abstract function setValueFunction($index,$callback);
20
+	public abstract function setValueFunction($index, $callback);
21 21
 
22
-	public function fieldAsImage($index,$size=Size::SMALL,$circular=false){
23
-		$this->setValueFunction($index,function($img) use($size,$circular){
24
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
22
+	public function fieldAsImage($index, $size=Size::SMALL, $circular=false) {
23
+		$this->setValueFunction($index, function($img) use($size, $circular){
24
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
25 25
 			return $image;
26 26
 		}
27 27
 		);
28 28
 			return $this;
29 29
 	}
30 30
 
31
-	public function fieldAsAvatar($index){
32
-		$this->setValueFunction($index,function($img){return (new HtmlImage("",$img))->asAvatar();});
31
+	public function fieldAsAvatar($index) {
32
+		$this->setValueFunction($index, function($img) {return (new HtmlImage("", $img))->asAvatar(); });
33 33
 		return $this;
34 34
 	}
35 35
 
36
-	public function fieldAsRadio($index,$name=NULL){
37
-		$this->setValueFunction($index,function($value)use ($index,$name){
38
-			if(isset($name)===false){
36
+	public function fieldAsRadio($index, $name=NULL) {
37
+		$this->setValueFunction($index, function($value)use ($index, $name){
38
+			if (isset($name)===false) {
39 39
 				$name=$this->_instanceViewer->getCaption($index)."[]";
40 40
 			}
41
-			$radio=new HtmlRadio($this->_getFieldIdentifier("radio"),$name,$value,$value);
41
+			$radio=new HtmlRadio($this->_getFieldIdentifier("radio"), $name, $value, $value);
42 42
 			return $radio;
43 43
 		}
44 44
 		);
45 45
 			return $this;
46 46
 	}
47 47
 
48
-	public function fieldAsInput($index,$name=NULL,$type="text",$placeholder=""){
49
-		$this->setValueFunction($index,function($value) use($index,$name,$type,$placeholder){
50
-			$input=new HtmlInput($this->_getFieldIdentifier("input"),$type,$value,$placeholder);
51
-			if(isset($name)===false){
48
+	public function fieldAsInput($index, $name=NULL, $type="text", $placeholder="") {
49
+		$this->setValueFunction($index, function($value) use($index, $name, $type, $placeholder){
50
+			$input=new HtmlInput($this->_getFieldIdentifier("input"), $type, $value, $placeholder);
51
+			if (isset($name)===false) {
52 52
 				$name=$this->_instanceViewer->getCaption($index)."[]";
53 53
 			}
54 54
 			$input->getField()->setProperty("name", $name);
@@ -59,27 +59,27 @@  discard block
 block discarded – undo
59 59
 			return $this;
60 60
 	}
61 61
 
62
-	public function fieldAsCheckbox($index,$name=NULL){
63
-		$this->setValueFunction($index,function($value) use($index,$name){
64
-			$checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"),"",$value);
62
+	public function fieldAsCheckbox($index, $name=NULL) {
63
+		$this->setValueFunction($index, function($value) use($index, $name){
64
+			$checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"), "", $value);
65 65
 			$checkbox->setChecked(JString::isBooleanTrue($value));
66
-			if(isset($name)===false){
66
+			if (isset($name)===false) {
67 67
 				$name=$this->_instanceViewer->getCaption($index)."[]";
68 68
 			}
69 69
 			$checkbox->getField()->setProperty("name", $name);
70
-			return $checkbox;}
70
+			return $checkbox; }
71 71
 			);
72 72
 			return $this;
73 73
 	}
74 74
 
75
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$name=NULL){
76
-		$this->setValueFunction($index,function($value) use($index,$elements,$multiple,$name){
77
-			$dd=new HtmlDropdown($this->_getFieldIdentifier("dd"),$value,$elements);
78
-			if(isset($name)===false){
75
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $name=NULL) {
76
+		$this->setValueFunction($index, function($value) use($index, $elements, $multiple, $name){
77
+			$dd=new HtmlDropdown($this->_getFieldIdentifier("dd"), $value, $elements);
78
+			if (isset($name)===false) {
79 79
 				$name=$this->_instanceViewer->getCaption($index)."[]";
80 80
 			}
81
-			$dd->asSelect($name,$multiple);
82
-			return $dd;}
81
+			$dd->asSelect($name, $multiple);
82
+			return $dd; }
83 83
 			);
84 84
 			return $this;
85 85
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	protected $_compileParts;
31 31
 	protected $_toolbarPosition;
32 32
 
33
-	public function run(JsUtils $js){
34
-		if($this->_hasCheckboxes && isset($js)){
33
+	public function run(JsUtils $js) {
34
+		if ($this->_hasCheckboxes && isset($js)) {
35 35
 			$js->execOn("change", "#".$this->identifier." [name='selection[]']", "
36 36
 		var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true;
37 37
 		\$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}});
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 		parent::run($js);
41 41
 	}
42 42
 
43
-	public function __construct($identifier,$model,$modelInstance=NULL) {
44
-		parent::__construct($identifier, $model,$modelInstance);
43
+	public function __construct($identifier, $model, $modelInstance=NULL) {
44
+		parent::__construct($identifier, $model, $modelInstance);
45 45
 		$this->_instanceViewer=new InstanceViewer();
46
-		$this->content=["table"=>new HtmlTable($identifier, 0,0)];
46
+		$this->content=["table"=>new HtmlTable($identifier, 0, 0)];
47 47
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
48 48
 	}
49 49
 
50
-	public function compile(JsUtils $js=NULL,&$view=NULL){
50
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
51 51
 		$this->_instanceViewer->setInstance($this->_model);
52 52
 		$captions=$this->_instanceViewer->getCaptions();
53 53
 
54 54
 		$table=$this->content["table"];
55 55
 
56
-		if($this->_hasCheckboxes){
57
-			$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
56
+		if ($this->_hasCheckboxes) {
57
+			$ck=new HtmlCheckbox("main-ck-".$this->identifier, "");
58 58
 			$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);");
59 59
 			$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);");
60 60
 			\array_unshift($captions, $ck);
@@ -62,43 +62,43 @@  discard block
 block discarded – undo
62 62
 
63 63
 		$table->setRowCount(0, \sizeof($captions));
64 64
 		$table->setHeaderValues($captions);
65
-		if(isset($this->_compileParts))
65
+		if (isset($this->_compileParts))
66 66
 			$table->setCompileParts($this->_compileParts);
67
-		if(isset($this->_searchField)){
68
-			if(isset($js))
69
-				$this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]);
67
+		if (isset($this->_searchField)) {
68
+			if (isset($js))
69
+				$this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "-#".$this->identifier." tbody", ["preventDefault"=>false]);
70 70
 		}
71 71
 
72 72
 		$this->_generateContent($table);
73 73
 
74
-		if($this->_hasCheckboxes){
75
-			if($table->hasPart("thead"))
76
-				$table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort");
74
+		if ($this->_hasCheckboxes) {
75
+			if ($table->hasPart("thead"))
76
+				$table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort");
77 77
 		}
78 78
 
79
-		if(isset($this->_pagination) && $this->_pagination->getVisible()){
79
+		if (isset($this->_pagination) && $this->_pagination->getVisible()) {
80 80
 			$this->_generatePagination($table);
81 81
 		}
82
-		if(isset($this->_toolbar)){
82
+		if (isset($this->_toolbar)) {
83 83
 			$this->_setToolbarPosition($table, $captions);
84 84
 		}
85
-		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
86
-		return parent::compile($js,$view);
85
+		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
86
+		return parent::compile($js, $view);
87 87
 	}
88 88
 
89
-	private function _generateContent($table){
89
+	private function _generateContent($table) {
90 90
 		$objects=$this->_modelInstance;
91
-		if(isset($this->_pagination)){
91
+		if (isset($this->_pagination)) {
92 92
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
93 93
 		}
94 94
 		InstanceViewer::setIndex(0);
95
-		$table->fromDatabaseObjects($objects, function($instance){
95
+		$table->fromDatabaseObjects($objects, function($instance) {
96 96
 			$this->_instanceViewer->setInstance($instance);
97
-			$result= $this->_instanceViewer->getValues();
98
-			if($this->_hasCheckboxes){
99
-				$ck=new HtmlCheckbox("ck-".$this->identifier,"");
97
+			$result=$this->_instanceViewer->getValues();
98
+			if ($this->_hasCheckboxes) {
99
+				$ck=new HtmlCheckbox("ck-".$this->identifier, "");
100 100
 				$field=$ck->getField();
101
-				$field->setProperty("value",$this->_instanceViewer->getIdentifier());
101
+				$field->setProperty("value", $this->_instanceViewer->getIdentifier());
102 102
 				$field->setProperty("name", "selection[]");
103 103
 				\array_unshift($result, $ck);
104 104
 			}
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
106 106
 		});
107 107
 	}
108 108
 
109
-	private function _generatePagination($table){
109
+	private function _generatePagination($table) {
110 110
 		$footer=$table->getFooter();
111 111
 		$footer->mergeCol();
112
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
112
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
113 113
 		$menu->floatRight();
114 114
 		$menu->setActiveItem($this->_pagination->getPage()-1);
115 115
 		$footer->setValues($menu);
116
-		$menu->postOnClick($this->_urls,"{'p':$(this).attr('data-page')}","-#".$this->identifier." tbody",["preventDefault"=>false]);
116
+		$menu->postOnClick($this->_urls, "{'p':$(this).attr('data-page')}", "-#".$this->identifier." tbody", ["preventDefault"=>false]);
117 117
 	}
118 118
 
119
-	private function _setToolbarPosition($table,$captions){
120
-		switch ($this->_toolbarPosition){
119
+	private function _setToolbarPosition($table, $captions) {
120
+		switch ($this->_toolbarPosition) {
121 121
 			case PositionInTable::BEFORETABLE:case PositionInTable::AFTERTABLE:
122
-				if(isset($this->_compileParts)===false){
122
+				if (isset($this->_compileParts)===false) {
123 123
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
124 124
 				}
125 125
 				break;
126 126
 			case PositionInTable::HEADER:case PositionInTable::FOOTER: case PositionInTable::BODY:
127
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
127
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
128 128
 				break;
129 129
 		}
130 130
 	}
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	 * @param callable $callback function called after the field compilation
137 137
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
138 138
 	 */
139
-	public function afterCompile($index,$callback){
140
-		$this->_instanceViewer->afterCompile($index,$callback);
139
+	public function afterCompile($index, $callback) {
140
+		$this->_instanceViewer->afterCompile($index, $callback);
141 141
 		return $this;
142 142
 	}
143 143
 
144
-	private function addToolbarRow($part,$table,$captions){
144
+	private function addToolbarRow($part, $table, $captions) {
145 145
 		$row=$table->getPart($part)->addRow(\sizeof($captions));
146 146
 		$row->mergeCol();
147 147
 		$row->setValues([$this->_toolbar]);
@@ -156,42 +156,42 @@  discard block
 block discarded – undo
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	public function setCaptions($captions){
159
+	public function setCaptions($captions) {
160 160
 		$this->_instanceViewer->setCaptions($captions);
161 161
 		return $this;
162 162
 	}
163 163
 
164
-	public function setFields($fields){
164
+	public function setFields($fields) {
165 165
 		$this->_instanceViewer->setVisibleProperties($fields);
166 166
 		return $this;
167 167
 	}
168 168
 
169
-	public function addField($field){
169
+	public function addField($field) {
170 170
 		$this->_instanceViewer->addField($field);
171 171
 		return $this;
172 172
 	}
173 173
 
174
-	public function insertField($index,$field){
174
+	public function insertField($index, $field) {
175 175
 		$this->_instanceViewer->insertField($index, $field);
176 176
 		return $this;
177 177
 	}
178 178
 
179
-	public function insertInField($index,$field){
179
+	public function insertInField($index, $field) {
180 180
 		$this->_instanceViewer->insertInField($index, $field);
181 181
 		return $this;
182 182
 	}
183 183
 
184
-	public function setValueFunction($index,$callback){
184
+	public function setValueFunction($index, $callback) {
185 185
 		$this->_instanceViewer->setValueFunction($index, $callback);
186 186
 		return $this;
187 187
 	}
188 188
 
189
-	public function setIdentifierFunction($callback){
189
+	public function setIdentifierFunction($callback) {
190 190
 		$this->_instanceViewer->setIdentifierFunction($callback);
191 191
 		return $this;
192 192
 	}
193 193
 
194
-	public function getHtmlComponent(){
194
+	public function getHtmlComponent() {
195 195
 		return $this->content["table"];
196 196
 	}
197 197
 
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 		return $this;
205 205
 	}
206 206
 
207
-	public function paginate($items_per_page=10,$page=1){
208
-		$this->_pagination=new Pagination($items_per_page,4,$page);
207
+	public function paginate($items_per_page=10, $page=1) {
208
+		$this->_pagination=new Pagination($items_per_page, 4, $page);
209 209
 	}
210 210
 
211 211
 	public function getHasCheckboxes() {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		return $this;
218 218
 	}
219 219
 
220
-	public function refresh($compileParts=["tbody"]){
220
+	public function refresh($compileParts=["tbody"]) {
221 221
 		$this->_compileParts=$compileParts;
222 222
 		return $this;
223 223
 	}
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @param callable $callback
227 227
 	 * @return callable
228 228
 	 */
229
-	private function getFieldButtonCallable($caption,$callback=null){
230
-		return $this->getCallable($this->getFieldButton($caption),$callback);
229
+	private function getFieldButtonCallable($caption, $callback=null) {
230
+		return $this->getCallable($this->getFieldButton($caption), $callback);
231 231
 	}
232 232
 
233 233
 	/**
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 * @param callable $callback
236 236
 	 * @return callable
237 237
 	 */
238
-	private function getCallable($object,$callback=null){
239
-		$result=function($instance) use($object,$callback){
240
-			if(isset($callback)){
241
-				if(\is_callable($callback)){
242
-					$callback($object,$instance);
238
+	private function getCallable($object, $callback=null) {
239
+		$result=function($instance) use($object, $callback){
240
+			if (isset($callback)) {
241
+				if (\is_callable($callback)) {
242
+					$callback($object, $instance);
243 243
 				}
244 244
 			}
245 245
 			return $object;
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
 	 * @param string $caption
252 252
 	 * @return HtmlButton
253 253
 	 */
254
-	private function getFieldButton($caption){
255
-			$bt=new HtmlButton("",$caption);
256
-			$bt->setProperty("data-ajax",$this->_instanceViewer->getIdentifier());
254
+	private function getFieldButton($caption) {
255
+			$bt=new HtmlButton("", $caption);
256
+			$bt->setProperty("data-ajax", $this->_instanceViewer->getIdentifier());
257 257
 			return $bt;
258 258
 	}
259 259
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 * @param callable $callback
264 264
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
265 265
 	 */
266
-	public function addFieldButton($caption,$callback=null){
267
-		$this->addField($this->getFieldButtonCallable($caption,$callback));
266
+	public function addFieldButton($caption, $callback=null) {
267
+		$this->addField($this->getFieldButtonCallable($caption, $callback));
268 268
 		return $this;
269 269
 	}
270 270
 
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 	 * @param callable $callback
276 276
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
277 277
 	 */
278
-	public function insertFieldButton($index,$caption,$callback=null){
279
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$callback));
278
+	public function insertFieldButton($index, $caption, $callback=null) {
279
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $callback));
280 280
 		return $this;
281 281
 	}
282 282
 
@@ -287,55 +287,55 @@  discard block
 block discarded – undo
287 287
 	 * @param callable $callback
288 288
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
289 289
 	 */
290
-	public function insertInFieldButton($index,$caption,$callback=null){
291
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$callback));
290
+	public function insertInFieldButton($index, $caption, $callback=null) {
291
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $callback));
292 292
 		return $this;
293 293
 	}
294 294
 
295
-	private function addDefaultButton($icon,$class=null,$callback=null){
296
-		$bt=$this->getDefaultButton($icon,$class);
297
-		$this->addField($this->getCallable($bt,$callback));
295
+	private function addDefaultButton($icon, $class=null, $callback=null) {
296
+		$bt=$this->getDefaultButton($icon, $class);
297
+		$this->addField($this->getCallable($bt, $callback));
298 298
 		return $this;
299 299
 	}
300 300
 
301
-	private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){
302
-		$bt=$this->getDefaultButton($icon,$class);
303
-		$this->insertInField($index,$this->getCallable($bt,$callback));
301
+	private function insertDefaultButtonIn($index, $icon, $class=null, $callback=null) {
302
+		$bt=$this->getDefaultButton($icon, $class);
303
+		$this->insertInField($index, $this->getCallable($bt, $callback));
304 304
 		return $this;
305 305
 	}
306 306
 
307
-	private function getDefaultButton($icon,$class=null){
307
+	private function getDefaultButton($icon, $class=null) {
308 308
 		$bt=$this->getFieldButton("");
309 309
 		$bt->asIcon($icon);
310
-		if(isset($class))
310
+		if (isset($class))
311 311
 			$bt->addToProperty("class", $class);
312 312
 		return $bt;
313 313
 	}
314 314
 
315
-	public function addDeleteButton($callback=null){
316
-		return $this->addDefaultButton("remove","delete red basic",$callback);
315
+	public function addDeleteButton($callback=null) {
316
+		return $this->addDefaultButton("remove", "delete red basic", $callback);
317 317
 	}
318 318
 
319
-	public function addEditButton($callback=null){
320
-		return $this->addDefaultButton("edit","edit basic",$callback);
319
+	public function addEditButton($callback=null) {
320
+		return $this->addDefaultButton("edit", "edit basic", $callback);
321 321
 	}
322 322
 
323
-	public function addEditDeleteButtons($callbackEdit=null,$callbackDelete=null){
323
+	public function addEditDeleteButtons($callbackEdit=null, $callbackDelete=null) {
324 324
 		$this->addEditButton($callbackEdit);
325 325
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
326
-		$this->insertDeleteButtonIn($index,$callbackDelete);
326
+		$this->insertDeleteButtonIn($index, $callbackDelete);
327 327
 		return $this;
328 328
 	}
329 329
 
330
-	public function insertDeleteButtonIn($index,$callback=null){
331
-		return $this->insertDefaultButtonIn($index,"remove","delete red basic",$callback);
330
+	public function insertDeleteButtonIn($index, $callback=null) {
331
+		return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $callback);
332 332
 	}
333 333
 
334
-	public function insertEditButtonIn($index,$callback=null){
335
-		return $this->insertDefaultButtonIn($index,"edit","edit basic",$callback);
334
+	public function insertEditButtonIn($index, $callback=null) {
335
+		return $this->insertDefaultButtonIn($index, "edit", "edit basic", $callback);
336 336
 	}
337 337
 
338
-	public function setSelectable(){
338
+	public function setSelectable() {
339 339
 		$this->content["table"]->setSelectable();
340 340
 		return $this;
341 341
 	}
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	/**
344 344
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
345 345
 	 */
346
-	public function getToolbar(){
347
-		if(isset($this->_toolbar)===false){
346
+	public function getToolbar() {
347
+		if (isset($this->_toolbar)===false) {
348 348
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
349 349
 			$this->_toolbar->setSecondary();
350 350
 		}
@@ -355,37 +355,37 @@  discard block
 block discarded – undo
355 355
 	 * @param unknown $element
356 356
 	 * @return \Ajax\common\html\HtmlDoubleElement
357 357
 	 */
358
-	public function addInToolbar($element){
358
+	public function addInToolbar($element) {
359 359
 		$tb=$this->getToolbar();
360 360
 		return $tb->addItem($element);
361 361
 	}
362 362
 
363
-	public function addItemInToolbar($caption,$icon=NULL){
363
+	public function addItemInToolbar($caption, $icon=NULL) {
364 364
 		$result=$this->addInToolbar($caption);
365 365
 		$result->addIcon($icon);
366 366
 		return $result;
367 367
 	}
368 368
 
369
-	public function addButtonInToolbar($caption){
370
-		$bt=new HtmlButton("",$caption);
369
+	public function addButtonInToolbar($caption) {
370
+		$bt=new HtmlButton("", $caption);
371 371
 		return $this->addInToolbar($bt);
372 372
 	}
373 373
 
374
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
375
-		$bt=new HtmlButton("",$caption);
376
-		$bt->addIcon($icon,$before,$labeled);
374
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
375
+		$bt=new HtmlButton("", $caption);
376
+		$bt->addIcon($icon, $before, $labeled);
377 377
 		return $this->addInToolbar($bt);
378 378
 	}
379 379
 
380 380
 
381
-	public function addSearchInToolbar(){
381
+	public function addSearchInToolbar() {
382 382
 		return $this->addInToolbar($this->getSearchField())->setPosition("right");
383 383
 	}
384 384
 
385
-	public function getSearchField(){
386
-		if(isset($this->_searchField)===false){
387
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
388
-			$this->_searchField->addIcon("search",Direction::RIGHT);
385
+	public function getSearchField() {
386
+		if (isset($this->_searchField)===false) {
387
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
388
+			$this->_searchField->addIcon("search", Direction::RIGHT);
389 389
 		}
390 390
 		return $this->_searchField;
391 391
 	}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 		return $this;
396 396
 	}
397 397
 
398
-	protected function _getFieldIdentifier($prefix){
398
+	protected function _getFieldIdentifier($prefix) {
399 399
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
400 400
 	}
401 401
 }
402 402
\ No newline at end of file
Please login to merge, or discard this patch.