Passed
Push — master ( 016005...fffd2d )
by Jean-Christophe
02:21
created
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 trait TableTrait {
12 12
 
13
-	abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false);
13
+	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
14 14
 
15
-	abstract public function getOn($event, $url, $responseElement = "", $parameters = array());
15
+	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
16 16
 
17 17
 	protected function addToPropertyTable($property, $value) {
18 18
 		return $this->_self->addToProperty($property, $value);
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 		return $this->addToPropertyTable("class", "celled");
23 23
 	}
24 24
 
25
-	public function setBasic($very = false) {
26
-		$table = $this->_self;
25
+	public function setBasic($very=false) {
26
+		$table=$this->_self;
27 27
 		if ($very)
28 28
 			$table->addToPropertyCtrl("class", "very", array(
29 29
 				"very"
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 		));
34 34
 	}
35 35
 
36
-	public function setCompact($very = false) {
37
-		$table = $this->_self;
36
+	public function setCompact($very=false) {
37
+		$table=$this->_self;
38 38
 		if ($very)
39 39
 			$table->addToPropertyCtrl("class", "very", array(
40 40
 				"very"
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 		return $this->addToPropertyTable("class", "structured");
57 57
 	}
58 58
 
59
-	public function setSortable($colIndex = NULL) {
60
-		$table = $this->_self;
59
+	public function setSortable($colIndex=NULL) {
60
+		$table=$this->_self;
61 61
 		if (isset($colIndex) && $table->hasPart("thead")) {
62 62
 			$table->getHeader()->sort($colIndex);
63 63
 		}
@@ -80,29 +80,29 @@  discard block
 block discarded – undo
80 80
 		return $this->addToPropertyTable("class", "striped");
81 81
 	}
82 82
 
83
-	public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) {
83
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
84 84
 		return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault);
85 85
 	}
86 86
 
87
-	public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) {
88
-		return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
87
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
88
+		return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
89 89
 	}
90 90
 
91
-	public function getOnRow($event, $url, $responseElement = "", $parameters = array()) {
92
-		$jsCondition = '!$(this).closest("tr").is(":focus")';
91
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
92
+		$jsCondition='!$(this).closest("tr").is(":focus")';
93 93
 		if (isset($parameters['jsCondition'])) {
94
-			$jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')';
94
+			$jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')';
95 95
 		}
96
-		$parameters = \array_merge($parameters, [
96
+		$parameters=\array_merge($parameters, [
97 97
 			"stopPropagation" => false,
98 98
 			"preventDefault" => false,
99 99
 			"jsCondition" => $jsCondition
100 100
 		]);
101
-		$selector = "tbody tr";
101
+		$selector="tbody tr";
102 102
 		if (isset($parameters["selector"])) {
103
-			$selector = $parameters["selector"];
103
+			$selector=$parameters["selector"];
104 104
 		}
105
-		return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters);
105
+		return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters);
106 106
 	}
107 107
 
108 108
 	public function onPageChange($jsCode) {
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 		return $this->_self->getBsComponent()->getScript();
120 120
 	}
121 121
 
122
-	public function addEventsOnRun(JsUtils $js = NULL) {
123
-		$script = parent::addEventsOnRun($js);
124
-		$innerScript = $this->_self->getInnerScript();
125
-		if (! isset($innerScript)) {
122
+	public function addEventsOnRun(JsUtils $js=NULL) {
123
+		$script=parent::addEventsOnRun($js);
124
+		$innerScript=$this->_self->getInnerScript();
125
+		if (!isset($innerScript)) {
126 126
 			$this->_self->setInnerScript($script);
127 127
 		}
128 128
 		return $script;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 
41 41
 	public function __construct($identifier, $rowCount, $colCount) {
42 42
 		parent::__construct($identifier, "table", "ui table");
43
-		$this->content=array ();
43
+		$this->content=array();
44 44
 		$this->setRowCount($rowCount, $colCount);
45
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
46
-		$this->_compileParts=["thead","tbody","tfoot"];
45
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
46
+		$this->_compileParts=["thead", "tbody", "tfoot"];
47 47
 		$this->_afterCompileEvents=[];
48 48
 	}
49 49
 
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	 * @return HtmlTableContent
54 54
 	 */
55 55
 	public function getPart($key) {
56
-		if (\array_key_exists($key, $this->content) === false) {
56
+		if (\array_key_exists($key, $this->content)===false) {
57 57
 			$this->content[$key]=new HtmlTableContent("", $key);
58
-			if ($key !== "tbody") {
58
+			if ($key!=="tbody") {
59 59
 				$this->content[$key]->setRowCount(1, $this->_colCount);
60 60
 			}
61 61
 		}
62 62
 		return $this->content[$key];
63 63
 	}
64 64
 
65
-	protected function _getFirstPart(){
66
-		if(isset($this->content["thead"])){
65
+	protected function _getFirstPart() {
66
+		if (isset($this->content["thead"])) {
67 67
 			return $this->content["thead"];
68 68
 		}
69 69
 		return $this->content["tbody"];
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return boolean
109 109
 	 */
110 110
 	public function hasPart($key) {
111
-		return \array_key_exists($key, $this->content) === true;
111
+		return \array_key_exists($key, $this->content)===true;
112 112
 	}
113 113
 
114 114
 	/**
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 		return $this->colAlign($colIndex, "colLeftFromRight");
269 269
 	}
270 270
 
271
-	public function setColAlignment($colIndex,$alignment){
272
-		switch ($alignment){
271
+	public function setColAlignment($colIndex, $alignment) {
272
+		switch ($alignment) {
273 273
 			case TextAlignment::LEFT:
274 274
 				$function="colLeft";
275 275
 				break;
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 		return $this;
290 290
 	}
291 291
 	
292
-	public function setColAlignmentFromRight($colIndex,$alignment){
293
-		switch ($alignment){
292
+	public function setColAlignmentFromRight($colIndex, $alignment) {
293
+		switch ($alignment) {
294 294
 			case TextAlignment::LEFT:
295 295
 				$function="colLeftFromRight";
296 296
 				break;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 	private function colAlign($colIndex, $function) {
314 314
 		if (\is_array($colIndex)) {
315
-			foreach ( $colIndex as $cIndex ) {
315
+			foreach ($colIndex as $cIndex) {
316 316
 				$this->colAlign($cIndex, $function);
317 317
 			}
318 318
 		} else {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * @see HtmlSemDoubleElement::compile()
374 374
 	 */
375 375
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
376
-		if(\sizeof($this->_compileParts)<3){
376
+		if (\sizeof($this->_compileParts)<3) {
377 377
 			$this->_template="%content%";
378 378
 			$this->refresh($js);
379 379
 		}
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 	}
383 383
 
384 384
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
385
-		parent::compile_once($js,$view);
385
+		parent::compile_once($js, $view);
386 386
 		if ($this->propertyContains("class", "sortable")) {
387
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
387
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
388 388
 		}
389 389
 	}
390 390
 
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 	public function fromDatabaseObject($object, $function) {
398 398
 		$result=$function($object);
399 399
 		if (\is_array($result)) {
400
-			$result= $this->addRow($function($object));
400
+			$result=$this->addRow($function($object));
401 401
 		} else {
402
-			$result= $this->getBody()->_addRow($result);
402
+			$result=$this->getBody()->_addRow($result);
403 403
 		}
404
-		if(isset($this->_afterCompileEvents["onNewRow"])){
405
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
406
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
404
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
405
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
406
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
407 407
 		}
408 408
 		return $result;
409 409
 	}
@@ -418,26 +418,26 @@  discard block
 block discarded – undo
418 418
 		return $this;
419 419
 	}
420 420
 	
421
-	public function refreshTR(){
421
+	public function refreshTR() {
422 422
 		$this->setCompileParts();
423 423
 		$this->getPart("tbody")->refreshTR();
424 424
 	}
425 425
 
426
-	public function refresh($js){
426
+	public function refresh($js) {
427 427
 		$this->_footer=$this->getFooter();
428
-		if(isset($js)){
429
-			$js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");',true);
428
+		if (isset($js)) {
429
+			$js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");', true);
430 430
 		}
431 431
 	}
432 432
 
433
-	public function run(JsUtils $js){
434
-		if(!$this->_runned){
435
-			if(isset($this->_activeRowSelector)){
433
+	public function run(JsUtils $js) {
434
+		if (!$this->_runned) {
435
+			if (isset($this->_activeRowSelector)) {
436 436
 				$this->_activeRowSelector->run();
437 437
 			}
438 438
 		}
439
-		$result= parent::run($js);
440
-		if(isset($this->_footer))
439
+		$result=parent::run($js);
440
+		if (isset($this->_footer))
441 441
 			$this->_footer->run($js);
442 442
 		$this->_runned=true;
443 443
 		return $result;
@@ -461,51 +461,51 @@  discard block
 block discarded – undo
461 461
 	 * @param boolean $multiple
462 462
 	 * @return HtmlTable
463 463
 	 */
464
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
465
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
464
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
465
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
466 466
 		return $this;
467 467
 	}
468 468
 	
469
-	public function hasActiveRowSelector(){
469
+	public function hasActiveRowSelector() {
470 470
 		return isset($this->_activeRowSelector);
471 471
 	}
472 472
 
473
-	public function hideColumn($colIndex){
474
-		if(isset($this->content["thead"])){
473
+	public function hideColumn($colIndex) {
474
+		if (isset($this->content["thead"])) {
475 475
 			$this->content["thead"]->hideColumn($colIndex);
476 476
 		}
477 477
 		$this->content["tbody"]->hideColumn($colIndex);
478
-		if(isset($this->content["tfoot"])){
478
+		if (isset($this->content["tfoot"])) {
479 479
 			$this->content["tfoot"]->hideColumn($colIndex);
480 480
 		}
481 481
 		return $this;
482 482
 	}
483 483
 
484
-	public function setColWidth($colIndex,$width){
484
+	public function setColWidth($colIndex, $width) {
485 485
 		$part=$this->_getFirstPart();
486
-		if($part!==null && $part->count()>0)
486
+		if ($part!==null && $part->count()>0)
487 487
 			$part->getCell(0, $colIndex)->setWidth($width);
488 488
 		return $this;
489 489
 	}
490 490
 
491
-	public function setColWidths($widths){
491
+	public function setColWidths($widths) {
492 492
 		$part=$this->_getFirstPart();
493
-		if($part!==null && $part->count()>0){
493
+		if ($part!==null && $part->count()>0) {
494 494
 			$count=$part->getColCount();
495
-			if(!\is_array($widths)){
495
+			if (!\is_array($widths)) {
496 496
 				$widths=\array_fill(0, $count, $widths);
497 497
 			}
498
-			$max=\min(\sizeof($widths),$count);
499
-			for($i=0;$i<$max;$i++){
498
+			$max=\min(\sizeof($widths), $count);
499
+			for ($i=0; $i<$max; $i++) {
500 500
 				$part->getCell(0, $i)->setWidth($widths[$i]);
501 501
 			}
502 502
 		}
503 503
 		return $this;
504 504
 	}
505 505
 
506
-	public function mergeIdentiqualValues($colIndex,$function="strip_tags"){
506
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
507 507
 		$body=$this->getBody();
508
-		$body->mergeIdentiqualValues($colIndex,$function);
508
+		$body->mergeIdentiqualValues($colIndex, $function);
509 509
 		return $this;
510 510
 	}
511 511
 	/**
@@ -519,16 +519,16 @@  discard block
 block discarded – undo
519 519
 	 * @param mixed $_innerScript
520 520
 	 */
521 521
 	public function setInnerScript($_innerScript) {
522
-		$this->_innerScript = $_innerScript;
522
+		$this->_innerScript=$_innerScript;
523 523
 	}
524 524
 	
525
-	public function onActiveRowChange($jsCode){
526
-		$this->on("activeRowChange",$jsCode);
525
+	public function onActiveRowChange($jsCode) {
526
+		$this->on("activeRowChange", $jsCode);
527 527
 		return $this;
528 528
 	}
529 529
 	
530
-	public function addMergeRow($colCount,$value=null){
531
-		return $this->getBody()->addMergeRow($colCount,$value);
530
+	public function addMergeRow($colCount, $value=null) {
531
+		return $this->getBody()->addMergeRow($colCount, $value);
532 532
 	}
533 533
 
534 534
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlRail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  */
11 11
 class HtmlRail extends HtmlSemDoubleElement {
12 12
 
13
-	public function __construct($identifier, $content = NULL) {
13
+	public function __construct($identifier, $content=NULL) {
14 14
 		parent::__construct($identifier, 'div', 'ui rail', $content);
15 15
 	}
16 16
 
Please login to merge, or discard this patch.
Ajax/semantic/traits/SemanticHtmlElementsTrait.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param string $onClick
46 46
 	 * @return HtmlButton
47 47
 	 */
48
-	public function htmlButton($identifier, $value = null, $cssStyle = null, $onClick = null) {
48
+	public function htmlButton($identifier, $value=null, $cssStyle=null, $onClick=null) {
49 49
 		return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick));
50 50
 	}
51 51
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param boolean $asIcons
60 60
 	 * @return HtmlButtonGroups
61 61
 	 */
62
-	public function htmlButtonGroups($identifier, $elements = array(), $asIcons = false) {
62
+	public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) {
63 63
 		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons));
64 64
 	}
65 65
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param string $content
73 73
 	 * @return HtmlContainer
74 74
 	 */
75
-	public function htmlContainer($identifier, $content = "") {
75
+	public function htmlContainer($identifier, $content="") {
76 76
 		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
77 77
 	}
78 78
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @param string $content
86 86
 	 * @return HtmlDivider
87 87
 	 */
88
-	public function htmlDivider($identifier, $content = "", $tagName = "div") {
88
+	public function htmlDivider($identifier, $content="", $tagName="div") {
89 89
 		return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName));
90 90
 	}
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param string $type
101 101
 	 * @return HtmlHeader
102 102
 	 */
103
-	public function htmlHeader($identifier, $niveau = 1, $content = NULL, $type = "page") {
103
+	public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") {
104 104
 		return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type));
105 105
 	}
106 106
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @param string $size
129 129
 	 * @return HtmlImage
130 130
 	 */
131
-	public function htmlImage($identifier, $src = "", $alt = "", $size = NULL) {
131
+	public function htmlImage($identifier, $src="", $alt="", $size=NULL) {
132 132
 		return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size));
133 133
 	}
134 134
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param string $size
143 143
 	 * @return HtmlIconGroups
144 144
 	 */
145
-	public function htmlIconGroups($identifier, $icons = array(), $size = "") {
145
+	public function htmlIconGroups($identifier, $icons=array(), $size="") {
146 146
 		return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size));
147 147
 	}
148 148
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param string $placeholder
158 158
 	 * @return HtmlInput
159 159
 	 */
160
-	public function htmlInput($identifier, $type = "text", $value = "", $placeholder = "") {
160
+	public function htmlInput($identifier, $type="text", $value="", $placeholder="") {
161 161
 		return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder));
162 162
 	}
163 163
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param string $tagName
172 172
 	 * @return HtmlLabel
173 173
 	 */
174
-	public function htmlLabel($identifier, $content = "", $icon = NULL, $tagName = "div") {
174
+	public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") {
175 175
 		return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName));
176 176
 	}
177 177
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @param array $attributes
183 183
 	 * @return HtmlLabelGroups
184 184
 	 */
185
-	public function htmlLabelGroups($identifier, $labels = array(), $attributes = array()) {
185
+	public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) {
186 186
 		return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes));
187 187
 	}
188 188
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @param array $items
194 194
 	 * @return HtmlList
195 195
 	 */
196
-	public function htmlList($identifier, $items = array()) {
196
+	public function htmlList($identifier, $items=array()) {
197 197
 		return $this->addHtmlComponent(new HtmlList($identifier, $items));
198 198
 	}
199 199
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @param string $content
205 205
 	 * @return HtmlSegment
206 206
 	 */
207
-	public function htmlSegment($identifier, $content = "") {
207
+	public function htmlSegment($identifier, $content="") {
208 208
 		return $this->addHtmlComponent(new HtmlSegment($identifier, $content));
209 209
 	}
210 210
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 *        	the segments
217 217
 	 * @return HtmlSegmentGroups
218 218
 	 */
219
-	public function htmlSegmentGroups($identifier, $items = array()) {
219
+	public function htmlSegmentGroups($identifier, $items=array()) {
220 220
 		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items));
221 221
 	}
222 222
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @param Direction|string $attributeType
231 231
 	 * @return HtmlReveal
232 232
 	 */
233
-	public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type = RevealType::FADE, $attributeType = NULL) {
233
+	public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) {
234 234
 		return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType));
235 235
 	}
236 236
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @param array $steps
242 242
 	 * @return HtmlStep
243 243
 	 */
244
-	public function htmlStep($identifier, $steps = array()) {
244
+	public function htmlStep($identifier, $steps=array()) {
245 245
 		return $this->addHtmlComponent(new HtmlStep($identifier, $steps));
246 246
 	}
247 247
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 * @param mixed $content
276 276
 	 * @return HtmlRail
277 277
 	 */
278
-	public function htmlRail($identifier, $content = null) {
278
+	public function htmlRail($identifier, $content=null) {
279 279
 		return $this->addHtmlComponent(new HtmlRail($identifier, $content));
280 280
 	}
281 281
 }
Please login to merge, or discard this patch.
Ajax/common/html/HtmlDoubleElement.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	protected $content;
15 15
 
16
-	protected $wrapContentBefore = "";
16
+	protected $wrapContentBefore="";
17 17
 
18
-	protected $wrapContentAfter = "";
18
+	protected $wrapContentAfter="";
19 19
 
20 20
 	protected $_editableContent;
21 21
 
22
-	public function __construct($identifier, $tagName = "p") {
22
+	public function __construct($identifier, $tagName="p") {
23 23
 		parent::__construct($identifier, $tagName);
24
-		$this->_template = '<%tagName% id="%identifier%" %properties%>%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>';
24
+		$this->_template='<%tagName% id="%identifier%" %properties%>%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>';
25 25
 	}
26 26
 
27 27
 	public function setContent($content) {
28
-		$this->content = $content;
28
+		$this->content=$content;
29 29
 		return $this;
30 30
 	}
31 31
 
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 		return $this->content;
34 34
 	}
35 35
 
36
-	public function addContent($content, $before = false) {
37
-		if (! \is_array($this->content)) {
36
+	public function addContent($content, $before=false) {
37
+		if (!\is_array($this->content)) {
38 38
 			if (isset($this->content))
39
-				$this->content = array(
39
+				$this->content=array(
40 40
 					$this->content
41 41
 				);
42 42
 			else
43
-				$this->content = array();
43
+				$this->content=array();
44 44
 		}
45 45
 		if ($before)
46 46
 			\array_unshift($this->content, $content);
47 47
 		else
48
-			$this->content[] = $content;
48
+			$this->content[]=$content;
49 49
 		return $this;
50 50
 	}
51 51
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 
69 69
 	public function setValue($value) {}
70 70
 
71
-	public function wrapContent($before, $after = "") {
72
-		$this->wrapContentBefore .= $before;
73
-		$this->wrapContentAfter = $after . $this->wrapContentAfter;
71
+	public function wrapContent($before, $after="") {
72
+		$this->wrapContentBefore.=$before;
73
+		$this->wrapContentAfter=$after.$this->wrapContentAfter;
74 74
 		return $this;
75 75
 	}
76 76
 
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 	protected function _getContentInstances($class, $content) {
92
-		$instances = [];
92
+		$instances=[];
93 93
 		if ($content instanceof $class) {
94
-			$instances[] = $content;
94
+			$instances[]=$content;
95 95
 		} elseif ($content instanceof HtmlDoubleElement) {
96
-			$instances = \array_merge($instances, $content->getContentInstances($class));
96
+			$instances=\array_merge($instances, $content->getContentInstances($class));
97 97
 		} elseif (\is_array($content)) {
98 98
 			foreach ($content as $element) {
99
-				$instances = \array_merge($instances, $this->_getContentInstances($class, $element));
99
+				$instances=\array_merge($instances, $this->_getContentInstances($class, $element));
100 100
 			}
101 101
 		}
102 102
 		return $instances;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return HtmlDoubleElement
109 109
 	 */
110
-	public function asLink($href = NULL, $target = NULL) {
110
+	public function asLink($href=NULL, $target=NULL) {
111 111
 		if (isset($href))
112 112
 			$this->setProperty("href", $href);
113 113
 		if (isset($target))
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 		return \strip_tags($this->content);
123 123
 	}
124 124
 
125
-	public function asEditable(HtmlFormField $field, $asForm = false, $setValueProperty = "val()") {
126
-		$idF = $field->getIdentifier();
127
-		$idE = $idF;
125
+	public function asEditable(HtmlFormField $field, $asForm=false, $setValueProperty="val()") {
126
+		$idF=$field->getIdentifier();
127
+		$idE=$idF;
128 128
 		if ($asForm) {
129
-			$frm = new HtmlForm("frm-" . $field->getIdentifier());
129
+			$frm=new HtmlForm("frm-".$field->getIdentifier());
130 130
 			$frm->setProperty("onsubmit", "return false;");
131
-			$fields = $frm->addFields();
132
-			$idE = $frm->getIdentifier();
131
+			$fields=$frm->addFields();
132
+			$idE=$frm->getIdentifier();
133 133
 			$fields->addItem($field);
134
-			$fields->addButtonIcon("bt-okay", "check", "green mini", "\$('#" . $idE . "').trigger('validate',{value: $('#'+idF+' input').val()});");
135
-			$fields->addButtonIcon("bt-cancel", "close", "mini", "\$('#" . $idE . "').trigger('endEdit');");
136
-			$this->_editableContent = $frm;
137
-			$keypress = "";
138
-			$focusOut = "";
134
+			$fields->addButtonIcon("bt-okay", "check", "green mini", "\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});");
135
+			$fields->addButtonIcon("bt-cancel", "close", "mini", "\$('#".$idE."').trigger('endEdit');");
136
+			$this->_editableContent=$frm;
137
+			$keypress="";
138
+			$focusOut="";
139 139
 		} else {
140
-			$focusOut = "if(e.relatedTarget==null)elm.trigger('endEdit');";
141
-			$this->_editableContent = $field;
142
-			$keypress = "$('#" . $idF . "').keyup(function(e){if(e.which == 13) {\$('#" . $idE . "').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#" . $idE . "').trigger('endEdit');}});";
140
+			$focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');";
141
+			$this->_editableContent=$field;
142
+			$keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});";
143 143
 		}
144 144
 		$this->_editableContent->setProperty("style", "display:none;");
145
-		$this->onCreate("let idF='" . $idF . "';let idE='" . $idE . "';let elm=$('#'+idE);let self=$('#" . $this->getIdentifier() . "');" . $keypress . "elm.on('validate',function(){self.html($('#'+idE+' input')." . $setValueProperty . ");elm.trigger('endEdit');});elm.on('endEdit',function(){self.show();$(this).hide();});elm.focusout(function(e){" . $focusOut . "});");
146
-		$this->onClick("let self=$(this);self.hide();" . $field->setJsContent("self.html()") . ";$('#" . $idF . " input').trigger('change');elm.show();$('#'+idE+' input').focus();");
145
+		$this->onCreate("let idF='".$idF."';let idE='".$idE."';let elm=$('#'+idE);let self=$('#".$this->getIdentifier()."');".$keypress."elm.on('validate',function(){self.html($('#'+idE+' input').".$setValueProperty.");elm.trigger('endEdit');});elm.on('endEdit',function(){self.show();$(this).hide();});elm.focusout(function(e){".$focusOut."});");
146
+		$this->onClick("let self=$(this);self.hide();".$field->setJsContent("self.html()").";$('#".$idF." input').trigger('change');elm.show();$('#'+idE+' input').focus();");
147 147
 	}
148 148
 
149 149
 	/**
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * {@inheritdoc}
152 152
 	 * @see \Ajax\common\html\BaseHtml::compile_once()
153 153
 	 */
154
-	protected function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL) {
155
-		if (! $this->_compiled && isset($this->_editableContent)) {
154
+	protected function compile_once(\Ajax\JsUtils $js=NULL, &$view=NULL) {
155
+		if (!$this->_compiled && isset($this->_editableContent)) {
156 156
 			$this->wrap("", $this->_editableContent);
157 157
 		}
158 158
 		parent::compile_once($js, $view);
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -14,44 +14,44 @@  discard block
 block discarded – undo
14 14
  */
15 15
 abstract class HtmlCollection extends HtmlDoubleElement {
16 16
 
17
-	public function __construct($identifier,$tagName="div"){
18
-		parent::__construct($identifier,$tagName);
17
+	public function __construct($identifier, $tagName="div") {
18
+		parent::__construct($identifier, $tagName);
19 19
 		$this->content=array();
20 20
 	}
21 21
 
22
-	public function addItems($items){
23
-		if(JArray::isAssociative($items)){
24
-			foreach ($items as $k=>$v){
25
-				$this->addItem([$k,$v]);
22
+	public function addItems($items) {
23
+		if (JArray::isAssociative($items)) {
24
+			foreach ($items as $k=>$v) {
25
+				$this->addItem([$k, $v]);
26 26
 			}
27
-		}else{
28
-			foreach ($items as $item){
27
+		} else {
28
+			foreach ($items as $item) {
29 29
 				$this->addItem($item);
30 30
 			}
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function setItems($items){
35
+	public function setItems($items) {
36 36
 		$this->content=$items;
37 37
 		return $this;
38 38
 	}
39 39
 
40
-	public function getItems(){
40
+	public function getItems() {
41 41
 		return $this->content;
42 42
 	}
43 43
 
44
-	protected function getItemToAdd($item){
44
+	protected function getItemToAdd($item) {
45 45
 		$itemO=$item;
46
-		if($this->createCondition($item)===true){
46
+		if ($this->createCondition($item)===true) {
47 47
 			$itemO=$this->createItem($item);
48 48
 		}
49 49
 		return $itemO;
50 50
 	}
51 51
 
52
-	protected function setItemIdentifier($item,$classname,$index){
53
-		if($item instanceof BaseWidget){
54
-			if(JString::isNull($item->getIdentifier())){
52
+	protected function setItemIdentifier($item, $classname, $index) {
53
+		if ($item instanceof BaseWidget) {
54
+			if (JString::isNull($item->getIdentifier())) {
55 55
 				$item->setIdentifier($classname."-".$this->identifier."-".$index);
56 56
 			}
57 57
 		}
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param HtmlDoubleElement|string|array $item
63 63
 	 * @return \Ajax\common\html\HtmlDoubleElement
64 64
 	 */
65
-	public function addItem($item){
65
+	public function addItem($item) {
66 66
 		$itemO=$this->getItemToAdd($item);
67 67
 		$this->addContent($itemO);
68 68
 		return $itemO;
69 69
 	}
70 70
 
71
-	public function insertItem($item,$position=0){
71
+	public function insertItem($item, $position=0) {
72 72
 		$itemO=$this->getItemToAdd($item);
73
-		\array_splice( $this->content, $position, 0, array($itemO));
73
+		\array_splice($this->content, $position, 0, array($itemO));
74 74
 		return $itemO;
75 75
 	}
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return \Ajax\common\html\HtmlDoubleElement
81 81
 	 */
82 82
 	public function getItem($index) {
83
-		if (is_int($index)&& isset($this->content[$index]))
83
+		if (is_int($index) && isset($this->content[$index]))
84 84
 			return $this->content[$index];
85 85
 		else {
86 86
 			$elm=$this->getElementById($index, $this->content);
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 		return $this;
94 94
 	}
95 95
 
96
-	public function removeItem($index){
96
+	public function removeItem($index) {
97 97
 		return array_splice($this->content, $index, 1);
98 98
 	}
99 99
 
100
-	public function count(){
100
+	public function count() {
101 101
 		return \sizeof($this->content);
102 102
 	}
103 103
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 		return $this->addItem($function($object));
109 109
 	}
110 110
 
111
-	public function apply($callBack){
112
-		foreach ($this->content as $item){
111
+	public function apply($callBack) {
112
+		foreach ($this->content as $item) {
113 113
 			$callBack($item);
114 114
 		}
115 115
 		return $this;
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	abstract protected function createItem($value);
131 131
 
132
-	protected function createCondition($value){
132
+	protected function createCondition($value) {
133 133
 		return !($value instanceof BaseHtml);
134 134
 	}
135 135
 
136
-	protected function contentAs($tagName){
137
-		foreach ($this->content as $item){
136
+	protected function contentAs($tagName) {
137
+		foreach ($this->content as $item) {
138 138
 			$item->setTagName($tagName);
139 139
 		}
140 140
 		return $this;
141 141
 	}
142 142
 
143
-	public function setProperties($properties){
143
+	public function setProperties($properties) {
144 144
 		$i=0;
145
-		foreach ($properties as $k=>$v){
145
+		foreach ($properties as $k=>$v) {
146 146
 			$c=$this->content[$i++];
147
-			if(isset($c))
148
-				$c->setProperty($k,$v);
147
+			if (isset($c))
148
+				$c->setProperty($k, $v);
149 149
 			else
150 150
 				return $this;
151 151
 		}
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
 	 * @param array|mixed $values
159 159
 	 * @return $this
160 160
 	 */
161
-	public function setPropertyValues($property,$values){
162
-		if(\is_array($values)===false){
163
-			$values=\array_fill(0, $this->count(),$values);
161
+	public function setPropertyValues($property, $values) {
162
+		if (\is_array($values)===false) {
163
+			$values=\array_fill(0, $this->count(), $values);
164 164
 		}
165
-		foreach ($values as $i=>$value){
166
-			if(isset($this->content[$i])){
167
-				$this->content[$i]->setProperty($property,$value);
165
+		foreach ($values as $i=>$value) {
166
+			if (isset($this->content[$i])) {
167
+				$this->content[$i]->setProperty($property, $value);
168 168
 			}
169
-			else{
169
+			else {
170 170
 				return $this;
171 171
 			}
172 172
 		}
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	 * @param array|mixed $values
180 180
 	 * @return $this
181 181
 	 */
182
-	public function addPropertyValues($property,$values){
183
-		if(\is_array($values)===false){
184
-			$values=\array_fill(0, $this->count(),$values);
182
+	public function addPropertyValues($property, $values) {
183
+		if (\is_array($values)===false) {
184
+			$values=\array_fill(0, $this->count(), $values);
185 185
 		}
186
-		foreach ($values as $i=>$value){
187
-			if(isset($this->content[$i])){
188
-				$this->content[$i++]->addToProperty($property,$value);
186
+		foreach ($values as $i=>$value) {
187
+			if (isset($this->content[$i])) {
188
+				$this->content[$i++]->addToProperty($property, $value);
189 189
 			}
190
-			else{
190
+			else {
191 191
 				return $this;
192 192
 			}
193 193
 		}
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
198 198
 		$index=0;
199 199
 		$classname=\strtolower(JReflection::shortClassName($this));
200
-		foreach ($this->content as $item){
201
-			$this->setItemIdentifier($item,$classname,$index++);
200
+		foreach ($this->content as $item) {
201
+			$this->setItemIdentifier($item, $classname, $index++);
202 202
 		}
203
-		return parent::compile($js,$view);
203
+		return parent::compile($js, $view);
204 204
 	}
205 205
 
206
-	public function getItemById($identifier){
206
+	public function getItemById($identifier) {
207 207
 		return $this->getElementById($identifier, $this->content);
208 208
 	}
209 209
 
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 	 * @param string $target
213 213
 	 * @return HtmlCollection
214 214
 	 */
215
-	public function asLinks($hrefs=[],$target=NUll) {
216
-		foreach ( $this->content as $index=>$item ) {
217
-			if($item instanceof HtmlDoubleElement){
215
+	public function asLinks($hrefs=[], $target=NUll) {
216
+		foreach ($this->content as $index=>$item) {
217
+			if ($item instanceof HtmlDoubleElement) {
218 218
 				$href="";
219
-				if(isset($hrefs[$index]))
219
+				if (isset($hrefs[$index]))
220 220
 					$href=$hrefs[$index];
221
-				$item->asLink($href,$target);
221
+				$item->asLink($href, $target);
222 222
 			}
223 223
 		}
224 224
 		return $this;
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 * @param int $length  If length is omitted, removes everything from offset to the end of the array. If length is specified and is positive, then that many elements will be removed. If length is specified and is negative then the end of the removed portion will be that many elements from the end of the array. If length is specified and is zero, no elements will be removed. Tip: to remove everything from offset to the end of the array when replacement is also specified, use count($input) for length. 
231 231
 	 * @return $this
232 232
 	 */
233
-	public function splice($offset,$length=null){
234
-		$this->content=array_slice($this->content, $offset,$length);
233
+	public function splice($offset, $length=null) {
234
+		$this->content=array_slice($this->content, $offset, $length);
235 235
 		return $this;
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @author jc
16 16
  *
17 17
  */
18
-trait FormTrait{
18
+trait FormTrait {
19 19
 
20 20
 	/**
21 21
 	 * @return HtmlForm
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
 	abstract protected function getForm();
24 24
 	
25 25
 
26
-	protected function addCompoValidation(Form $compo,HtmlFormField $field){
26
+	protected function addCompoValidation(Form $compo, HtmlFormField $field) {
27 27
 		$validation=$field->getValidation();
28
-		if(isset($validation)){
28
+		if (isset($validation)) {
29 29
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
30 30
 			$compo->addFieldValidation($validation);
31 31
 		}
32 32
 	}
33 33
 	
34
-	protected function addExtraCompoValidation(Form $compo,FieldValidation $validation){
34
+	protected function addExtraCompoValidation(Form $compo, FieldValidation $validation) {
35 35
 		$compo->addFieldValidation($validation);
36 36
 	}
37 37
 
38
-	protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){
38
+	protected function _runValidationParams(Form &$compo, JsUtils $js=NULL) {
39 39
 		$form=$this->getForm();
40 40
 		$params=$form->getValidationParams();
41
-		if(isset($params["_ajaxSubmit"])){
42
-			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js);
41
+		if (isset($params["_ajaxSubmit"])) {
42
+			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js);
43 43
 			$this->onSuccess($compilation);
44 44
 			$form->removeValidationParam("_ajaxSubmit");
45 45
 		}
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 		$form->addEventsOnRun($js);
49 49
 	}
50 50
 
51
-	protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){
51
+	protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) {
52 52
 		$compilation="";
53
-		if(\is_array($ajaxSubmit)){
54
-			foreach ($ajaxSubmit as $ajaxSubmitItem){
53
+		if (\is_array($ajaxSubmit)) {
54
+			foreach ($ajaxSubmit as $ajaxSubmitItem) {
55 55
 				$compilation.=$ajaxSubmitItem->compile($js);
56 56
 			}
57
-		}elseif($ajaxSubmit instanceof AjaxCall){
57
+		}elseif ($ajaxSubmit instanceof AjaxCall) {
58 58
 			$compilation=$ajaxSubmit->compile($js);
59 59
 		}
60
-		$compilation=str_ireplace("\"","%quote%", $compilation);
60
+		$compilation=str_ireplace("\"", "%quote%", $compilation);
61 61
 		return $compilation;
62 62
 	}
63 63
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		return $this;
71 71
 	}
72 72
 
73
-	public function setAttached($value=true){
73
+	public function setAttached($value=true) {
74 74
 		$form=$this->getForm();
75
-		if($value)
76
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
75
+		if ($value)
76
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
77 77
 		return $form;
78 78
 	}
79 79
 
80
-	public function addErrorMessage(){
80
+	public function addErrorMessage() {
81 81
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
82 82
 	}
83 83
 
@@ -93,48 +93,48 @@  discard block
 block discarded – undo
93 93
 	 * @param array $parameters
94 94
 	 * @return HtmlForm
95 95
 	 */
96
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
96
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
97 97
 		$form=$this->getForm();
98
-		if($identifierOrElement  instanceof BaseHtml)
98
+		if ($identifierOrElement  instanceof BaseHtml)
99 99
 			$elem=$identifierOrElement;
100 100
 		else
101 101
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
102
-		if(isset($elem)){
103
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
102
+		if (isset($elem)) {
103
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
104 104
 		}
105 105
 		return $form;
106 106
 	}
107 107
 
108
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
109
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
108
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
109
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
110 110
 	}
111 111
 
112
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
113
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
114
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
112
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
113
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
114
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
115 115
 	}
116 116
 
117
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
117
+	protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
118 118
 		$form=$this->getForm();
119
-		if(isset($url) && isset($responseElement)){
120
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
121
-			$this->setSubmitParams($url,$responseElement,$parameters);
119
+		if (isset($url) && isset($responseElement)) {
120
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
121
+			$this->setSubmitParams($url, $responseElement, $parameters);
122 122
 		}
123 123
 		return $button;
124 124
 	}
125 125
 
126
-	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
126
+	public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) {
127 127
 		$form=$this->getForm();
128
-		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
129
-		if(\is_array($parameters)){
130
-			$params=\array_merge($params,$parameters);
128
+		$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
129
+		if (\is_array($parameters)) {
130
+			$params=\array_merge($params, $parameters);
131 131
 		}
132 132
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
133 133
 		return $this;
134 134
 	}
135 135
 
136
-	public function addReset($identifier,$value,$cssStyle=NULL){
137
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
136
+	public function addReset($identifier, $value, $cssStyle=NULL) {
137
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
138 138
 		$bt->setProperty("type", "reset");
139 139
 		return $bt;
140 140
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $jsCode
145 145
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
146 146
 	 */
147
-	public function onValid($jsCode){
147
+	public function onValid($jsCode) {
148 148
 		$form=$this->getForm();
149 149
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
150 150
 		return $form;
@@ -155,35 +155,35 @@  discard block
 block discarded – undo
155 155
 	 * @param string $jsCode can use event and fields parameters
156 156
 	 * @return HtmlForm
157 157
 	 */
158
-	public function onSuccess($jsCode){
158
+	public function onSuccess($jsCode) {
159 159
 		$form=$this->getForm();
160
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
160
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
161 161
 		return $form;
162 162
 	}
163 163
 	
164
-	public function addExtraFieldRules($fieldname,$rules){
164
+	public function addExtraFieldRules($fieldname, $rules) {
165 165
 		$form=$this->getForm();
166 166
 		$fv=$form->getExtraFieldValidation($fieldname);
167
-		foreach ($rules as $rule){
167
+		foreach ($rules as $rule) {
168 168
 			$fv->addRule($rule);
169 169
 		}
170 170
 	}
171 171
 	
172
-	public function addExtraFieldRule($fieldname,$type,$prompt=NULL,$value=NULL){
172
+	public function addExtraFieldRule($fieldname, $type, $prompt=NULL, $value=NULL) {
173 173
 		$form=$this->getForm();
174 174
 		$fv=$form->getExtraFieldValidation($fieldname);
175
-		$fv->addRule($type,$prompt,$value);
175
+		$fv->addRule($type, $prompt, $value);
176 176
 	}
177 177
 	
178
-	public function setOptional($fieldname,$optional=true){
178
+	public function setOptional($fieldname, $optional=true) {
179 179
 		$form=$this->getForm();
180 180
 		$fv=$form->getExtraFieldValidation($fieldname);
181 181
 		$fv->setOptional($optional);
182 182
 	}
183 183
 
184
-	public function setActionTarget(string $action, string $target){
184
+	public function setActionTarget(string $action, string $target) {
185 185
 		$form=$this->getForm();
186
-		$form->setProperty('data-target',$target);
187
-		$form->setProperty('action',$action);
186
+		$form->setProperty('data-target', $target);
187
+		$form->setProperty('action', $action);
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  */
27 27
 class DataTable extends Widget {
28
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait;
28
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait;
29 29
 
30 30
 	protected $_searchField;
31 31
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	protected $_displayBehavior;
43 43
 
44
-	protected $_visibleHover = false;
44
+	protected $_visibleHover=false;
45 45
 
46 46
 	protected $_targetSelector;
47 47
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected $_json;
53 53
 
54
-	protected $_rowClass = "_element";
54
+	protected $_rowClass="_element";
55 55
 
56 56
 	protected $_sortable;
57 57
 
@@ -61,26 +61,26 @@  discard block
 block discarded – undo
61 61
 
62 62
 	protected $_paginationToolbar;
63 63
 
64
-	public function __construct($identifier, $model, $modelInstance = NULL) {
64
+	public function __construct($identifier, $model, $modelInstance=NULL) {
65 65
 		parent::__construct($identifier, $model, $modelInstance);
66 66
 		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
67
-		$this->_urls = [];
68
-		$this->_emptyMessage = new HtmlMessage("", "nothing to display");
67
+		$this->_urls=[];
68
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
69 69
 		$this->_emptyMessage->setIcon("info circle");
70 70
 	}
71 71
 
72 72
 	public function run(JsUtils $js) {
73
-		if ($this->_runned !== true) {
74
-			$offset = $js->scriptCount();
73
+		if ($this->_runned!==true) {
74
+			$offset=$js->scriptCount();
75 75
 			if ($this->_hasCheckboxes && isset($js)) {
76 76
 				$this->_runCheckboxes($js);
77 77
 			}
78 78
 			if ($this->_visibleHover) {
79
-				$js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
79
+				$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
80 80
 					"preventDefault" => false,
81 81
 					"stopPropagation" => true
82 82
 				]);
83
-				$js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
83
+				$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
84 84
 					"preventDefault" => false,
85 85
 					"stopPropagation" => true
86 86
 				]);
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 			if (isset($this->_pagination))
97 97
 				$this->_associatePaginationBehavior($js, $offset);
98 98
 			$this->_associateSearchFieldBehavior($js, $offset);
99
-			$this->_runned = true;
99
+			$this->_runned=true;
100 100
 		}
101 101
 	}
102 102
 
103 103
 	protected function _generateBehavior($op, $params, JsUtils $js) {
104 104
 		if (isset($this->_urls[$op])) {
105
-			$params = \array_merge($params, [
105
+			$params=\array_merge($params, [
106 106
 				"attr" => "data-ajax"
107 107
 			]);
108
-			$js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params);
108
+			$js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params);
109 109
 		}
110 110
 	}
111 111
 
@@ -124,21 +124,21 @@  discard block
 block discarded – undo
124 124
 	}
125 125
 
126 126
 	public function refreshTD($fieldName, $jquery, $view) {
127
-		$index = $this->_getIndex($fieldName);
127
+		$index=$this->_getIndex($fieldName);
128 128
 		$this->compile($jquery, $view);
129 129
 		return $this->refreshTR()
130 130
 			->getTable()
131 131
 			->getCell(0, $index);
132 132
 	}
133 133
 
134
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
135
-		if (! $this->_generated) {
134
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
135
+		if (!$this->_generated) {
136 136
 			if (isset($this->_buttonsColumn)) {
137 137
 				$this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons);
138 138
 			}
139 139
 			$this->_instanceViewer->setInstance($this->_model);
140
-			$captions = $this->_instanceViewer->getCaptions();
141
-			$table = $this->content["table"];
140
+			$captions=$this->_instanceViewer->getCaptions();
141
+			$table=$this->content["table"];
142 142
 			if ($this->_hasCheckboxes) {
143 143
 				$this->_generateMainCheckbox($captions);
144 144
 			}
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 			$this->compileExtraElements($table, $captions);
154 154
 			$this->_compileSearchFieldBehavior($js);
155 155
 
156
-			$this->content = JArray::sortAssociative($this->content, [
156
+			$this->content=JArray::sortAssociative($this->content, [
157 157
 				PositionInTable::BEFORETABLE,
158 158
 				"table",
159 159
 				PositionInTable::AFTERTABLE
160 160
 			]);
161 161
 			$this->_compileForm();
162 162
 			$this->_applyStyleAttributes($table);
163
-			$this->_generated = true;
163
+			$this->_generated=true;
164 164
 		}
165 165
 		return parent::compile($js, $view);
166 166
 	}
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	protected function _generateContent($table) {
208
-		$objects = $this->_modelInstance;
208
+		$objects=$this->_modelInstance;
209 209
 		if (isset($this->_pagination)) {
210
-			$objects = $this->_pagination->getObjects($this->_modelInstance);
210
+			$objects=$this->_pagination->getObjects($this->_modelInstance);
211 211
 		}
212 212
 		InstanceViewer::setIndex(0);
213
-		$fields = $this->_instanceViewer->getSimpleProperties();
214
-		$groupByFields = $this->_instanceViewer->getGroupByFields();
215
-		if (! is_array($groupByFields)) {
216
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) {
213
+		$fields=$this->_instanceViewer->getSimpleProperties();
214
+		$groupByFields=$this->_instanceViewer->getGroupByFields();
215
+		if (!is_array($groupByFields)) {
216
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) {
217 217
 				return $this->_generateRow($instance, $fields, $table);
218 218
 			});
219 219
 		} else {
220
-			$activeValues = array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null));
221
-			$uuids = [];
222
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) {
220
+			$activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null));
221
+			$uuids=[];
222
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) {
223 223
 				$this->_instanceViewer->setInstance($instance);
224 224
 				foreach ($groupByFields as $index => $gbField) {
225 225
 					$this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids);
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 				return $this->_generateRow($instance, $fields, $table, null, $uuids);
228 228
 			});
229 229
 		}
230
-		if ($table->getRowCount() == 0) {
231
-			$result = $table->addRow();
230
+		if ($table->getRowCount()==0) {
231
+			$result=$table->addRow();
232 232
 			$result->mergeRow();
233 233
 			$result->setValues([
234 234
 				$this->_emptyMessage
@@ -237,20 +237,20 @@  discard block
 block discarded – undo
237 237
 	}
238 238
 
239 239
 	protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) {
240
-		$newValue = $this->_instanceViewer->getValue($gbField);
241
-		if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) {
242
-			if ($index == 0) {
243
-				$uuids = [];
240
+		$newValue=$this->_instanceViewer->getValue($gbField);
241
+		if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) {
242
+			if ($index==0) {
243
+				$uuids=[];
244 244
 			}
245
-			$uuid = uniqid("grp");
246
-			$uuids[$gbField] = $uuid;
247
-			$id = $this->_instanceViewer->getIdentifier();
248
-			$result = $table->addMergeRow(sizeof($fields) + 1, $newValue);
249
-			$result->setIdentifier($this->identifier . "-tr-gb-" . $id);
245
+			$uuid=uniqid("grp");
246
+			$uuids[$gbField]=$uuid;
247
+			$id=$this->_instanceViewer->getIdentifier();
248
+			$result=$table->addMergeRow(sizeof($fields)+1, $newValue);
249
+			$result->setIdentifier($this->identifier."-tr-gb-".$id);
250 250
 			$result->setProperty("data-ajax", $id);
251 251
 			$result->setProperty("data-group", $uuid);
252 252
 			$result->addToProperty("class", $this->_rowClass);
253
-			$activeValues[$gbField] = $newValue;
253
+			$activeValues[$gbField]=$newValue;
254 254
 		}
255 255
 	}
256 256
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	public function getFieldValue($index) {
265
-		$index = $this->_getIndex($index);
265
+		$index=$this->_getIndex($index);
266 266
 		if (is_numeric($index)) {
267
-			$values = $this->_instanceViewer->getValues();
267
+			$values=$this->_instanceViewer->getValues();
268 268
 			if (isset($values[$index])) {
269 269
 				return $values[$index];
270 270
 			}
@@ -272,31 +272,31 @@  discard block
 block discarded – undo
272 272
 		return null;
273 273
 	}
274 274
 
275
-	protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) {
275
+	protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) {
276 276
 		$this->_instanceViewer->setInstance($instance);
277
-		InstanceViewer::$index ++;
278
-		$values = $this->_instanceViewer->getValues();
279
-		$id = $this->_instanceViewer->getIdentifier();
280
-		$dataAjax = $id;
281
-		$id = $this->cleanIdentifier($id);
277
+		InstanceViewer::$index++;
278
+		$values=$this->_instanceViewer->getValues();
279
+		$id=$this->_instanceViewer->getIdentifier();
280
+		$dataAjax=$id;
281
+		$id=$this->cleanIdentifier($id);
282 282
 		if ($this->_hasCheckboxes) {
283
-			$ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, "");
284
-			$checked = false;
283
+			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, "");
284
+			$checked=false;
285 285
 			if (isset($this->_checkedCallback)) {
286
-				$func = $this->_checkedCallback;
287
-				$checked = $func($instance);
286
+				$func=$this->_checkedCallback;
287
+				$checked=$func($instance);
288 288
 			}
289 289
 			$ck->setChecked($checked);
290 290
 			// $ck->setOnChange("event.stopPropagation();");
291
-			$field = $ck->getField();
291
+			$field=$ck->getField();
292 292
 			$field->setProperty("value", $dataAjax);
293 293
 			$field->setProperty("name", "selection[]");
294 294
 			if (isset($checkedClass))
295 295
 				$field->setClass($checkedClass);
296 296
 			\array_unshift($values, $ck);
297 297
 		}
298
-		$result = $table->newRow();
299
-		$result->setIdentifier($this->identifier . "-tr-" . $id);
298
+		$result=$table->newRow();
299
+		$result->setIdentifier($this->identifier."-tr-".$id);
300 300
 		$result->setProperty("data-ajax", $dataAjax);
301 301
 		$result->setValues($values);
302 302
 		$result->addToProperty("class", $this->_rowClass);
@@ -309,63 +309,63 @@  discard block
 block discarded – undo
309 309
 
310 310
 	protected function _generatePagination($table) {
311 311
 		if (isset($this->_toolbar)) {
312
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
312
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
313 313
 				$this->_toolbar->setFloated("left");
314 314
 		}
315
-		$footer = $table->getFooter();
315
+		$footer=$table->getFooter();
316 316
 		$footer->mergeCol();
317
-		$this->_paginationToolbar = $this->_pagination->generateMenu($this->identifier);
317
+		$this->_paginationToolbar=$this->_pagination->generateMenu($this->identifier);
318 318
 		$footer->addValues($this->_paginationToolbar);
319 319
 	}
320 320
 
321
-	protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) {
321
+	protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) {
322 322
 		if (isset($this->_urls["refresh"])) {
323
-			$menu = $this->_pagination->getMenu();
323
+			$menu=$this->_pagination->getMenu();
324 324
 			if (isset($menu) && isset($js)) {
325
-				$js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [
325
+				$js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [
326 326
 					"preventDefault" => false,
327 327
 					"jqueryDone" => "replaceWith",
328 328
 					"hasLoader" => false,
329
-					"jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");'
329
+					"jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");'
330 330
 				]);
331
-				$page = $_POST["p"] ?? null;
331
+				$page=$_POST["p"] ?? null;
332 332
 				if (isset($page)) {
333
-					$js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");');
333
+					$js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");');
334 334
 				}
335 335
 			}
336 336
 		}
337 337
 	}
338 338
 
339
-	protected function _compileSearchFieldBehavior(JsUtils $js = NULL) {
339
+	protected function _compileSearchFieldBehavior(JsUtils $js=NULL) {
340 340
 		if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) {
341
-			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [
341
+			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [
342 342
 				"preventDefault" => false,
343 343
 				"jqueryDone" => "replaceWith",
344 344
 				"hasLoader" => "internal",
345
-				"jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);'
345
+				"jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);'
346 346
 			]);
347 347
 		}
348 348
 	}
349 349
 
350
-	protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {}
350
+	protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {}
351 351
 
352 352
 	protected function _getFieldName($index) {
353
-		$fieldName = parent::_getFieldName($index);
353
+		$fieldName=parent::_getFieldName($index);
354 354
 		if (\is_object($fieldName))
355
-			$fieldName = "field-" . $index;
356
-		return $fieldName . "[]";
355
+			$fieldName="field-".$index;
356
+		return $fieldName."[]";
357 357
 	}
358 358
 
359 359
 	protected function _getFieldCaption($index) {
360 360
 		return null;
361 361
 	}
362 362
 
363
-	protected function applyToolbarPosition(string $position, $table, $captions = NULL) {
363
+	protected function applyToolbarPosition(string $position, $table, $captions=NULL) {
364 364
 		switch ($position) {
365 365
 			case PositionInTable::BEFORETABLE:
366 366
 			case PositionInTable::AFTERTABLE:
367
-				if (isset($this->_compileParts) === false) {
368
-					$this->content[$position] = $this->_toolbar;
367
+				if (isset($this->_compileParts)===false) {
368
+					$this->content[$position]=$this->_toolbar;
369 369
 				}
370 370
 				break;
371 371
 			case PositionInTable::HEADER:
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 	}
378 378
 
379
-	protected function _setToolbarPosition($table, $captions = NULL) {
379
+	protected function _setToolbarPosition($table, $captions=NULL) {
380 380
 		if (\is_array($this->_toolbarPosition)) {
381 381
 			foreach ($this->_toolbarPosition as $tbp) {
382 382
 				$this->applyToolbarPosition($tbp, $table, $captions);
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
 	}
403 403
 
404 404
 	private function addToolbarRow($part, $table, $captions) {
405
-		$hasPart = $table->hasPart($part);
405
+		$hasPart=$table->hasPart($part);
406 406
 		if ($hasPart) {
407
-			$row = $table->getPart($part)->addRow(\sizeof($captions));
407
+			$row=$table->getPart($part)->addRow(\sizeof($captions));
408 408
 		} else {
409
-			$row = $table->getPart($part)->getRow(0);
409
+			$row=$table->getPart($part)->getRow(0);
410 410
 		}
411 411
 		$row->mergeCol();
412 412
 		$row->setValues([
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	public function setUrls($urls) {
440 440
 		if (\is_array($urls)) {
441
-			$this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0);
442
-			$this->_urls["edit"] = JArray::getValue($urls, "edit", 1);
443
-			$this->_urls["delete"] = JArray::getValue($urls, "delete", 2);
444
-			$this->_urls["display"] = JArray::getValue($urls, "display", 3);
441
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
442
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
443
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
444
+			$this->_urls["display"]=JArray::getValue($urls, "display", 3);
445 445
 		} else {
446
-			$this->_urls = [
446
+			$this->_urls=[
447 447
 				"refresh" => $urls,
448 448
 				"edit" => $urls,
449 449
 				"delete" => $urls,
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 *        	The number of visible pages in the Pagination component
467 467
 	 * @return DataTable
468 468
 	 */
469
-	public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) {
470
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
469
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
470
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
471 471
 		return $this;
472 472
 	}
473 473
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 *        	The number of visible pages in the Pagination component
483 483
 	 * @return DataTable
484 484
 	 */
485
-	public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) {
486
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page);
485
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
486
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
487 487
 		return $this;
488 488
 	}
489 489
 
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 	 * @param array $compileParts
493 493
 	 * @return DataTable
494 494
 	 */
495
-	public function refresh($compileParts = [
495
+	public function refresh($compileParts=[
496 496
 		'tbody'
497 497
 	]) {
498
-		$this->_compileParts = $compileParts;
498
+		$this->_compileParts=$compileParts;
499 499
 		return $this;
500 500
 	}
501 501
 
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 	 * @param string $position
506 506
 	 * @return \Ajax\common\html\HtmlDoubleElement
507 507
 	 */
508
-	public function addSearchInToolbar($position = Direction::RIGHT) {
508
+	public function addSearchInToolbar($position=Direction::RIGHT) {
509 509
 		return $this->addInToolbar($this->getSearchField())
510 510
 			->setPosition($position);
511 511
 	}
512 512
 
513 513
 	public function getSearchField() {
514
-		if (isset($this->_searchField) === false) {
515
-			$this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search...");
514
+		if (isset($this->_searchField)===false) {
515
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
516 516
 			$this->_searchField->addIcon("search", Direction::RIGHT);
517 517
 		}
518 518
 		return $this->_searchField;
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 	}
541 541
 
542 542
 	protected function getTargetSelector($op) {
543
-		$result = $this->_targetSelector;
544
-		if (! isset($result[$op]))
545
-			$result = "#" . $this->identifier;
543
+		$result=$this->_targetSelector;
544
+		if (!isset($result[$op]))
545
+			$result="#".$this->identifier;
546 546
 		return $result[$op];
547 547
 	}
548 548
 
@@ -554,20 +554,20 @@  discard block
 block discarded – undo
554 554
 	 * @return DataTable
555 555
 	 */
556 556
 	public function setTargetSelector($_targetSelector) {
557
-		if (! \is_array($_targetSelector)) {
558
-			$_targetSelector = [
557
+		if (!\is_array($_targetSelector)) {
558
+			$_targetSelector=[
559 559
 				"edit" => $_targetSelector,
560 560
 				"delete" => $_targetSelector
561 561
 			];
562 562
 		}
563
-		$this->_targetSelector = $_targetSelector;
563
+		$this->_targetSelector=$_targetSelector;
564 564
 		return $this;
565 565
 	}
566 566
 
567 567
 	public function getRefreshSelector() {
568 568
 		if (isset($this->_refreshSelector))
569 569
 			return $this->_refreshSelector;
570
-		return "#" . $this->identifier . " tbody";
570
+		return "#".$this->identifier." tbody";
571 571
 	}
572 572
 
573 573
 	/**
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @return DataTable
577 577
 	 */
578 578
 	public function setRefreshSelector($_refreshSelector) {
579
-		$this->_refreshSelector = $_refreshSelector;
579
+		$this->_refreshSelector=$_refreshSelector;
580 580
 		return $this;
581 581
 	}
582 582
 
@@ -588,9 +588,9 @@  discard block
 block discarded – undo
588 588
 	public function show($modelInstance) {
589 589
 		if (\is_array($modelInstance)) {
590 590
 			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
591
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
591
+				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
592 592
 		}
593
-		$this->_modelInstance = $modelInstance;
593
+		$this->_modelInstance=$modelInstance;
594 594
 	}
595 595
 
596 596
 	public function getRowClass() {
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	 * @return DataTable
605 605
 	 */
606 606
 	public function setRowClass($_rowClass) {
607
-		$this->_rowClass = $_rowClass;
607
+		$this->_rowClass=$_rowClass;
608 608
 		return $this;
609 609
 	}
610 610
 
@@ -615,16 +615,16 @@  discard block
 block discarded – undo
615 615
 	 * @return DataTable
616 616
 	 */
617 617
 	public function setEmptyMessage($_emptyMessage) {
618
-		$this->_emptyMessage = $_emptyMessage;
618
+		$this->_emptyMessage=$_emptyMessage;
619 619
 		return $this;
620 620
 	}
621 621
 
622
-	public function setSortable($colIndex = NULL) {
623
-		$this->_sortable = $colIndex;
622
+	public function setSortable($colIndex=NULL) {
623
+		$this->_sortable=$colIndex;
624 624
 		return $this;
625 625
 	}
626 626
 
627
-	public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) {
627
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
628 628
 		$this->_self->setActiveRowSelector($class, $event, $multiple);
629 629
 		return $this;
630 630
 	}
@@ -634,19 +634,19 @@  discard block
 block discarded – undo
634 634
 	}
635 635
 
636 636
 	public function hideColumn($colIndex) {
637
-		if (! \is_array($this->_hiddenColumns))
638
-			$this->_hiddenColumns = [];
639
-		$this->_hiddenColumns[] = $colIndex;
637
+		if (!\is_array($this->_hiddenColumns))
638
+			$this->_hiddenColumns=[];
639
+		$this->_hiddenColumns[]=$colIndex;
640 640
 		return $this;
641 641
 	}
642 642
 
643 643
 	public function setColWidth($colIndex, $width) {
644
-		$this->_colWidths[$colIndex] = $width;
644
+		$this->_colWidths[$colIndex]=$width;
645 645
 		return $this;
646 646
 	}
647 647
 
648 648
 	public function setColWidths($_colWidths) {
649
-		$this->_colWidths = $_colWidths;
649
+		$this->_colWidths=$_colWidths;
650 650
 		return $this;
651 651
 	}
652 652
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 		return $this;
656 656
 	}
657 657
 
658
-	public function trigger($event, $params = "[]") {
658
+	public function trigger($event, $params="[]") {
659 659
 		return $this->getHtmlComponent()->trigger($event, $params);
660 660
 	}
661 661
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param mixed $_displayBehavior
694 694
 	 */
695 695
 	public function setDisplayBehavior($_displayBehavior) {
696
-		$this->_displayBehavior = $_displayBehavior;
696
+		$this->_displayBehavior=$_displayBehavior;
697 697
 	}
698 698
 
699 699
 	/**
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 		$this->_instanceViewer->setGroupByFields($_groupByFields);
713 713
 	}
714 714
 	
715
-	public function addGroupBy($index){
716
-		$index = $this->_getIndex($index);
717
-		if ($index !== false) {
715
+	public function addGroupBy($index) {
716
+		$index=$this->_getIndex($index);
717
+		if ($index!==false) {
718 718
 			$this->_instanceViewer->addGroupBy($index);
719 719
 		}
720 720
 	}
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	 * @param boolean $_visibleHover
725 725
 	 */
726 726
 	public function setVisibleHover($_visibleHover) {
727
-		$this->_visibleHover = $_visibleHover;
727
+		$this->_visibleHover=$_visibleHover;
728 728
 	}
729 729
 
730 730
 	/**
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 		return $this->_paginationToolbar;
736 736
 	}
737 737
 
738
-	public function setInverted($recursive = true) {
738
+	public function setInverted($recursive=true) {
739 739
 		$this->getHtmlComponent()->setInverted($recursive);
740 740
 		if ($this->_emptyMessage instanceof HtmlSemDoubleElement) {
741 741
 			$this->_emptyMessage->setInverted($recursive);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 
30 30
 	protected $groupByFields;
31 31
 
32
-	public static $index = 0;
32
+	public static $index=0;
33 33
 
34
-	public function __construct($identifier, $instance = NULL, $captions = NULL) {
35
-		$this->widgetIdentifier = $identifier;
36
-		$this->values = [];
37
-		$this->afterCompile = [];
34
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
35
+		$this->widgetIdentifier=$identifier;
36
+		$this->values=[];
37
+		$this->afterCompile=[];
38 38
 		if (isset($instance))
39 39
 			$this->setInstance($instance);
40 40
 		$this->setCaptions($captions);
41
-		$this->captionCallback = NULL;
42
-		$this->defaultValueFunction = function ($name, $value) {
41
+		$this->captionCallback=NULL;
42
+		$this->defaultValueFunction=function($name, $value) {
43 43
 			return $value;
44 44
 		};
45 45
 	}
@@ -66,47 +66,47 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public function getValues() {
69
-		$values = [];
70
-		$index = 0;
71
-		$count = $this->count();
72
-		$hasGroupby = is_array($this->groupByFields);
73
-		if (! $hasGroupby) {
74
-			while ($index < $count) {
75
-				$values[] = $this->getValue($index ++);
69
+		$values=[];
70
+		$index=0;
71
+		$count=$this->count();
72
+		$hasGroupby=is_array($this->groupByFields);
73
+		if (!$hasGroupby) {
74
+			while ($index<$count) {
75
+				$values[]=$this->getValue($index++);
76 76
 			}
77 77
 		} else {
78
-			while ($index < $count) {
79
-				if (array_search($index, $this->groupByFields) === false) {
80
-					$values[] = $this->getValue($index);
78
+			while ($index<$count) {
79
+				if (array_search($index, $this->groupByFields)===false) {
80
+					$values[]=$this->getValue($index);
81 81
 				}
82
-				$index ++;
82
+				$index++;
83 83
 			}
84 84
 		}
85 85
 		return $values;
86 86
 	}
87 87
 
88
-	public function getIdentifier($index = NULL) {
89
-		if (! isset($index))
90
-			$index = self::$index;
91
-		$value = $index;
88
+	public function getIdentifier($index=NULL) {
89
+		if (!isset($index))
90
+			$index=self::$index;
91
+		$value=$index;
92 92
 		if (isset($this->values["identifier"])) {
93 93
 			if (\is_string($this->values["identifier"]))
94
-				$value = JReflection::callMethod($this->instance, $this->values["identifier"], []);
94
+				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
95 95
 			else
96
-				$value = $this->values["identifier"]($index, $this->instance);
96
+				$value=$this->values["identifier"]($index, $this->instance);
97 97
 		}
98 98
 		return $value;
99 99
 	}
100 100
 
101 101
 	public function getValue($index) {
102
-		$property = $this->properties[$index];
102
+		$property=$this->properties[$index];
103 103
 		return $this->_getValue($property, $index);
104 104
 	}
105 105
 
106 106
 	protected function _beforeAddProperty($index, &$field) {}
107 107
 
108 108
 	protected function _getDefaultValue($name, $value, $index) {
109
-		$func = $this->defaultValueFunction;
109
+		$func=$this->defaultValueFunction;
110 110
 		return $func($name, $value, $index, $this->instance);
111 111
 	}
112 112
 
@@ -116,27 +116,27 @@  discard block
 block discarded – undo
116 116
 	}
117 117
 
118 118
 	protected function _getValue($property, $index) {
119
-		$value = null;
120
-		$propertyName = $property;
119
+		$value=null;
120
+		$propertyName=$property;
121 121
 		if ($property instanceof \ReflectionProperty) {
122
-			$value = $this->_getPropertyValue($property);
123
-			$propertyName = $property->getName();
124
-		} elseif (\is_callable($property) && \array_search($property, ['system','date']) === false){
125
-			try{
126
-				$value = $property($this->instance);
127
-			}catch(\Error $e){}
122
+			$value=$this->_getPropertyValue($property);
123
+			$propertyName=$property->getName();
124
+		} elseif (\is_callable($property) && \array_search($property, ['system', 'date'])===false) {
125
+			try {
126
+				$value=$property($this->instance);
127
+			}catch (\Error $e) {}
128 128
 		}
129 129
 		elseif (\is_array($property)) {
130
-			$values = \array_map(function ($v) use ($index) {
130
+			$values=\array_map(function($v) use ($index) {
131 131
 				return $this->_getValue($v, $index);
132 132
 			}, $property);
133
-			$value = \implode('', $values);
133
+			$value=\implode('', $values);
134 134
 		} elseif (\is_string($property)) {
135
-			$value = '';
135
+			$value='';
136 136
 			if (isset($this->instance->{$property})) {
137
-				$value = $this->instance->{$property};
138
-			} elseif (\method_exists($this->instance, $getter = JReflection::getterName($property))) {
139
-				$value = JReflection::callMethod($this->instance, $getter, []);
137
+				$value=$this->instance->{$property};
138
+			} elseif (\method_exists($this->instance, $getter=JReflection::getterName($property))) {
139
+				$value=JReflection::callMethod($this->instance, $getter, []);
140 140
 			}
141 141
 		}
142 142
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
 	protected function _postGetValue($index, $propertyName, $value) {
147 147
 		if (isset($this->values[$index])) {
148
-			$value = $this->values[$index]($value, $this->instance, $index, self::$index);
148
+			$value=$this->values[$index]($value, $this->instance, $index, self::$index);
149 149
 		} else {
150
-			$value = $this->_getDefaultValue($propertyName, $value, $index);
150
+			$value=$this->_getDefaultValue($propertyName, $value, $index);
151 151
 		}
152 152
 		if (isset($this->afterCompile[$index])) {
153 153
 			if (\is_callable($this->afterCompile[$index])) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		return $value;
158 158
 	}
159 159
 
160
-	public function insertField($index, $field, $key = null) {
160
+	public function insertField($index, $field, $key=null) {
161 161
 		if (isset($key)) {
162 162
 			array_splice($this->visibleProperties, $index, 0, [
163 163
 				$key => $field
@@ -171,29 +171,29 @@  discard block
 block discarded – undo
171 171
 	public function sortColumnContent($index, $array) {
172 172
 		if (isset($this->visibleProperties[$index])) {
173 173
 			if (is_array($this->visibleProperties[$index])) {
174
-				$this->visibleProperties[$index] = JArray::sortAssociative($this->visibleProperties[$index], $array);
174
+				$this->visibleProperties[$index]=JArray::sortAssociative($this->visibleProperties[$index], $array);
175 175
 			}
176 176
 		}
177 177
 		return $this;
178 178
 	}
179 179
 
180
-	public function insertInField($index, $field, $key = null) {
181
-		$vb = $this->visibleProperties;
180
+	public function insertInField($index, $field, $key=null) {
181
+		$vb=$this->visibleProperties;
182 182
 		if (isset($vb[$index])) {
183 183
 			if (isset($key)) {
184 184
 				if (\is_array($vb[$index])) {
185
-					$this->visibleProperties[$index][$key] = $field;
185
+					$this->visibleProperties[$index][$key]=$field;
186 186
 				} else {
187
-					$this->visibleProperties[$index] = [
187
+					$this->visibleProperties[$index]=[
188 188
 						$vb[$index],
189 189
 						$key => $field
190 190
 					];
191 191
 				}
192 192
 			} else {
193 193
 				if (\is_array($vb[$index])) {
194
-					$this->visibleProperties[$index][] = $field;
194
+					$this->visibleProperties[$index][]=$field;
195 195
 				} else {
196
-					$this->visibleProperties[$index] = [
196
+					$this->visibleProperties[$index]=[
197 197
 						$vb[$index],
198 198
 						$field
199 199
 					];
@@ -205,19 +205,19 @@  discard block
 block discarded – undo
205 205
 		return $this;
206 206
 	}
207 207
 
208
-	public function addField($field, $key = null) {
208
+	public function addField($field, $key=null) {
209 209
 		if (isset($key)) {
210
-			$this->visibleProperties[] = [
210
+			$this->visibleProperties[]=[
211 211
 				$key => $field
212 212
 			];
213 213
 		} else {
214
-			$this->visibleProperties[] = $field;
214
+			$this->visibleProperties[]=$field;
215 215
 		}
216 216
 		return $this;
217 217
 	}
218 218
 
219 219
 	public function addFields($fields) {
220
-		$this->visibleProperties = \array_merge($this->visibleProperties, $fields);
220
+		$this->visibleProperties=\array_merge($this->visibleProperties, $fields);
221 221
 		return $this;
222 222
 	}
223 223
 
@@ -234,30 +234,30 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	public function getFieldName($index) {
237
-		$property = $this->getProperty($index);
237
+		$property=$this->getProperty($index);
238 238
 		if ($property instanceof \ReflectionProperty) {
239
-			$result = $property->getName();
239
+			$result=$property->getName();
240 240
 		} elseif (\is_callable($property)) {
241
-			$result = $this->visibleProperties[$index];
241
+			$result=$this->visibleProperties[$index];
242 242
 		} else {
243
-			$result = $property;
243
+			$result=$property;
244 244
 		}
245 245
 		return $result;
246 246
 	}
247 247
 
248 248
 	protected function showableProperty(\ReflectionProperty $rProperty) {
249
-		return JString::startswith($rProperty->getName(), "_") === false;
249
+		return JString::startswith($rProperty->getName(), "_")===false;
250 250
 	}
251 251
 
252 252
 	public function setInstance($instance) {
253 253
 		if (\is_string($instance)) {
254
-			$instance = new $instance();
254
+			$instance=new $instance();
255 255
 		}
256
-		$this->instance = $instance;
257
-		$this->properties = [];
258
-		$this->reflect = new \ReflectionClass($instance);
259
-		if (JArray::count($this->visibleProperties) === 0) {
260
-			$this->properties = $this->getDefaultProperties();
256
+		$this->instance=$instance;
257
+		$this->properties=[];
258
+		$this->reflect=new \ReflectionClass($instance);
259
+		if (JArray::count($this->visibleProperties)===0) {
260
+			$this->properties=$this->getDefaultProperties();
261 261
 		} else {
262 262
 			foreach ($this->visibleProperties as $property) {
263 263
 				$this->setInstanceProperty($property);
@@ -268,56 +268,56 @@  discard block
 block discarded – undo
268 268
 
269 269
 	private function setInstanceProperty($property) {
270 270
 		if (\is_callable($property)) {
271
-			$this->properties[] = $property;
271
+			$this->properties[]=$property;
272 272
 		} elseif (\is_string($property)) {
273 273
 			try {
274 274
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
275
-				$rProperty = $this->reflect->getProperty($property);
276
-				$this->properties[] = $rProperty;
277
-			} catch (\Exception $e) {
275
+				$rProperty=$this->reflect->getProperty($property);
276
+				$this->properties[]=$rProperty;
277
+			}catch (\Exception $e) {
278 278
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
279
-				$this->properties[] = $property;
279
+				$this->properties[]=$property;
280 280
 			}
281 281
 		} elseif (\is_int($property)) {
282
-			$props = $this->getDefaultProperties();
282
+			$props=$this->getDefaultProperties();
283 283
 			if (isset($props[$property]))
284
-				$this->properties[] = $props[$property];
284
+				$this->properties[]=$props[$property];
285 285
 			else
286
-				$this->properties[] = $property;
286
+				$this->properties[]=$property;
287 287
 		} else {
288
-			$this->properties[] = $property;
288
+			$this->properties[]=$property;
289 289
 		}
290 290
 	}
291 291
 
292 292
 	protected function getDefaultProperties() {
293
-		$result = [];
294
-		$properties = $this->reflect->getProperties();
293
+		$result=[];
294
+		$properties=$this->reflect->getProperties();
295 295
 		foreach ($properties as $property) {
296
-			$showable = $this->showableProperty($property);
297
-			if ($showable !== false) {
298
-				$result[] = $property;
296
+			$showable=$this->showableProperty($property);
297
+			if ($showable!==false) {
298
+				$result[]=$property;
299 299
 			}
300 300
 		}
301 301
 		return $result;
302 302
 	}
303 303
 
304 304
 	public function setVisibleProperties($visibleProperties) {
305
-		$this->visibleProperties = $visibleProperties;
305
+		$this->visibleProperties=$visibleProperties;
306 306
 		return $this;
307 307
 	}
308 308
 
309 309
 	public function setValueFunction($index, $callback) {
310
-		$this->values[$index] = $callback;
310
+		$this->values[$index]=$callback;
311 311
 		return $this;
312 312
 	}
313 313
 
314 314
 	public function setIdentifierFunction($callback) {
315
-		$this->values["identifier"] = $callback;
315
+		$this->values["identifier"]=$callback;
316 316
 		return $this;
317 317
 	}
318 318
 
319 319
 	public static function setIndex($index) {
320
-		self::$index = $index;
320
+		self::$index=$index;
321 321
 	}
322 322
 
323 323
 	public function getProperties() {
@@ -337,43 +337,43 @@  discard block
 block discarded – undo
337 337
 	}
338 338
 
339 339
 	public function getCaptions() {
340
-		$hasGroupby = is_array($this->groupByFields);
341
-		$count = $this->count();
342
-		$moreAdded = false;
340
+		$hasGroupby=is_array($this->groupByFields);
341
+		$count=$this->count();
342
+		$moreAdded=false;
343 343
 		if (isset($this->captions)) {
344
-			$captions = \array_values($this->captions);
345
-			$gbSize = $hasGroupby ? sizeof($this->groupByFields) : 0;
346
-			$captionsSize = \sizeof($captions);
347
-			for ($i = $captionsSize; $i < $count - $gbSize; $i ++) {
348
-				$captions[] = "";
349
-				$moreAdded = true;
344
+			$captions=\array_values($this->captions);
345
+			$gbSize=$hasGroupby ? sizeof($this->groupByFields) : 0;
346
+			$captionsSize=\sizeof($captions);
347
+			for ($i=$captionsSize; $i<$count-$gbSize; $i++) {
348
+				$captions[]="";
349
+				$moreAdded=true;
350 350
 			}
351 351
 		} else {
352
-			$captions = [];
353
-			$index = 0;
354
-			while ($index < $count) {
355
-				$captions[] = $this->getCaption($index ++);
352
+			$captions=[];
353
+			$index=0;
354
+			while ($index<$count) {
355
+				$captions[]=$this->getCaption($index++);
356 356
 			}
357 357
 		}
358
-		if ($hasGroupby && sizeof($captions) >= $count && ! $moreAdded) {
359
-			$captions = JArray::removeByKeys($captions, $this->groupByFields);
358
+		if ($hasGroupby && sizeof($captions)>=$count && !$moreAdded) {
359
+			$captions=JArray::removeByKeys($captions, $this->groupByFields);
360 360
 		}
361 361
 		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
362
-			$callback = $this->captionCallback;
362
+			$callback=$this->captionCallback;
363 363
 			$callback($captions, $this->instance);
364 364
 		}
365 365
 		return $captions;
366 366
 	}
367 367
 
368 368
 	public function setCaption($index, $caption) {
369
-		if (isset($this->captions) === false)
370
-			$this->captions = [];
371
-		$this->captions[$index] = $caption;
369
+		if (isset($this->captions)===false)
370
+			$this->captions=[];
371
+		$this->captions[$index]=$caption;
372 372
 		return $this;
373 373
 	}
374 374
 
375 375
 	public function setCaptions($captions) {
376
-		$this->captions = $captions;
376
+		$this->captions=$captions;
377 377
 		return $this;
378 378
 	}
379 379
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	 * @return InstanceViewer
389 389
 	 */
390 390
 	public function afterCompile($index, $callback) {
391
-		$this->afterCompile[$index] = $callback;
391
+		$this->afterCompile[$index]=$callback;
392 392
 		return $this;
393 393
 	}
394 394
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 * @return \Ajax\semantic\widgets\base\InstanceViewer
401 401
 	 */
402 402
 	public function setCaptionCallback($captionCallback) {
403
-		$this->captionCallback = $captionCallback;
403
+		$this->captionCallback=$captionCallback;
404 404
 		return $this;
405 405
 	}
406 406
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return \Ajax\semantic\widgets\base\InstanceViewer
413 413
 	 */
414 414
 	public function setDefaultValueFunction($defaultValueFunction) {
415
-		$this->defaultValueFunction = $defaultValueFunction;
415
+		$this->defaultValueFunction=$defaultValueFunction;
416 416
 		return $this;
417 417
 	}
418 418
 
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 
423 423
 	public function getSimpleProperties() {
424
-		return array_filter($this->visibleProperties, function ($item) {
425
-			return ! (is_array($item) || is_object($item));
424
+		return array_filter($this->visibleProperties, function($item) {
425
+			return !(is_array($item) || is_object($item));
426 426
 		});
427 427
 	}
428 428
 
@@ -447,10 +447,10 @@  discard block
 block discarded – undo
447 447
 	 * @param mixed $groupByFields
448 448
 	 */
449 449
 	public function setGroupByFields($groupByFields) {
450
-		$this->groupByFields = $groupByFields;
450
+		$this->groupByFields=$groupByFields;
451 451
 	}
452 452
 	
453
-	public function addGroupBy($groupByField){
453
+	public function addGroupBy($groupByField) {
454 454
 		$this->groupByFields[]=$groupByField;
455 455
 	}
456 456
 
Please login to merge, or discard this patch.