Completed
Push — master ( 7ebf5f...c286d3 )
by Jean-Christophe
02:51
created
Ajax/semantic/html/content/table/HtmlTD.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use Ajax\JsUtils;
13 13
 
14 14
 class HtmlTD extends HtmlSemDoubleElement {
15
-	use TextAlignmentTrait,TableElementTrait;
15
+	use TextAlignmentTrait, TableElementTrait;
16 16
 	private $_container;
17 17
 	private $_row;
18 18
 	private $_col;
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct($identifier, $content=NULL, $tagName="td") {
30 30
 		parent::__construct($identifier, $tagName, "", $content);
31
-		$this->_variations=[ Variation::COLLAPSING ];
32
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
31
+		$this->_variations=[Variation::COLLAPSING];
32
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
33 33
 	}
34 34
 
35 35
 	public function setContainer($container, $row, $col) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setRowspan($rowspan) {
52
-		$to=min($this->_container->count(), $this->_row + $rowspan - 1);
53
-		for($i=$to; $i > $this->_row; $i--) {
52
+		$to=min($this->_container->count(), $this->_row+$rowspan-1);
53
+		for ($i=$to; $i>$this->_row; $i--) {
54 54
 			$this->_container->toDelete($i, $this->_col);
55 55
 		}
56 56
 		$this->setProperty("rowspan", $rowspan);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	public function mergeRow() {
61
-		if(!$this->_rowMerged){
61
+		if (!$this->_rowMerged) {
62 62
 			$this->_rowMerged=true;
63 63
 			return $this->setRowspan($this->_container->count());
64 64
 		}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public function mergeCol() {
69
-		if(!$this->_colMerged){
69
+		if (!$this->_colMerged) {
70 70
 			$this->_colMerged=true;
71 71
 			return $this->setColspan($this->_container->getRow($this->_row)->count());
72 72
 		}
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	}
75 75
 
76 76
 	public function setColspan($colspan) {
77
-		$to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1);
78
-		for($i=$to; $i > $this->_col; $i--) {
79
-			$this->_container->toDelete($this->_row, $this->_col + 1);
77
+		$to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1);
78
+		for ($i=$to; $i>$this->_col; $i--) {
79
+			$this->_container->toDelete($this->_row, $this->_col+1);
80 80
 		}
81 81
 		$this->setProperty("colspan", $colspan);
82 82
 		return $this->_container;
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
 		return $this->addToProperty("class", "selectable");
116 116
 	}
117 117
 
118
-	public function setWidth($width){
118
+	public function setWidth($width) {
119 119
 		if (\is_int($width)) {
120
-			$width=Wide::getConstants()["W" . $width];
120
+			$width=Wide::getConstants()["W".$width];
121 121
 		}
122 122
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
123
-		return $this->addToPropertyCtrl("class", "wide", array ("wide" ));
123
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
124 124
 	}
125 125
 
126
-	public function toDelete(){
126
+	public function toDelete() {
127 127
 		$this->_deleted=true;
128 128
 		return $this;
129 129
 	}
130 130
 
131 131
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
132
-		if(!$this->_deleted)
132
+		if (!$this->_deleted)
133 133
 			return parent::compile();
134 134
 		return;
135 135
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 
29 29
 	public function __construct($identifier, $rowCount, $colCount) {
30 30
 		parent::__construct($identifier, "table", "ui table");
31
-		$this->content=array ();
31
+		$this->content=array();
32 32
 		$this->setRowCount($rowCount, $colCount);
33
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
34
-		$this->_compileParts=["thead","tbody","tfoot"];
33
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
34
+		$this->_compileParts=["thead", "tbody", "tfoot"];
35 35
 		$this->_afterCompileEvents=[];
36 36
 	}
37 37
 
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @return HtmlTableContent
42 42
 	 */
43 43
 	public function getPart($key) {
44
-		if (\array_key_exists($key, $this->content) === false) {
44
+		if (\array_key_exists($key, $this->content)===false) {
45 45
 			$this->content[$key]=new HtmlTableContent("", $key);
46
-			if ($key !== "tbody") {
46
+			if ($key!=="tbody") {
47 47
 				$this->content[$key]->setRowCount(1, $this->_colCount);
48 48
 			}
49 49
 		}
50 50
 		return $this->content[$key];
51 51
 	}
52 52
 
53
-	protected function _getFirstPart(){
54
-		if(isset($this->content["thead"])){
53
+	protected function _getFirstPart() {
54
+		if (isset($this->content["thead"])) {
55 55
 			return $this->content["thead"];
56 56
 		}
57 57
 		return $this->content["tbody"];
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return boolean
97 97
 	 */
98 98
 	public function hasPart($key) {
99
-		return \array_key_exists($key, $this->content) === true;
99
+		return \array_key_exists($key, $this->content)===true;
100 100
 	}
101 101
 
102 102
 	/**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 		return $this->colAlign($colIndex, "colLeft");
230 230
 	}
231 231
 
232
-	public function setColAlignment($colIndex,$alignment){
233
-		switch ($alignment){
232
+	public function setColAlignment($colIndex, $alignment) {
233
+		switch ($alignment) {
234 234
 			case TextAlignment::LEFT:
235 235
 				$function="colLeft";
236 236
 				break;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 	private function colAlign($colIndex, $function) {
250 250
 		if (\is_array($colIndex)) {
251
-			foreach ( $colIndex as $cIndex ) {
251
+			foreach ($colIndex as $cIndex) {
252 252
 				$this->colAlign($cIndex, $function);
253 253
 			}
254 254
 		} else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @see HtmlSemDoubleElement::compile()
310 310
 	 */
311 311
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
312
-		if(\sizeof($this->_compileParts)<3){
312
+		if (\sizeof($this->_compileParts)<3) {
313 313
 			$this->_template="%content%";
314 314
 			$this->refresh();
315 315
 		}
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	}
319 319
 
320 320
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
321
-		parent::compile_once($js,$view);
321
+		parent::compile_once($js, $view);
322 322
 		if ($this->propertyContains("class", "sortable")) {
323
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
323
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
324 324
 		}
325
-		if(isset($this->_activeRowSelector)){
325
+		if (isset($this->_activeRowSelector)) {
326 326
 			$this->_activeRowSelector->compile();
327 327
 		}
328 328
 	}
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	public function fromDatabaseObject($object, $function) {
337 337
 		$result=$function($object);
338 338
 		if (\is_array($result)) {
339
-			$result= $this->addRow($function($object));
339
+			$result=$this->addRow($function($object));
340 340
 		} else {
341
-			$result= $this->getBody()->_addRow($result);
341
+			$result=$this->getBody()->_addRow($result);
342 342
 		}
343
-		if(isset($this->_afterCompileEvents["onNewRow"])){
344
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
345
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
343
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
344
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
345
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
346 346
 		}
347 347
 		return $result;
348 348
 	}
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
 		return $this;
358 358
 	}
359 359
 
360
-	public function refresh(){
360
+	public function refresh() {
361 361
 		$this->_footer=$this->getFooter();
362 362
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
363 363
 	}
364 364
 
365
-	public function run(JsUtils $js){
366
-		$result= parent::run($js);
367
-		if(isset($this->_footer))
365
+	public function run(JsUtils $js) {
366
+		$result=parent::run($js);
367
+		if (isset($this->_footer))
368 368
 			$this->_footer->run($js);
369 369
 		return $result;
370 370
 	}
@@ -387,47 +387,47 @@  discard block
 block discarded – undo
387 387
 	 * @param boolean $multiple
388 388
 	 * @return HtmlTable
389 389
 	 */
390
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
391
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
390
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
391
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
392 392
 		return $this;
393 393
 	}
394 394
 
395
-	public function hideColumn($colIndex){
396
-		if(isset($this->content["thead"])){
395
+	public function hideColumn($colIndex) {
396
+		if (isset($this->content["thead"])) {
397 397
 			$this->content["thead"]->hideColumn($colIndex);
398 398
 		}
399 399
 		$this->content["tbody"]->hideColumn($colIndex);
400
-		if(isset($this->content["tfoot"])){
400
+		if (isset($this->content["tfoot"])) {
401 401
 			$this->content["tfoot"]->hideColumn($colIndex);
402 402
 		}
403 403
 		return $this;
404 404
 	}
405 405
 
406
-	public function setColWidth($colIndex,$width){
406
+	public function setColWidth($colIndex, $width) {
407 407
 		$part=$this->_getFirstPart();
408
-		if($part!==null && $part->count()>0)
408
+		if ($part!==null && $part->count()>0)
409 409
 			$part->getCell(0, $colIndex)->setWidth($width);
410 410
 		return $this;
411 411
 	}
412 412
 
413
-	public function setColWidths($widths){
413
+	public function setColWidths($widths) {
414 414
 		$part=$this->_getFirstPart();
415
-		if($part!==null && $part->count()>0){
415
+		if ($part!==null && $part->count()>0) {
416 416
 			$count=$part->getColCount();
417
-			if(!\is_array($widths)){
417
+			if (!\is_array($widths)) {
418 418
 				$widths=\array_fill(0, $count, $widths);
419 419
 			}
420
-			$max=\min(\sizeof($widths),$count);
421
-			for($i=0;$i<$max;$i++){
420
+			$max=\min(\sizeof($widths), $count);
421
+			for ($i=0; $i<$max; $i++) {
422 422
 				$part->getCell(0, $i)->setWidth($widths[$i]);
423 423
 			}
424 424
 		}
425 425
 		return $this;
426 426
 	}
427 427
 
428
-	public function mergeIdentiqualValues($colIndex,$function="strip_tags"){
428
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
429 429
 		$body=$this->getBody();
430
-		$body->mergeIdentiqualValues($colIndex,$function);
430
+		$body->mergeIdentiqualValues($colIndex, $function);
431 431
 		return $this;
432 432
 	}
433 433
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTableContent.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  *
12 12
  */
13 13
 class HtmlTableContent extends HtmlSemCollection {
14
-	protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ];
14
+	protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"];
15 15
 
16 16
 	/**
17 17
 	 *
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function setRowCount($rowCount, $colCount) {
36 36
 		$count=$this->count();
37
-		for($i=$count; $i < $rowCount; $i++) {
37
+		for ($i=$count; $i<$rowCount; $i++) {
38 38
 			$this->addItem($colCount);
39 39
 		}
40 40
 		return $this;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$tr=new HtmlTR("", $value);
57 57
 		$tr->setContainer($this, $count);
58 58
 		$tr->setTdTagName($this->_tdTagNames[$this->tagName]);
59
-		if (isset($value) === true) {
59
+		if (isset($value)===true) {
60 60
 			$tr->setColCount($value);
61 61
 		}
62 62
 		return $tr;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setCellValue($row, $col, $value="") {
116 116
 		$cell=$this->getCell($row, $col);
117
-		if (isset($cell) === true) {
117
+		if (isset($cell)===true) {
118 118
 			$cell->setValue($value);
119 119
 		}
120 120
 		return $this;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param mixed $values
126 126
 	 */
127 127
 	public function setValues($values=array()) {
128
-		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);});
128
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->setValues($_values); });
129 129
 	}
130 130
 
131 131
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param mixed $values
134 134
 	 */
135 135
 	public function addValues($values=array()) {
136
-		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);});
136
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->addValues($_values); });
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
 	 * @param mixed $values
142 142
 	 * @param callable $callback
143 143
 	 */
144
-	protected function _addOrSetValues($values,$callback) {
144
+	protected function _addOrSetValues($values, $callback) {
145 145
 		$count=$this->count();
146 146
 		$isArray=true;
147 147
 		if (!\is_array($values)) {
148 148
 			$values=\array_fill(0, $count, $values);
149 149
 			$isArray=false;
150 150
 		}
151
-		if (JArray::dimension($values) == 1 && $isArray)
152
-			$values=[ $values ];
151
+		if (JArray::dimension($values)==1 && $isArray)
152
+			$values=[$values];
153 153
 
154 154
 		$count=\min(\sizeof($values), $count);
155 155
 
156
-		for($i=0; $i < $count; $i++) {
156
+		for ($i=0; $i<$count; $i++) {
157 157
 			$row=$this->content[$i];
158
-			$callback($row,$values[$i]);
158
+			$callback($row, $values[$i]);
159 159
 		}
160 160
 		return $this;
161 161
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			$values=\array_fill(0, $count, $values);
167 167
 		}
168 168
 		$count=\min(\sizeof($values), $count);
169
-		for($i=0; $i < $count; $i++) {
169
+		for ($i=0; $i<$count; $i++) {
170 170
 			$this->getCell($i, $colIndex)->setValue($values[$i]);
171 171
 		}
172 172
 		return $this;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public function addColVariations($colIndex, $variations=array()) {
176 176
 		$count=$this->count();
177
-		for($i=0; $i < $count; $i++) {
177
+		for ($i=0; $i<$count; $i++) {
178 178
 			$this->getCell($i, $colIndex)->addVariations($variations);
179 179
 		}
180 180
 		return $this;
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 
192 192
 	private function colAlign($colIndex, $function) {
193 193
 		$count=$this->count();
194
-		for($i=0; $i < $count; $i++) {
194
+		for ($i=0; $i<$count; $i++) {
195 195
 			$index=$this->content[$i]->getColPosition($colIndex);
196
-			if ($index !== NULL)
196
+			if ($index!==NULL)
197 197
 				$this->getCell($i, $index)->$function();
198 198
 		}
199 199
 		return $this;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function getColCount() {
227 227
 		$result=0;
228
-		if ($this->count() > 0)
228
+		if ($this->count()>0)
229 229
 			$result=$this->getItem(0)->count();
230 230
 		return $result;
231 231
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	public function delete($rowIndex, $colIndex=NULL) {
240 240
 		if (isset($colIndex)) {
241 241
 			$row=$this->getItem($rowIndex);
242
-			if (isset($row) === true) {
242
+			if (isset($row)===true) {
243 243
 				$row->delete($colIndex);
244 244
 			}
245 245
 		} else {
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 		return $this;
249 249
 	}
250 250
 
251
-	public function toDelete($rowIndex, $colIndex){
251
+	public function toDelete($rowIndex, $colIndex) {
252 252
 		$row=$this->getItem($rowIndex);
253
-		if (isset($row) === true)
253
+		if (isset($row)===true)
254 254
 			$row->toDelete($colIndex);
255 255
 		return $this;
256 256
 	}
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function conditionalCellFormat($callback, $format) {
281 281
 		$rows=$this->content;
282
-		foreach ( $rows as $row ) {
282
+		foreach ($rows as $row) {
283 283
 			$row->conditionalCellFormat($callback, $format);
284 284
 		}
285 285
 		return $this;
286 286
 	}
287 287
 
288
-	public function conditionalColFormat($colIndex,$callback,$format){
288
+	public function conditionalColFormat($colIndex, $callback, $format) {
289 289
 		$rows=$this->content;
290
-		foreach ( $rows as $row ) {
290
+		foreach ($rows as $row) {
291 291
 			$cell=$row->getItem($colIndex);
292
-			$cell->conditionnalCellFormat($callback,$format);
292
+			$cell->conditionnalCellFormat($callback, $format);
293 293
 		}
294 294
 		return $this;
295 295
 	}
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function conditionalRowFormat($callback, $format) {
303 303
 		$rows=$this->content;
304
-		foreach ( $rows as $row ) {
304
+		foreach ($rows as $row) {
305 305
 			$row->conditionalRowFormat($callback, $format);
306 306
 		}
307 307
 		return $this;
308 308
 	}
309 309
 
310
-	public function hideColumn($colIndex){
310
+	public function hideColumn($colIndex) {
311 311
 		$rows=$this->content;
312
-		foreach ( $rows as $row ) {
312
+		foreach ($rows as $row) {
313 313
 			$cell=$row->getItem($colIndex);
314
-			$cell->addToProperty("style","display:none;");
314
+			$cell->addToProperty("style", "display:none;");
315 315
 		}
316 316
 		return $this;
317 317
 	}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	public function applyCells($callback) {
324 324
 		$rows=$this->content;
325
-		foreach ( $rows as $row ) {
325
+		foreach ($rows as $row) {
326 326
 			$row->applyCells($callback);
327 327
 		}
328 328
 		return $this;
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function applyRows($callback) {
336 336
 		$rows=$this->content;
337
-		foreach ( $rows as $row ) {
337
+		foreach ($rows as $row) {
338 338
 			$row->apply($callback);
339 339
 		}
340 340
 		return $this;
341 341
 	}
342 342
 
343
-	public function mergeIdentiqualValues($colIndex,$function="strip_tags"){
343
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
344 344
 		$rows=$this->content;
345 345
 		$identiqual=null;
346 346
 		$counter=0;
347 347
 		$cellToMerge=null;
348 348
 		$functionExists=\function_exists($function);
349
-		foreach ( $rows as $row ) {
349
+		foreach ($rows as $row) {
350 350
 			$cell=$row->getItem($colIndex);
351 351
 			$value=$cell->getContent();
352
-			if($functionExists)
353
-				$value=\call_user_func($function,$value);
354
-			if($value!==$identiqual){
355
-				if($counter>0 && isset($cellToMerge)){
352
+			if ($functionExists)
353
+				$value=\call_user_func($function, $value);
354
+			if ($value!==$identiqual) {
355
+				if ($counter>0 && isset($cellToMerge)) {
356 356
 					$cellToMerge->setRowspan($counter);
357 357
 				}
358 358
 				$counter=0;
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			}
362 362
 			$counter++;
363 363
 		}
364
-		if($counter>0 && isset($cellToMerge)){
364
+		if ($counter>0 && isset($cellToMerge)) {
365 365
 			$cellToMerge->setRowspan($counter);
366 366
 		}
367 367
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormFields.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		}
36 36
 		if (isset($label))
37 37
 			$this->setLabel($label);
38
-		foreach ( $fields as $field ) {
38
+		foreach ($fields as $field) {
39 39
 			$this->addItem($field);
40 40
 		}
41 41
 		return $this;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function addItem($item) {
59 59
 		$item=parent::addItem($item);
60
-		if($item instanceof HtmlFormField)
60
+		if ($item instanceof HtmlFormField)
61 61
 			$item->setContainer($this);
62 62
 		return $item;
63 63
 	}
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
 
100 100
 	public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) {
101
-		$fields=array ();
101
+		$fields=array();
102 102
 		$i=0;
103
-		foreach ( $items as $val => $caption ) {
103
+		foreach ($items as $val => $caption) {
104 104
 			$itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type);
105 105
 			if ($val===$value) {
106 106
 				$itemO->getDataField()->setProperty("checked", "");
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	}
115 115
 
116 116
 	public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) {
117
-		$fields=array ();
117
+		$fields=array();
118 118
 		$i=0;
119
-		foreach ( $items as $val => $caption ) {
119
+		foreach ($items as $val => $caption) {
120 120
 			$itemO=new HtmlFormCheckbox($name."-".$i++, $caption, $val, $type);
121 121
 			$itemO->setName($name);
122 122
 			if (\array_search($val, $values)!==false) {
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
17 17
 
18 18
 	abstract public function getUrl($url);
19
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
19
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
20 20
 
21
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
22
-		if(JString::isNull($params)){$params="{}";}
21
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
22
+		if (JString::isNull($params)) {$params="{}"; }
23 23
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
24 24
 		$retour=$this->_getAjaxUrl($url, $attr);
25 25
 		$responseElement=$this->_getResponseElement($responseElement);
26 26
 		$retour.="var self=this;\n";
27
-		if($hasLoader===true){
27
+		if ($hasLoader===true) {
28 28
 			$this->addLoading($retour, $responseElement);
29 29
 		}
30 30
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
31
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
31
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
32 32
 		if ($immediatly)
33 33
 			$this->jquery_code_for_compile[]=$retour;
34 34
 			return $retour;
@@ -36,33 +36,33 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 
39
-	protected function _getAjaxUrl($url,$attr){
39
+	protected function _getAjaxUrl($url, $attr) {
40 40
 		$url=$this->_correctAjaxUrl($url);
41 41
 		$retour="url='".$url."';";
42 42
 		$slash="/";
43
-		if(JString::endswith($url, "/")===true)
43
+		if (JString::endswith($url, "/")===true)
44 44
 			$slash="";
45
-			if(JString::isNotNull($attr)){
45
+			if (JString::isNotNull($attr)) {
46 46
 				if ($attr==="value")
47 47
 					$retour.="url=url+'".$slash."'+$(this).val();\n";
48 48
 				elseif ($attr==="html")
49 49
 					$retour.="url=url+'".$slash."'+$(this).html();\n";
50
-				elseif($attr!==null && $attr!=="")
50
+				elseif ($attr!==null && $attr!=="")
51 51
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
52 52
 			}
53 53
 			return $retour;
54 54
 	}
55 55
 
56
-	protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){
57
-		$retour="";$call=null;
56
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) {
57
+		$retour=""; $call=null;
58 58
 		if ($responseElement!=="") {
59
-			if(isset($ajaxTransition)){
59
+			if (isset($ajaxTransition)) {
60 60
 				$call=$this->setAjaxDataCall($ajaxTransition);
61
-			}elseif(isset($this->ajaxTransition)){
61
+			}elseif (isset($this->ajaxTransition)) {
62 62
 				$call=$this->ajaxTransition;
63 63
 			}
64
-			if(\is_callable($call))
65
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
64
+			if (\is_callable($call))
65
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
66 66
 				else
67 67
 					$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
68 68
 		}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		return $retour;
71 71
 	}
72 72
 
73
-	protected function _getResponseElement($responseElement){
73
+	protected function _getResponseElement($responseElement) {
74 74
 		if ($responseElement!=="") {
75 75
 			$responseElement=Javascript::prep_value($responseElement);
76 76
 		}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	protected function _correctAjaxUrl($url) {
81 81
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
82 82
 			$url=substr($url, 0, strlen($url)-1);
83
-			if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
83
+			if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
84 84
 				$url=$this->getUrl($url);
85 85
 			}
86 86
 			return $url;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
99 99
 	}
100 100
 
101
-	protected function setAjaxDataCall($params){
101
+	protected function setAjaxDataCall($params) {
102 102
 		$result=null;
103
-		if(!\is_callable($params)){
104
-			$result=function ($responseElement,$jqueryDone="html") use($params){
105
-				return AjaxTransition::{$params}($responseElement,$jqueryDone);
103
+		if (!\is_callable($params)) {
104
+			$result=function($responseElement, $jqueryDone="html") use($params){
105
+				return AjaxTransition::{$params}($responseElement, $jqueryDone);
106 106
 			};
107 107
 		}
108 108
 		return $result;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
123 123
 	 * @param string|callable $ajaxTransition
124 124
 	 */
125
-	private function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
126
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
125
+	private function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
126
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
127 127
 	}
128 128
 
129 129
 	/**
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
137 137
 	 * @param string|callable $ajaxTransition
138 138
 	 */
139
-	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
140
-		return $this->_get($url,$params,$responseElement,$jsCallback,null,$hasLoader,$jqueryDone,$ajaxTransition,true);
139
+	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
140
+		return $this->_get($url, $params, $responseElement, $jsCallback, null, $hasLoader, $jqueryDone, $ajaxTransition, true);
141 141
 	}
142 142
 
143 143
 	/**
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
152 152
 	 * @param string|callable $ajaxTransition
153 153
 	 */
154
-	public function ajax($method,$url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
154
+	public function ajax($method, $url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
155 155
 		$method=\strtolower($method);
156
-		return $this->_ajax($method,$url,$params,$responseElement,$jsCallback,null,$hasLoader,$jqueryDone,$ajaxTransition,true);
156
+		return $this->_ajax($method, $url, $params, $responseElement, $jsCallback, null, $hasLoader, $jqueryDone, $ajaxTransition, true);
157 157
 	}
158 158
 
159 159
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @param string $context
167 167
 	 * @param boolean $immediatly
168 168
 	 */
169
-	private function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
169
+	private function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
170 170
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
171 171
 		$retour=$this->_getAjaxUrl($url, $attr);
172 172
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 * @param string $context
190 190
 	 * @param boolean $immediatly
191 191
 	 */
192
-	public function json($url, $method="get", $params="{}", $jsCallback=NULL,$context="document",$immediatly=false) {
193
-		return $this->_json($url,$method,$params,$jsCallback,NULL,$context,$immediatly);
192
+	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $context="document", $immediatly=false) {
193
+		return $this->_json($url, $method, $params, $jsCallback, NULL, $context, $immediatly);
194 194
 	}
195 195
 
196 196
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param string $url the request address
201 201
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
202 202
 	 */
203
-	public function jsonOn($event,$element, $url,$parameters=array()) {
203
+	public function jsonOn($event, $element, $url, $parameters=array()) {
204 204
 		$preventDefault=true;
205 205
 		$stopPropagation=true;
206 206
 		$jsCallback=null;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		$params="{}";
211 211
 		$immediatly=true;
212 212
 		extract($parameters);
213
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
213
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
214 214
 	}
215 215
 
216 216
 	/**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @param string $jsCallback javascript code to execute after the request
222 222
 	 * @param string $context jquery DOM element, array container.
223 223
 	 */
224
-	public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL,$context=NULL) {
225
-		return $this->json($url, $method, $params, $jsCallback, $context,false);
224
+	public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL, $context=NULL) {
225
+		return $this->json($url, $method, $params, $jsCallback, $context, false);
226 226
 	}
227 227
 
228 228
 	/**
@@ -235,22 +235,22 @@  discard block
 block discarded – undo
235 235
 	 * @param string $rowClass the css class for the new element
236 236
 	 * @param boolean $immediatly
237 237
 	 */
238
-	private function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL,$attr="id",$immediatly=false) {
238
+	private function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL, $attr="id", $immediatly=false) {
239 239
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
240 240
 		$retour=$this->_getAjaxUrl($url, $attr);
241
-		if($context===null){
241
+		if ($context===null) {
242 242
 			$parent="$('".$maskSelector."').parent()";
243
-			$newElm = "$('#'+newId)";
244
-		}else{
243
+			$newElm="$('#'+newId)";
244
+		} else {
245 245
 			$parent=$context;
246
-			$newElm = $context.".find('#'+newId)";
246
+			$newElm=$context.".find('#'+newId)";
247 247
 		}
248 248
 		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
249 249
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
250 250
 		$retour.=$parent.".find('._json').remove();";
251 251
 		$retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();
252 252
 		newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
253
-		$retour.= $appendTo;
253
+		$retour.=$appendTo;
254 254
 		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
255 255
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
256 256
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @param string $context jquery DOM element, array container.
270 270
 	 * @param boolean $immediatly
271 271
 	 */
272
-	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL,$immediatly=false) {
273
-		return $this->_jsonArray($maskSelector, $url,$method,$params,$jsCallback,$rowClass,$context,NULL,$immediatly);
272
+	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL, $immediatly=false) {
273
+		return $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, NULL, $immediatly);
274 274
 	}
275 275
 
276 276
 	/**
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 * @param string $rowClass the css class for the new element
284 284
 	 * @param string $context jquery DOM element, array container.
285 285
 	 */
286
-	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL) {
287
-		return $this->jsonArray($maskSelector, $url, $method, $params, $jsCallback,$rowClass,$context,false);
286
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL) {
287
+		return $this->jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, false);
288 288
 	}
289 289
 
290 290
 	/**
@@ -294,18 +294,18 @@  discard block
 block discarded – undo
294 294
 	 * @param string $url the request url
295 295
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true)
296 296
 	 */
297
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
297
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
298 298
 		$preventDefault=true;
299 299
 		$stopPropagation=true;
300 300
 		$jsCallback=null;
301 301
 		$attr="id";
302 302
 		$method="get";
303
-		$context = null;
303
+		$context=null;
304 304
 		$params="{}";
305 305
 		$immediatly=true;
306 306
 		$rowClass="_json";
307 307
 		extract($parameters);
308
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $rowClass, $context,$attr), $event, $preventDefault, $stopPropagation,$immediatly);
308
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, $attr), $event, $preventDefault, $stopPropagation, $immediatly);
309 309
 	}
310 310
 
311 311
 	/**
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
320 320
 	 * @param string|callable $ajaxTransition
321 321
 	 */
322
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
323
-		return $this->_get($url, $params,$responseElement,$jsCallback,$attr,false,$jqueryDone,$ajaxTransition);
322
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
323
+		return $this->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
324 324
 	}
325 325
 
326 326
 	/**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		$ajaxTransition=null;
344 344
 		$params="{}";
345 345
 		extract($parameters);
346
-		return $this->_add_event($element, $this->_get($url, $params,$responseElement,$jsCallback,$attr, $hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
346
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
347 347
 	}
348 348
 
349 349
 	/**
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		$ajaxTransition=null;
368 368
 		$params="{}";
369 369
 		extract($parameters);
370
-		return $this->_add_event($element, $this->_ajax($method,$url, $params,$responseElement,$jsCallback,$attr, $hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
370
+		return $this->_add_event($element, $this->_ajax($method, $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
371 371
 	}
372 372
 
373 373
 	/**
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 		return $this->getOn("click", $element, $url, $responseElement, $parameters);
395 395
 	}
396 396
 
397
-	private function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
398
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
397
+	private function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
398
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
399 399
 	}
400 400
 
401 401
 	/**
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
409 409
 	 * @param string|callable $ajaxTransition
410 410
 	 */
411
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
412
-		return $this->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
411
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
412
+		return $this->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
413 413
 	}
414 414
 
415 415
 	/**
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
425 425
 	 * @param string|callable $ajaxTransition
426 426
 	 */
427
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
428
-		return $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
427
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
428
+		return $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
429 429
 	}
430 430
 
431 431
 	/**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		$jqueryDone="html";
449 449
 		$ajaxTransition=null;
450 450
 		extract($parameters);
451
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
451
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
452 452
 	}
453 453
 
454 454
 	/**
@@ -464,20 +464,20 @@  discard block
 block discarded – undo
464 464
 		return $this->postOn("click", $element, $url, $params, $responseElement, $parameters);
465 465
 	}
466 466
 
467
-	private function _postForm($url, $form, $responseElement, $params=null,$validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
467
+	private function _postForm($url, $form, $responseElement, $params=null, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
468 468
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
469 469
 		$retour=$this->_getAjaxUrl($url, $attr);
470 470
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
471
-		if(isset($params)){
471
+		if (isset($params)) {
472 472
 			$retour.="params+='&'+$.param(".$params.");\n";
473 473
 		}
474 474
 		$responseElement=$this->_getResponseElement($responseElement);
475 475
 		$retour.="var self=this;\n";
476
-		if($hasLoader===true){
476
+		if ($hasLoader===true) {
477 477
 			$this->addLoading($retour, $responseElement);
478 478
 		}
479 479
 		$retour.="$.post(url,params).done(function( data ) {\n";
480
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
480
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
481 481
 
482 482
 		if ($validation) {
483 483
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
502 502
 	 * @param string|callable $ajaxTransition
503 503
 	 */
504
-	public function postForm($url, $form, $responseElement, $params=NULL,$validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
505
-		return $this->_postForm($url, $form, $responseElement, $params,$validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
504
+	public function postForm($url, $form, $responseElement, $params=NULL, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
505
+		return $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
506 506
 	}
507 507
 
508 508
 	/**
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
520 520
 	 * @param string|callable $ajaxTransition
521 521
 	 */
522
-	public function postFormDeferred($url, $form, $responseElement, $params=NULL,$validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
523
-		return $this->_postForm($url, $form, $responseElement, $params,$validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
522
+	public function postFormDeferred($url, $form, $responseElement, $params=NULL, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
523
+		return $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
524 524
 	}
525 525
 
526 526
 	/**
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		$jqueryDone="html";
546 546
 		$ajaxTransition=null;
547 547
 		extract($parameters);
548
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement,$params, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
548
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
549 549
 	}
550 550
 
551 551
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlModal.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	protected $_paramParts=array();
16 16
 
17 17
 	public function __construct($identifier, $header="", $content="", $actions=null) {
18
-		parent::__construct($identifier, "div","ui modal");
19
-		if(isset($header)){
18
+		parent::__construct($identifier, "div", "ui modal");
19
+		if (isset($header)) {
20 20
 			$this->setHeader($header);
21 21
 		}
22
-		if(isset($content)){
22
+		if (isset($content)) {
23 23
 			$this->setContent($content);
24 24
 		}
25
-		if(isset($actions)){
25
+		if (isset($actions)) {
26 26
 			$this->setActions($actions);
27 27
 		}
28 28
 	}
29 29
 
30 30
 	public function setHeader($value) {
31
-		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
31
+		$this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value);
32 32
 		return $this;
33 33
 	}
34 34
 
35 35
 	public function setContent($value) {
36
-		$this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value);
36
+		$this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value);
37 37
 		return $this;
38 38
 	}
39 39
 
40 40
 	public function setActions($actions) {
41
-		$this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions");
42
-		if(\is_array($actions)){
43
-			foreach ($actions as $action){
41
+		$this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions");
42
+		if (\is_array($actions)) {
43
+			foreach ($actions as $action) {
44 44
 				$this->addAction($action);
45 45
 			}
46 46
 		}
47
-		else{
47
+		else {
48 48
 			$this->addAction($actions);
49 49
 		}
50 50
 		return $this;
@@ -54,17 +54,17 @@  discard block
 block discarded – undo
54 54
 	 * @param string|BaseHtml $action
55 55
 	 * @return HtmlButton
56 56
 	 */
57
-	public function addAction($action){
58
-		if(!$action instanceof BaseHtml){
57
+	public function addAction($action) {
58
+		if (!$action instanceof BaseHtml) {
59 59
 			$class="";
60
-			if(\array_search($action, ["Okay","Yes"])!==false){
60
+			if (\array_search($action, ["Okay", "Yes"])!==false) {
61 61
 				$class="approve";
62 62
 			}
63
-			if(\array_search($action, ["Close","Cancel","No"])!==false){
63
+			if (\array_search($action, ["Close", "Cancel", "No"])!==false) {
64 64
 				$class="cancel";
65 65
 			}
66
-			$action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()),$action);
67
-			if($class!=="")
66
+			$action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()), $action);
67
+			if ($class!=="")
68 68
 				$action->addToProperty("class", $class);
69 69
 		}
70 70
 		return $this->addElementInPart($action, "actions");
@@ -74,66 +74,66 @@  discard block
 block discarded – undo
74 74
 	 * @param int $index
75 75
 	 * @return HtmlButton
76 76
 	 */
77
-	public function getAction($index){
77
+	public function getAction($index) {
78 78
 		return $this->content["actions"]->getContent()[$index];
79 79
 	}
80 80
 
81
-	public function addContent($content,$before=false){
82
-		$this->content["content"]->addContent($content,$before);
81
+	public function addContent($content, $before=false) {
82
+		$this->content["content"]->addContent($content, $before);
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function addImageContent($image,$description=NULL){
86
+	public function addImageContent($image, $description=NULL) {
87 87
 		$content=$this->content["content"];
88
-		if(isset($description)){
89
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
90
-			$content->addContent($description,true);
88
+		if (isset($description)) {
89
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
90
+			$content->addContent($description, true);
91 91
 		}
92
-		if($image!==""){
93
-			$img=new HtmlImage("image-".$this->identifier,$image,"","medium");
94
-			$content->addContent($img,true);
95
-			$content->addToProperty("class","image");
92
+		if ($image!=="") {
93
+			$img=new HtmlImage("image-".$this->identifier, $image, "", "medium");
94
+			$content->addContent($img, true);
95
+			$content->addToProperty("class", "image");
96 96
 		}
97 97
 		return $this;
98 98
 	}
99 99
 
100
-	public function addIconContent($icon,$description=NULL){
100
+	public function addIconContent($icon, $description=NULL) {
101 101
 		$content=$this->content["content"];
102
-		if(isset($description)){
103
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
104
-			$content->addContent($description,true);
102
+		if (isset($description)) {
103
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
104
+			$content->addContent($description, true);
105 105
 		}
106
-		if($icon!==""){
107
-			$img=new HtmlIcon("image-".$this->identifier,$icon);
108
-			$content->addContent($img,true);
109
-			$content->addToProperty("class","image");
106
+		if ($icon!=="") {
107
+			$img=new HtmlIcon("image-".$this->identifier, $icon);
108
+			$content->addContent($img, true);
109
+			$content->addToProperty("class", "image");
110 110
 		}
111 111
 		return $this;
112 112
 	}
113 113
 
114
-	private function addElementInPart($element,$part) {
114
+	private function addElementInPart($element, $part) {
115 115
 		$this->content[$part]->addContent($element);
116 116
 		return $element;
117 117
 	}
118 118
 
119
-	public function showDimmer($value){
120
-		$value=$value?"show":"hide";
119
+	public function showDimmer($value) {
120
+		$value=$value ? "show" : "hide";
121 121
 		$this->_paramParts[]=["'".$value." dimmer'"];
122 122
 		return $this;
123 123
 	}
124 124
 
125
-	public function setInverted($recursive=true){
125
+	public function setInverted($recursive=true) {
126 126
 		$this->_params["inverted"]=true;
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function setBasic(){
130
+	public function setBasic() {
131 131
 		return $this->addToProperty("class", "basic");
132 132
 	}
133 133
 
134 134
 
135
-	public function setTransition($value){
136
-		$this->_paramParts[]=["'setting'","'transition'","'".$value."'"];
135
+	public function setTransition($value) {
136
+		$this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"];
137 137
 	}
138 138
 
139 139
 	/**
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @param string $viewName
144 144
 	 * @param $params The parameters to pass to the view
145 145
 	 */
146
-	public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) {
147
-		return $this->setContent($js->renderContent($initialController, $viewName,$params));
146
+	public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) {
147
+		return $this->setContent($js->renderContent($initialController, $viewName, $params));
148 148
 	}
149 149
 
150 150
 	/**
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param string $actionName the action name
156 156
 	 * @param array $params
157 157
 	 */
158
-	public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){
159
-		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params));
158
+	public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) {
159
+		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params));
160 160
 	}
161 161
 
162 162
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
167 167
 	 */
168 168
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
169
-		$this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]);
169
+		$this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]);
170 170
 		return parent::compile($js, $view);
171 171
 	}
172 172
 	/*
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @see BaseHtml::run()
175 175
 	 */
176 176
 	public function run(JsUtils $js) {
177
-		if(isset($this->_bsComponent)===false)
178
-			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts);
177
+		if (isset($this->_bsComponent)===false)
178
+			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts);
179 179
 		$this->addEventsOnRun($js);
180 180
 		return $this->_bsComponent;
181 181
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		return $this->jsDo("hide");
189 189
 	}
190 190
 
191
-	public function onHidden($js){
191
+	public function onHidden($js) {
192 192
 		$this->_params["onHidden"]=$js;
193 193
 	}
194 194
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
  * @property boolean $_visibleHover
15 15
  * @property InstanceViewer $_instanceViewer
16 16
  */
17
-trait DataTableFieldAsTrait{
17
+trait DataTableFieldAsTrait {
18 18
 	abstract public function addField($field);
19
-	abstract public function insertField($index,$field);
20
-	abstract public function insertInField($index,$field);
21
-	abstract public function fieldAs($index,$type,$attributes=NULL);
19
+	abstract public function insertField($index, $field);
20
+	abstract public function insertInField($index, $field);
21
+	abstract public function fieldAs($index, $type, $attributes=NULL);
22 22
 	/**
23 23
 	 * @param string $caption
24 24
 	 * @param callable $callback
25 25
 	 * @param boolean $visibleHover
26 26
 	 * @return callable
27 27
 	 */
28
-	private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){
29
-		return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback);
28
+	private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) {
29
+		return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback);
30 30
 	}
31 31
 
32 32
 	/**
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
 	 * @param callable $callback
36 36
 	 * @return callable
37 37
 	 */
38
-	private function getCallable($thisCallback,$parameters,$callback=null){
39
-		$result=function($instance) use($thisCallback,$parameters,$callback){
40
-			$object=call_user_func_array(array($this,$thisCallback), $parameters);
41
-			if(isset($callback)){
42
-				if(\is_callable($callback)){
43
-					$callback($object,$instance,$this->_instanceViewer->count()+1);
38
+	private function getCallable($thisCallback, $parameters, $callback=null) {
39
+		$result=function($instance) use($thisCallback, $parameters, $callback){
40
+			$object=call_user_func_array(array($this, $thisCallback), $parameters);
41
+			if (isset($callback)) {
42
+				if (\is_callable($callback)) {
43
+					$callback($object, $instance, $this->_instanceViewer->count()+1);
44 44
 				}
45 45
 			}
46
-			if($object instanceof HtmlSemDoubleElement){
46
+			if ($object instanceof HtmlSemDoubleElement) {
47 47
 				$id=$this->_instanceViewer->getIdentifier();
48
-				$object->setProperty("data-ajax",$id);
49
-				if($object->propertyContains("class","visibleover")){
48
+				$object->setProperty("data-ajax", $id);
49
+				if ($object->propertyContains("class", "visibleover")) {
50 50
 					$this->_visibleHover=true;
51
-					$object->setProperty("style","visibility:hidden;");
51
+					$object->setProperty("style", "visibility:hidden;");
52 52
 				}
53 53
 			}
54 54
 			return $object;
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 * @param string $caption
61 61
 	 * @return HtmlButton
62 62
 	 */
63
-	private function getFieldButton($caption,$visibleHover=true){
64
-		$bt= new HtmlButton("",$caption);
65
-		if($visibleHover)
63
+	private function getFieldButton($caption, $visibleHover=true) {
64
+		$bt=new HtmlButton("", $caption);
65
+		if ($visibleHover)
66 66
 			$this->_visibleOver($bt);
67 67
 		return $bt;
68 68
 	}
69 69
 
70
-	private function getFieldButtons($buttons,$visibleHover=true){
71
-		$bts=new HtmlButtonGroups("",$buttons);
72
-		if($visibleHover)
70
+	private function getFieldButtons($buttons, $visibleHover=true) {
71
+		$bts=new HtmlButtonGroups("", $buttons);
72
+		if ($visibleHover)
73 73
 			$this->_visibleOver($bts);
74 74
 		return $bts;
75 75
 	}
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
 	 * @param array $attributes associative array (<b>ajax</b> key is for ajax post)
84 84
 	 * @return DataTable
85 85
 	 */
86
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
87
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
88
-			$button=new HtmlButton($id,$value,$cssStyle);
89
-			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
90
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
86
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
87
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){
88
+			$button=new HtmlButton($id, $value, $cssStyle);
89
+			$button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]);
90
+			if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
91 91
 				$this->_visibleOver($button);
92 92
 				return $button;
93
-		}, $index,$attributes);
93
+		}, $index, $attributes);
94 94
 	}
95 95
 
96
-	protected function _visibleOver(BaseHtml $element){
96
+	protected function _visibleOver(BaseHtml $element) {
97 97
 		$this->_visibleHover=true;
98
-		return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;");
98
+		return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;");
99 99
 	}
100 100
 
101 101
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param boolean $visibleHover
106 106
 	 * @return DataTable
107 107
 	 */
108
-	public function addFieldButton($caption,$visibleHover=true,$callback=null){
109
-		$this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback));
108
+	public function addFieldButton($caption, $visibleHover=true, $callback=null) {
109
+		$this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback));
110 110
 		return $this;
111 111
 	}
112 112
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 * @param boolean $visibleHover
118 118
 	 * @return DataTable
119 119
 	 */
120
-	public function addFieldButtons($buttons,$visibleHover=true,$callback=null){
121
-		$this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback));
120
+	public function addFieldButtons($buttons, $visibleHover=true, $callback=null) {
121
+		$this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback));
122 122
 		return $this;
123 123
 	}
124 124
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * @param callable $callback
130 130
 	 * @return DataTable
131 131
 	 */
132
-	public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){
133
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
132
+	public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) {
133
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
134 134
 		return $this;
135 135
 	}
136 136
 
@@ -141,25 +141,25 @@  discard block
 block discarded – undo
141 141
 	 * @param callable $callback
142 142
 	 * @return DataTable
143 143
 	 */
144
-	public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){
145
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
144
+	public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) {
145
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
146 146
 		return $this;
147 147
 	}
148 148
 
149
-	private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){
150
-		$this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
149
+	private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) {
150
+		$this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){
155
-		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
154
+	private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) {
155
+		$this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	private function getDefaultButton($icon,$class=null,$visibleHover=true){
160
-		$bt=$this->getFieldButton("",$visibleHover);
159
+	private function getDefaultButton($icon, $class=null, $visibleHover=true) {
160
+		$bt=$this->getFieldButton("", $visibleHover);
161 161
 		$bt->asIcon($icon);
162
-		if(isset($class))
162
+		if (isset($class))
163 163
 			$bt->addClass($class);
164 164
 		return $bt;
165 165
 	}
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
172 172
 	 * @return DataTable
173 173
 	 */
174
-	public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){
174
+	public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) {
175 175
 		$this->_deleteBehavior=$deleteBehavior;
176
-		return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback);
176
+		return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback);
177 177
 	}
178 178
 
179 179
 	/**
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
184 184
 	 * @return DataTable
185 185
 	 */
186
-	public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){
186
+	public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) {
187 187
 		$this->_editBehavior=$editBehavior;
188
-		return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback);
188
+		return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback);
189 189
 	}
190 190
 
191 191
 	/**
@@ -196,20 +196,20 @@  discard block
 block discarded – undo
196 196
 	 * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
197 197
 	 * @return DataTable
198 198
 	 */
199
-	public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){
200
-		$this->addEditButton($visibleHover,$behavior,$callbackEdit);
199
+	public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) {
200
+		$this->addEditButton($visibleHover, $behavior, $callbackEdit);
201 201
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
202
-		$this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete);
202
+		$this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete);
203 203
 		return $this;
204 204
 	}
205 205
 
206
-	public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){
206
+	public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) {
207 207
 		$this->_deleteBehavior=$deleteBehavior;
208
-		return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback);
208
+		return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback);
209 209
 	}
210 210
 
211
-	public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){
211
+	public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) {
212 212
 		$this->_editBehavior=$editBehavior;
213
-		return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback);
213
+		return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback);
214 214
 	}
215 215
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
 use Ajax\semantic\html\collections\form\traits\FieldTrait;
14 14
 
15 15
 class HtmlDropdown extends HtmlSemDoubleElement {
16
-	use FieldTrait,LabeledIconTrait {
16
+	use FieldTrait, LabeledIconTrait {
17 17
 		addIcon as addIconP;
18 18
 	}
19 19
 	protected $mClass="menu";
20 20
 	protected $mTagName="div";
21
-	protected $items=array ();
22
-	protected $_params=array("action"=>"nothing","on"=>"hover");
21
+	protected $items=array();
22
+	protected $_params=array("action"=>"nothing", "on"=>"hover");
23 23
 	protected $input;
24 24
 	protected $value;
25 25
 	protected $_associative;
26 26
 	protected $_multiple;
27 27
 
28
-	public function __construct($identifier, $value="", $items=array(),$associative=true) {
28
+	public function __construct($identifier, $value="", $items=array(), $associative=true) {
29 29
 		parent::__construct($identifier, "div");
30 30
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
31 31
 		$this->setProperty("class", "ui dropdown");
32 32
 		$this->_multiple=false;
33 33
 		$content=[];
34
-		if(isset($value)){
35
-			if($value instanceof HtmlSemDoubleElement){
34
+		if (isset($value)) {
35
+			if ($value instanceof HtmlSemDoubleElement) {
36 36
 				$text=$value;
37
-			}else{
38
-				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
37
+			} else {
38
+				$text=new HtmlSemDoubleElement("text-".$this->identifier, "div");
39 39
 				$text->setClass("text");
40 40
 				$this->setValue($value);
41 41
 			}
@@ -48,29 +48,29 @@  discard block
 block discarded – undo
48 48
 		$this->addItems($items);
49 49
 	}
50 50
 
51
-	public function getField(){
51
+	public function getField() {
52 52
 		return $this->input;
53 53
 	}
54 54
 
55
-	public function getDataField(){
55
+	public function getDataField() {
56 56
 		return $this->input;
57 57
 	}
58 58
 
59
-	public function addItem($item,$value=NULL,$image=NULL,$description=NULL){
60
-		$itemO=$this->beforeAddItem($item,$value,$image,$description);
59
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
60
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
61 61
 		$this->items[]=$itemO;
62 62
 		return $itemO;
63 63
 	}
64 64
 
65
-	public function addIcon($icon,$before=true,$labeled=false){
65
+	public function addIcon($icon, $before=true, $labeled=false) {
66 66
 		$this->removeArrow();
67
-		$this->addIconP($icon,$before,$labeled);
67
+		$this->addIconP($icon, $before, $labeled);
68 68
 		return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter("");
69 69
 	}
70 70
 
71
-	public function addIcons($icons){
71
+	public function addIcons($icons) {
72 72
 		$count=$this->count();
73
-		for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){
73
+		for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) {
74 74
 			$this->getItem($i)->addIcon($icons[$i]);
75 75
 		}
76 76
 	}
@@ -81,33 +81,33 @@  discard block
 block discarded – undo
81 81
 	 * @param number $position
82 82
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
83 83
 	 */
84
-	public function insertItem($item,$position=0){
84
+	public function insertItem($item, $position=0) {
85 85
 		$itemO=$this->beforeAddItem($item);
86
-		 $start = array_slice($this->items, 0, $position);
87
-		 $end = array_slice($this->items, $position);
88
-		 $start[] = $item;
86
+		 $start=array_slice($this->items, 0, $position);
87
+		 $end=array_slice($this->items, $position);
88
+		 $start[]=$item;
89 89
 		 $this->items=array_merge($start, $end);
90 90
 		 return $itemO;
91 91
 	}
92 92
 
93
-	protected function removeArrow(){
94
-		if(\sizeof($this->content)>1){
93
+	protected function removeArrow() {
94
+		if (\sizeof($this->content)>1) {
95 95
 			unset($this->content["arrow"]);
96 96
 			$this->content=\array_values($this->content);
97 97
 		}
98 98
 	}
99 99
 
100
-	protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){
100
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
101 101
 		$itemO=$item;
102
-		if(\is_array($item)){
102
+		if (\is_array($item)) {
103 103
 			$description=JArray::getValue($item, "description", 3);
104 104
 			$value=JArray::getValue($item, "value", 1);
105 105
 			$image=JArray::getValue($item, "image", 2);
106 106
 			$item=JArray::getValue($item, "item", 0);
107 107
 		}
108
-		if(!$item instanceof HtmlDropdownItem){
109
-			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
110
-		}elseif($itemO instanceof HtmlDropdownItem){
108
+		if (!$item instanceof HtmlDropdownItem) {
109
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
110
+		}elseif ($itemO instanceof HtmlDropdownItem) {
111 111
 			$this->addToProperty("class", "vertical");
112 112
 		}
113 113
 		return $itemO;
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		$this->addItem($function($object));
121 121
 	}
122 122
 
123
-	public function addInput($name){
124
-		if(!isset($name))
123
+	public function addInput($name) {
124
+		if (!isset($name))
125 125
 			$name="input-".$this->identifier;
126 126
 		$this->setAction("activate");
127
-		$this->input=new HtmlInput($name,"hidden");
127
+		$this->input=new HtmlInput($name, "hidden");
128 128
 	}
129 129
 
130 130
 	/**
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 	 * @param string $icon
134 134
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
135 135
 	 */
136
-	public function addSearchInputItem($placeHolder=NULL,$icon=NULL){
137
-		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon));
136
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
137
+		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
138 138
 	}
139 139
 
140 140
 	/**
141 141
 	 * Adds a divider item
142 142
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
143 143
 	 */
144
-	public function addDividerItem(){
144
+	public function addDividerItem() {
145 145
 		return $this->addItem(HtmlDropdownItem::divider());
146 146
 	}
147 147
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @param string $icon
152 152
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
153 153
 	 */
154
-	public function addHeaderItem($caption=NULL,$icon=NULL){
155
-		return $this->addItem(HtmlDropdownItem::header($caption,$icon));
154
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
155
+		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
156 156
 	}
157 157
 
158 158
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @param string $color
162 162
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
163 163
 	 */
164
-	public function addCircularLabelItem($caption,$color){
164
+	public function addCircularLabelItem($caption, $color) {
165 165
 		return $this->addItem(HtmlDropdownItem::circular($caption, $color));
166 166
 	}
167 167
 
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 	 * @param string $image
171 171
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
172 172
 	 */
173
-	public function addMiniAvatarImageItem($caption,$image){
173
+	public function addMiniAvatarImageItem($caption, $image) {
174 174
 		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
175 175
 	}
176 176
 
177
-	public function addItems($items){
178
-		if(\is_array($items) && $this->_associative){
179
-			foreach ($items as $k=>$v){
177
+	public function addItems($items) {
178
+		if (\is_array($items) && $this->_associative) {
179
+			foreach ($items as $k=>$v) {
180 180
 				$this->addItem($v)->setData($k);
181 181
 			}
182
-		}else{
183
-			foreach ($items as $item){
182
+		} else {
183
+			foreach ($items as $item) {
184 184
 				$this->addItem($item);
185 185
 			}
186 186
 		}
@@ -192,91 +192,91 @@  discard block
 block discarded – undo
192 192
 	 * @param array $values
193 193
 	 * @return HtmlCollection
194 194
 	 */
195
-	public function setPropertyValues($property,$values){
195
+	public function setPropertyValues($property, $values) {
196 196
 		$i=0;
197
-		if(\is_array($values)===false){
198
-			$values=\array_fill(0, $this->count(),$values);
197
+		if (\is_array($values)===false) {
198
+			$values=\array_fill(0, $this->count(), $values);
199 199
 		}
200
-		foreach ($values as $value){
200
+		foreach ($values as $value) {
201 201
 			$c=$this->items[$i++];
202
-			if(isset($c)){
203
-				$c->setProperty($property,$value);
202
+			if (isset($c)) {
203
+				$c->setProperty($property, $value);
204 204
 			}
205
-			else{
205
+			else {
206 206
 				return $this;
207 207
 			}
208 208
 		}
209 209
 		return $this;
210 210
 	}
211 211
 
212
-	public function getItem($index){
212
+	public function getItem($index) {
213 213
 		return $this->items[$index];
214 214
 	}
215 215
 
216 216
 	/**
217 217
 	 * @return int
218 218
 	 */
219
-	public function count(){
219
+	public function count() {
220 220
 		return \sizeof($this->items);
221 221
 	}
222 222
 	/**
223 223
 	 * @param boolean $dropdown
224 224
 	 */
225
-	public function asDropdown($dropdown){
226
-		if($dropdown===false){
225
+	public function asDropdown($dropdown) {
226
+		if ($dropdown===false) {
227 227
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
228 228
 			$dropdown="menu";
229
-		}else{
229
+		} else {
230 230
 			$dropdown="dropdown";
231 231
 			$this->mClass="menu";
232 232
 		}
233
-		return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown"));
233
+		return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown"));
234 234
 	}
235 235
 
236
-	public function setVertical(){
237
-		return $this->addToPropertyCtrl("class", "vertical",array("vertical"));
236
+	public function setVertical() {
237
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
238 238
 	}
239 239
 
240
-	public function setInline(){
241
-		return $this->addToPropertyCtrl("class", "inline",["inline"]);
240
+	public function setInline() {
241
+		return $this->addToPropertyCtrl("class", "inline", ["inline"]);
242 242
 	}
243 243
 
244
-	public function setSimple(){
245
-		return $this->addToPropertyCtrl("class", "simple",array("simple"));
244
+	public function setSimple() {
245
+		return $this->addToPropertyCtrl("class", "simple", array("simple"));
246 246
 	}
247 247
 
248
-	public function asButton($floating=false){
248
+	public function asButton($floating=false) {
249 249
 		$this->removeArrow();
250
-		if($floating)
250
+		if ($floating)
251 251
 			$this->addToProperty("class", "floating");
252 252
 		$this->removePropertyValue("class", "selection");
253 253
 		return $this->addToProperty("class", "button");
254 254
 	}
255 255
 
256
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
256
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
257 257
 		$this->_multiple=$multiple;
258
-		if(isset($name))
258
+		if (isset($name))
259 259
 			$this->addInput($name);
260
-		if($multiple){
260
+		if ($multiple) {
261 261
 			$this->addToProperty("class", "multiple");
262 262
 		}
263
-		if ($selection){
264
-			if($this->propertyContains("class", "button")===false)
265
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
263
+		if ($selection) {
264
+			if ($this->propertyContains("class", "button")===false)
265
+				$this->addToPropertyCtrl("class", "selection", array("selection"));
266 266
 		}
267 267
 		return $this;
268 268
 	}
269 269
 
270
-	public function asSearch($name=NULL,$multiple=false,$selection=true){
271
-		$this->asSelect($name,$multiple,$selection);
270
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
271
+		$this->asSelect($name, $multiple, $selection);
272 272
 		return $this->addToProperty("class", "search");
273 273
 	}
274 274
 
275
-	public function setSelect($name=NULL,$multiple=false){
276
-		if(!isset($name))
275
+	public function setSelect($name=NULL, $multiple=false) {
276
+		if (!isset($name))
277 277
 			$name="select-".$this->identifier;
278 278
 		$this->input=null;
279
-		if($multiple){
279
+		if ($multiple) {
280 280
 			$this->setProperty("multiple", true);
281 281
 			$this->addToProperty("class", "multiple");
282 282
 		}
@@ -284,37 +284,37 @@  discard block
 block discarded – undo
284 284
 		$this->tagName="select";
285 285
 		$this->setProperty("name", $name);
286 286
 		$this->content=null;
287
-		foreach ($this->items as $item){
287
+		foreach ($this->items as $item) {
288 288
 			$item->asOption();
289 289
 		}
290 290
 		return $this;
291 291
 	}
292 292
 
293
-	public function asSubmenu($pointing=NULL){
293
+	public function asSubmenu($pointing=NULL) {
294 294
 		$this->setClass("ui dropdown link item");
295
-		if(isset($pointing)){
295
+		if (isset($pointing)) {
296 296
 			$this->setPointing($pointing);
297 297
 		}
298 298
 		return $this;
299 299
 	}
300 300
 
301
-	public function setPointing($value=Direction::NONE){
302
-		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
301
+	public function setPointing($value=Direction::NONE) {
302
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
303 303
 	}
304 304
 
305
-	public function setValue($value){
305
+	public function setValue($value) {
306 306
 		$this->value=$value;
307 307
 		return $this;
308 308
 	}
309
-	private function applyValue(){
309
+	private function applyValue() {
310 310
 		$value=$this->value;
311
-		if(isset($this->input) && isset($value)){
311
+		if (isset($this->input) && isset($value)) {
312 312
 			$this->input->setProperty("value", $value);
313
-		}else{
313
+		} else {
314 314
 			$this->setProperty("value", $value);
315 315
 		}
316 316
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
317
-			if(isset($textElement) && !$this->_multiple)
317
+			if (isset($textElement) && !$this->_multiple)
318 318
 				$textElement->setContent($value);
319 319
 		return $this;
320 320
 	}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 	 * @see BaseHtml::run()
325 325
 	 */
326 326
 	public function run(JsUtils $js) {
327
-		if($this->propertyContains("class", "simple")===false){
328
-			if(isset($this->_bsComponent)===false){
329
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
327
+		if ($this->propertyContains("class", "simple")===false) {
328
+			if (isset($this->_bsComponent)===false) {
329
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
330 330
 				$this->_bsComponent->setItemSelector(".item");
331 331
 			}
332 332
 			$this->addEventsOnRun($js);
@@ -334,36 +334,36 @@  discard block
 block discarded – undo
334 334
 		}
335 335
 	}
336 336
 
337
-	public function setCompact(){
337
+	public function setCompact() {
338 338
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
339 339
 	}
340 340
 
341
-	public function setAction($action){
341
+	public function setAction($action) {
342 342
 		$this->_params["action"]=$action;
343 343
 	}
344 344
 
345
-	public function setFullTextSearch($value){
345
+	public function setFullTextSearch($value) {
346 346
 		$this->_params["fullTextSearch"]=$value;
347 347
 	}
348 348
 
349 349
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
350 350
 		$this->applyValue();
351
-		return parent::compile($js,$view);
351
+		return parent::compile($js, $view);
352 352
 	}
353 353
 
354 354
 	public function getInput() {
355 355
 		return $this->input;
356 356
 	}
357 357
 	public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) {
358
-		return $this->_addAction($this, $action,$direction,$icon,$labeled);
358
+		return $this->_addAction($this, $action, $direction, $icon, $labeled);
359 359
 	}
360 360
 
361
-	public function setIcon($icon="dropdown"){
361
+	public function setIcon($icon="dropdown") {
362 362
 		$this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon);
363 363
 		return $this;
364 364
 	}
365 365
 
366
-	public function jsAddItem($caption){
366
+	public function jsAddItem($caption) {
367 367
 		$js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')";
368 368
 		return $js;
369 369
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldsTrait.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -20,46 +20,46 @@  discard block
 block discarded – undo
20 20
  * @property string $identifier
21 21
  */
22 22
 trait FieldsTrait {
23
-	abstract public function addFields($fields=NULL,$label=NULL);
23
+	abstract public function addFields($fields=NULL, $label=NULL);
24 24
 	abstract public function addItem($item);
25 25
 
26
-	protected function createItem($value){
27
-		if(\is_array($value)){
28
-			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null)));
26
+	protected function createItem($value) {
27
+		if (\is_array($value)) {
28
+			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null)));
29 29
 			return $itemO;
30
-		}elseif(\is_object($value)){
30
+		}elseif (\is_object($value)) {
31 31
 			$itemO=new HtmlFormField("field-".$this->identifier, $value);
32 32
 			return $itemO;
33
-		}else
33
+		} else
34 34
 			return new HtmlFormInput($value);
35 35
 	}
36 36
 
37
-	protected function createCondition($value){
37
+	protected function createCondition($value) {
38 38
 		return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput;
39 39
 	}
40 40
 
41
-	public function addInputs($inputs,$fieldslabel=null){
41
+	public function addInputs($inputs, $fieldslabel=null) {
42 42
 		$fields=array();
43
-		foreach ($inputs as $input){
43
+		foreach ($inputs as $input) {
44 44
 			\extract($input);
45
-			$f=new HtmlFormInput("","");
45
+			$f=new HtmlFormInput("", "");
46 46
 			$f->fromArray($input);
47 47
 			$fields[]=$f;
48 48
 		}
49
-		return $this->addFields($fields,$fieldslabel);
49
+		return $this->addFields($fields, $fieldslabel);
50 50
 	}
51 51
 
52
-	public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){
52
+	public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) {
53 53
 		$field=$this->getItem($index);
54
-		if(isset($field)){
55
-			$field->addRule($type,$prompt,$value);
54
+		if (isset($field)) {
55
+			$field->addRule($type, $prompt, $value);
56 56
 		}
57 57
 		return $this;
58 58
 	}
59 59
 
60
-	public function addFieldRules($index,$rules){
60
+	public function addFieldRules($index, $rules) {
61 61
 		$field=$this->getItem($index);
62
-		if(isset($field)){
62
+		if (isset($field)) {
63 63
 			$field->addRules($rules);
64 64
 		}
65 65
 		return $this;
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @param boolean $multiple
75 75
 	 * @return HtmlFormDropdown
76 76
 	 */
77
-	public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){
78
-		return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple));
77
+	public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) {
78
+		return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple));
79 79
 	}
80 80
 
81 81
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @param boolean $asIcons
86 86
 	 * @return HtmlButtonGroups
87 87
 	 */
88
-	public function addButtonGroups($identifier,$elements=[],$asIcons=false){
89
-		return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons));
88
+	public function addButtonGroups($identifier, $elements=[], $asIcons=false) {
89
+		return $this->addItem(new HtmlButtonGroups($identifier, $elements, $asIcons));
90 90
 	}
91 91
 
92 92
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @param string $icon
99 99
 	 * @return HtmlButtonGroups
100 100
 	 */
101
-	public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){
102
-		return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon));
101
+	public function addDropdownButton($identifier, $value, $items=[], $asCombo=false, $icon=null) {
102
+		return $this->addItem(HtmlButton::dropdown($identifier, $value, $items, $asCombo, $icon));
103 103
 	}
104 104
 
105 105
 	/**
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param string $placeholder
111 111
 	 * @return HtmlFormInput
112 112
 	 */
113
-	public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){
114
-		return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder));
113
+	public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
114
+		return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder));
115 115
 	}
116 116
 
117 117
 	/**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	 * @param int $rows
123 123
 	 * @return HtmlTextarea
124 124
 	 */
125
-	public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){
126
-		return $this->addItem(new HtmlFormTextarea($identifier,$label,$value,$placeholder,$rows));
125
+	public function addTextarea($identifier, $label, $value=NULL, $placeholder=NULL, $rows=5) {
126
+		return $this->addItem(new HtmlFormTextarea($identifier, $label, $value, $placeholder, $rows));
127 127
 	}
128 128
 
129
-	public function addPassword($identifier, $label=NULL){
130
-		return $this->addItem(new HtmlFormInput($identifier,$label,"password","",""));
129
+	public function addPassword($identifier, $label=NULL) {
130
+		return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", ""));
131 131
 	}
132 132
 
133
-	public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){
134
-		return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick));
133
+	public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) {
134
+		return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick));
135 135
 	}
136 136
 
137
-	public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){
138
-		return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type));
137
+	public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) {
138
+		return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type));
139 139
 	}
140 140
 
141
-	public function addRadio($identifier, $name,$label=NULL,$value=NULL){
142
-		return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value));
141
+	public function addRadio($identifier, $name, $label=NULL, $value=NULL) {
142
+		return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value));
143 143
 	}
144 144
 
145
-	public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){
146
-		$div=new HtmlSemDoubleElement($identifier,$tagName,$baseClass,$content);
147
-		return $this->addItem(new HtmlFormField("field-".$identifier, $div,$label));
145
+	public function addElement($identifier, $content, $label, $tagName="div", $baseClass="") {
146
+		$div=new HtmlSemDoubleElement($identifier, $tagName, $baseClass, $content);
147
+		return $this->addItem(new HtmlFormField("field-".$identifier, $div, $label));
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.