Passed
Push — master ( 5c767a...47de24 )
by Jean-Christophe
06:45
created
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -24,39 +24,39 @@  discard block
 block discarded – undo
24 24
 	private $_inverted;
25 25
 	
26 26
 	public function __construct($identifier, $modelInstance=NULL) {
27
-		parent::__construct($identifier, null,$modelInstance);
27
+		parent::__construct($identifier, null, $modelInstance);
28 28
 		$this->_form=new HtmlForm($identifier);
29 29
 		$this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true);
30 30
 	}
31 31
 
32
-	protected function _getFieldIdentifier($prefix,$name=""){
32
+	protected function _getFieldIdentifier($prefix, $name="") {
33 33
 		return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier();
34 34
 	}
35 35
 
36
-	public function compile(JsUtils $js=NULL,&$view=NULL){
37
-		if(!$this->_generated){
36
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
37
+		if (!$this->_generated) {
38 38
 			$this->_instanceViewer->setInstance($this->_modelInstance);
39 39
 
40 40
 			$form=$this->content["form"];
41 41
 			$this->_generateContent($form);
42 42
 
43
-			if(isset($this->_toolbar)){
43
+			if (isset($this->_toolbar)) {
44 44
 				$this->_setToolbarPosition($form);
45 45
 			}
46
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]);
47
-			if($this->_inverted){
46
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]);
47
+			if ($this->_inverted) {
48 48
 				$this->content['form']->setInverted(true);
49 49
 			}
50 50
 			$this->_generated=true;
51 51
 		}
52
-		return parent::compile($js,$view);
52
+		return parent::compile($js, $view);
53 53
 	}
54 54
 
55 55
 	/**
56 56
 	 * @param HtmlForm $form
57 57
 	 */
58
-	protected function _generateContent($form){
59
-		$values= $this->_instanceViewer->getValues();
58
+	protected function _generateContent($form) {
59
+		$values=$this->_instanceViewer->getValues();
60 60
 		$count=$this->_instanceViewer->count();
61 61
 		$separators=$this->_instanceViewer->getSeparators();
62 62
 		$headers=$this->_instanceViewer->getHeaders();
@@ -64,41 +64,41 @@  discard block
 block discarded – undo
64 64
 		\sort($separators);
65 65
 		$size=\sizeof($separators);
66 66
 		$nb=0;
67
-		if($size===1){
67
+		if ($size===1) {
68 68
 			$i=-1;
69
-			foreach ($values as $v){
70
-				$this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++);
69
+			foreach ($values as $v) {
70
+				$this->_generateFields($form, [$v], $headers, $i, $wrappers, $nb++);
71 71
 				$i++;
72 72
 			}
73
-		}else{
73
+		} else {
74 74
 			$separators[]=$count;
75
-			for($i=0;$i<$size;$i++){
76
-				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
77
-				$this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers,$nb++);
75
+			for ($i=0; $i<$size; $i++) {
76
+				$fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]);
77
+				$this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers, $nb++);
78 78
 			}
79 79
 		}
80
-		if($this->_hasRules && !$this->getForm()->hasValidationParams()){
80
+		if ($this->_hasRules && !$this->getForm()->hasValidationParams()) {
81 81
 				$this->setValidationParams(["inline"=>true]);
82 82
 		}
83 83
 	}
84 84
 
85
-	protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers,$nb){
85
+	protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb) {
86 86
 		$wrapper=null;
87
-		if(isset($headers[$sepFirst+1]))
88
-			$form->addHeader($headers[$sepFirst+1],4,true);
89
-		if(isset($wrappers[$sepFirst+1])){
87
+		if (isset($headers[$sepFirst+1]))
88
+			$form->addHeader($headers[$sepFirst+1], 4, true);
89
+		if (isset($wrappers[$sepFirst+1])) {
90 90
 			$wrapper=$wrappers[$sepFirst+1];
91 91
 		}
92
-		if(\sizeof($values)===1){
92
+		if (\sizeof($values)===1) {
93 93
 			$added=$form->addField($values[0]);
94
-		}elseif(\sizeof($values)>1){
94
+		}elseif (\sizeof($values)>1) {
95 95
 			$added=$form->addFields($values);
96
-		}else
96
+		} else
97 97
 			return;
98
-		if(isset($wrapper)){
99
-			$added->wrap($wrapper[0],$wrapper[1]);
98
+		if (isset($wrapper)) {
99
+			$added->wrap($wrapper[0], $wrapper[1]);
100 100
 		}
101
-		$this->execHook("onGenerateFields",$added,$nb);
101
+		$this->execHook("onGenerateFields", $added, $nb);
102 102
 	}
103 103
 	
104 104
 	/**
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 	 * the generated field is the first parameter
107 107
 	 * @param callable $callback the fonction to call when a field is generated
108 108
 	 */
109
-	public function onGenerateField($callback){
110
-		$this->addHook("onGenerateFields",$callback);
109
+	public function onGenerateField($callback) {
110
+		$this->addHook("onGenerateFields", $callback);
111 111
 	}
112 112
 
113 113
 	/**
114 114
 	 * @return HtmlForm
115 115
 	 */
116
-	public function getForm(){
116
+	public function getForm() {
117 117
 		return $this->content["form"];
118 118
 	}
119 119
 
120
-	public function addSeparatorAfter($fieldNum){
120
+	public function addSeparatorAfter($fieldNum) {
121 121
 		$fieldNum=$this->_getIndex($fieldNum);
122 122
 		$this->_instanceViewer->addSeparatorAfter($fieldNum);
123 123
 		return $this;
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 		return $this;
133 133
 	}
134 134
 
135
-	public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){
136
-		return $this->_fieldAs(function($id,$name,$value) use ($cssStyle){
137
-			$button=new HtmlButton($id,$value,$cssStyle);
135
+	public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) {
136
+		return $this->_fieldAs(function($id, $name, $value) use ($cssStyle){
137
+			$button=new HtmlButton($id, $value, $cssStyle);
138 138
 			$button->setProperty("type", "reset");
139 139
 			return $button;
140
-		}, $index,$attributes);
140
+		}, $index, $attributes);
141 141
 	}
142 142
 
143 143
 	/**
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
 		$this->content[$this->_toolbarPosition]=$this->_toolbar;
157 157
 	}
158 158
 
159
-	public function addDividerBefore($index,$title){
159
+	public function addDividerBefore($index, $title) {
160 160
 		$index=$this->_getIndex($index);
161 161
 		$this->_instanceViewer->addHeaderDividerBefore($index, $title);
162 162
 		return $this;
163 163
 	}
164 164
 
165
-	public function addWrapper($index,$contentBefore,$contentAfter=null){
165
+	public function addWrapper($index, $contentBefore, $contentAfter=null) {
166 166
 		$index=$this->_getIndex($index);
167
-		$this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter);
167
+		$this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter);
168 168
 		return $this;
169 169
 	}
170 170
 
171
-	public function run(JsUtils $js){
171
+	public function run(JsUtils $js) {
172 172
 		parent::run($js);
173 173
 	}
174 174
 	
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
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function __construct($identifier, $rowCount, $colCount) {
33 33
 		parent::__construct($identifier, "table", "ui table");
34
-		$this->content=array ();
34
+		$this->content=array();
35 35
 		$this->setRowCount($rowCount, $colCount);
36
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
37
-		$this->_compileParts=["thead","tbody","tfoot"];
36
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
37
+		$this->_compileParts=["thead", "tbody", "tfoot"];
38 38
 		$this->_afterCompileEvents=[];
39 39
 	}
40 40
 
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 	 * @return HtmlTableContent
45 45
 	 */
46 46
 	public function getPart($key) {
47
-		if (\array_key_exists($key, $this->content) === false) {
47
+		if (\array_key_exists($key, $this->content)===false) {
48 48
 			$this->content[$key]=new HtmlTableContent("", $key);
49
-			if ($key !== "tbody") {
49
+			if ($key!=="tbody") {
50 50
 				$this->content[$key]->setRowCount(1, $this->_colCount);
51 51
 			}
52 52
 		}
53 53
 		return $this->content[$key];
54 54
 	}
55 55
 
56
-	protected function _getFirstPart(){
57
-		if(isset($this->content["thead"])){
56
+	protected function _getFirstPart() {
57
+		if (isset($this->content["thead"])) {
58 58
 			return $this->content["thead"];
59 59
 		}
60 60
 		return $this->content["tbody"];
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return boolean
100 100
 	 */
101 101
 	public function hasPart($key) {
102
-		return \array_key_exists($key, $this->content) === true;
102
+		return \array_key_exists($key, $this->content)===true;
103 103
 	}
104 104
 
105 105
 	/**
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 		return $this->colAlign($colIndex, "colLeftFromRight");
260 260
 	}
261 261
 
262
-	public function setColAlignment($colIndex,$alignment){
263
-		switch ($alignment){
262
+	public function setColAlignment($colIndex, $alignment) {
263
+		switch ($alignment) {
264 264
 			case TextAlignment::LEFT:
265 265
 				$function="colLeft";
266 266
 				break;
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 		return $this;
281 281
 	}
282 282
 	
283
-	public function setColAlignmentFromRight($colIndex,$alignment){
284
-		switch ($alignment){
283
+	public function setColAlignmentFromRight($colIndex, $alignment) {
284
+		switch ($alignment) {
285 285
 			case TextAlignment::LEFT:
286 286
 				$function="colLeftFromRight";
287 287
 				break;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
 	private function colAlign($colIndex, $function) {
305 305
 		if (\is_array($colIndex)) {
306
-			foreach ( $colIndex as $cIndex ) {
306
+			foreach ($colIndex as $cIndex) {
307 307
 				$this->colAlign($cIndex, $function);
308 308
 			}
309 309
 		} else {
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @see HtmlSemDoubleElement::compile()
365 365
 	 */
366 366
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
367
-		if(\sizeof($this->_compileParts)<3){
367
+		if (\sizeof($this->_compileParts)<3) {
368 368
 			$this->_template="%content%";
369 369
 			$this->refresh($js);
370 370
 		}
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
 	}
374 374
 
375 375
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
376
-		parent::compile_once($js,$view);
376
+		parent::compile_once($js, $view);
377 377
 		if ($this->propertyContains("class", "sortable")) {
378
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
378
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
379 379
 		}
380 380
 	}
381 381
 
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
 	public function fromDatabaseObject($object, $function) {
389 389
 		$result=$function($object);
390 390
 		if (\is_array($result)) {
391
-			$result= $this->addRow($function($object));
391
+			$result=$this->addRow($function($object));
392 392
 		} else {
393
-			$result= $this->getBody()->_addRow($result);
393
+			$result=$this->getBody()->_addRow($result);
394 394
 		}
395
-		if(isset($this->_afterCompileEvents["onNewRow"])){
396
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
397
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
395
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
396
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
397
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
398 398
 		}
399 399
 		return $result;
400 400
 	}
@@ -409,26 +409,26 @@  discard block
 block discarded – undo
409 409
 		return $this;
410 410
 	}
411 411
 	
412
-	public function refreshTR(){
412
+	public function refreshTR() {
413 413
 		$this->setCompileParts();
414 414
 		$this->getPart("tbody")->refreshTR();
415 415
 	}
416 416
 
417
-	public function refresh($js){
417
+	public function refresh($js) {
418 418
 		$this->_footer=$this->getFooter();
419
-		if(isset($js)){
420
-			$js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");',true);
419
+		if (isset($js)) {
420
+			$js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");', true);
421 421
 		}
422 422
 	}
423 423
 
424
-	public function run(JsUtils $js){
425
-		if(!$this->_runned){
426
-			if(isset($this->_activeRowSelector)){
424
+	public function run(JsUtils $js) {
425
+		if (!$this->_runned) {
426
+			if (isset($this->_activeRowSelector)) {
427 427
 				$this->_activeRowSelector->run();
428 428
 			}
429 429
 		}
430
-		$result= parent::run($js);
431
-		if(isset($this->_footer))
430
+		$result=parent::run($js);
431
+		if (isset($this->_footer))
432 432
 			$this->_footer->run($js);
433 433
 		$this->_runned=true;
434 434
 		return $result;
@@ -452,51 +452,51 @@  discard block
 block discarded – undo
452 452
 	 * @param boolean $multiple
453 453
 	 * @return HtmlTable
454 454
 	 */
455
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
456
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
455
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
456
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
457 457
 		return $this;
458 458
 	}
459 459
 	
460
-	public function hasActiveRowSelector(){
460
+	public function hasActiveRowSelector() {
461 461
 		return isset($this->_activeRowSelector);
462 462
 	}
463 463
 
464
-	public function hideColumn($colIndex){
465
-		if(isset($this->content["thead"])){
464
+	public function hideColumn($colIndex) {
465
+		if (isset($this->content["thead"])) {
466 466
 			$this->content["thead"]->hideColumn($colIndex);
467 467
 		}
468 468
 		$this->content["tbody"]->hideColumn($colIndex);
469
-		if(isset($this->content["tfoot"])){
469
+		if (isset($this->content["tfoot"])) {
470 470
 			$this->content["tfoot"]->hideColumn($colIndex);
471 471
 		}
472 472
 		return $this;
473 473
 	}
474 474
 
475
-	public function setColWidth($colIndex,$width){
475
+	public function setColWidth($colIndex, $width) {
476 476
 		$part=$this->_getFirstPart();
477
-		if($part!==null && $part->count()>0)
477
+		if ($part!==null && $part->count()>0)
478 478
 			$part->getCell(0, $colIndex)->setWidth($width);
479 479
 		return $this;
480 480
 	}
481 481
 
482
-	public function setColWidths($widths){
482
+	public function setColWidths($widths) {
483 483
 		$part=$this->_getFirstPart();
484
-		if($part!==null && $part->count()>0){
484
+		if ($part!==null && $part->count()>0) {
485 485
 			$count=$part->getColCount();
486
-			if(!\is_array($widths)){
486
+			if (!\is_array($widths)) {
487 487
 				$widths=\array_fill(0, $count, $widths);
488 488
 			}
489
-			$max=\min(\sizeof($widths),$count);
490
-			for($i=0;$i<$max;$i++){
489
+			$max=\min(\sizeof($widths), $count);
490
+			for ($i=0; $i<$max; $i++) {
491 491
 				$part->getCell(0, $i)->setWidth($widths[$i]);
492 492
 			}
493 493
 		}
494 494
 		return $this;
495 495
 	}
496 496
 
497
-	public function mergeIdentiqualValues($colIndex,$function="strip_tags"){
497
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
498 498
 		$body=$this->getBody();
499
-		$body->mergeIdentiqualValues($colIndex,$function);
499
+		$body->mergeIdentiqualValues($colIndex, $function);
500 500
 		return $this;
501 501
 	}
502 502
 	/**
@@ -510,16 +510,16 @@  discard block
 block discarded – undo
510 510
 	 * @param mixed $_innerScript
511 511
 	 */
512 512
 	public function setInnerScript($_innerScript) {
513
-		$this->_innerScript = $_innerScript;
513
+		$this->_innerScript=$_innerScript;
514 514
 	}
515 515
 	
516
-	public function onActiveRowChange($jsCode){
517
-		$this->on("activeRowChange",$jsCode);
516
+	public function onActiveRowChange($jsCode) {
517
+		$this->on("activeRowChange", $jsCode);
518 518
 		return $this;
519 519
 	}
520 520
 	
521
-	public function addMergeRow($colCount,$value=null){
522
-		return $this->getBody()->addMergeRow($colCount,$value);
521
+	public function addMergeRow($colCount, $value=null) {
522
+		return $this->getBody()->addMergeRow($colCount, $value);
523 523
 	}
524 524
 
525 525
 }
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -15,69 +15,69 @@  discard block
 block discarded – undo
15 15
 
16 16
 	protected $ajaxTransition;
17 17
 
18
-	protected $ajaxLoader = "<div class=\"ui active centered inline text loader\">Loading</div>";
18
+	protected $ajaxLoader="<div class=\"ui active centered inline text loader\">Loading</div>";
19 19
 
20 20
 	abstract public function getUrl($url);
21 21
 
22
-	abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn = false);
22
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false);
23 23
 
24
-	abstract public function interval($jsCode, $time, $globalName = null, $immediatly = true);
24
+	abstract public function interval($jsCode, $time, $globalName=null, $immediatly=true);
25 25
 
26
-	protected function _ajax($method, $url, $responseElement = '', $parameters = []) {
26
+	protected function _ajax($method, $url, $responseElement='', $parameters=[]) {
27 27
 		if (isset($this->params['ajax'])) {
28 28
 			extract($this->params['ajax']);
29 29
 		}
30 30
 		extract($parameters);
31 31
 
32
-		$jsCallback = isset($jsCallback) ? $jsCallback : '';
33
-		$retour = $this->_getAjaxUrl($url, $attr);
34
-		$originalSelector = $responseElement;
35
-		$responseElement = $this->_getResponseElement($responseElement);
36
-		$retour .= "var self=this;\n";
37
-		$before = isset($before) ? $before : "";
38
-		$retour .= $before;
39
-		if ($hasLoader === true && JString::isNotNull($responseElement)) {
32
+		$jsCallback=isset($jsCallback) ? $jsCallback : '';
33
+		$retour=$this->_getAjaxUrl($url, $attr);
34
+		$originalSelector=$responseElement;
35
+		$responseElement=$this->_getResponseElement($responseElement);
36
+		$retour.="var self=this;\n";
37
+		$before=isset($before) ? $before : "";
38
+		$retour.=$before;
39
+		if ($hasLoader===true && JString::isNotNull($responseElement)) {
40 40
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
41
-		} elseif ($hasLoader === 'response') {
41
+		} elseif ($hasLoader==='response') {
42 42
 			$this->addResponseLoading($retour, $responseElement, $ajaxLoader);
43
-		} elseif ($hasLoader === 'internal-x') {
43
+		} elseif ($hasLoader==='internal-x') {
44 44
 			$this->addLoading($retour, '$(this).closest(".item, .step")', $ajaxLoader);
45
-		} elseif ($hasLoader === 'internal') {
46
-			$retour .= "\n$(this).addClass('loading');";
45
+		} elseif ($hasLoader==='internal') {
46
+			$retour.="\n$(this).addClass('loading');";
47 47
 		}
48
-		$ajaxParameters = [
48
+		$ajaxParameters=[
49 49
 			"url" => "url",
50
-			"method" => "'" . \strtoupper($method) . "'"
50
+			"method" => "'".\strtoupper($method)."'"
51 51
 		];
52 52
 
53
-		$ajaxParameters["async"] = ($async ? "true" : "false");
53
+		$ajaxParameters["async"]=($async ? "true" : "false");
54 54
 
55 55
 		if (isset($params)) {
56
-			$ajaxParameters["data"] = self::_correctParams($params, $parameters);
56
+			$ajaxParameters["data"]=self::_correctParams($params, $parameters);
57 57
 		}
58 58
 		if (isset($headers)) {
59
-			$ajaxParameters["headers"] = $headers;
59
+			$ajaxParameters["headers"]=$headers;
60 60
 		}
61 61
 		if ($csrf) {
62
-			$csrf = (is_string($csrf)) ? $csrf : 'csrf-token';
63
-			$parameters["beforeSend"] = "jqXHR.setRequestHeader('{$csrf}', $('meta[name=\"{$csrf}\"]').attr('content'));";
62
+			$csrf=(is_string($csrf)) ? $csrf : 'csrf-token';
63
+			$parameters["beforeSend"]="jqXHR.setRequestHeader('{$csrf}', $('meta[name=\"{$csrf}\"]').attr('content'));";
64 64
 		}
65 65
 		if (isset($partial)) {
66
-			$ajaxParameters["xhr"] = "xhrProvider";
67
-			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
66
+			$ajaxParameters["xhr"]="xhrProvider";
67
+			$retour.="var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
68 68
 		}
69 69
 		$this->createAjaxParameters($ajaxParameters, $parameters);
70
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
71
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
70
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n";
71
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null))."});\n";
72 72
 
73
-		$retour = $this->_addJsCondition($jsCondition, $retour);
73
+		$retour=$this->_addJsCondition($jsCondition, $retour);
74 74
 		if ($immediatly)
75
-			$this->jquery_code_for_compile[] = $retour;
75
+			$this->jquery_code_for_compile[]=$retour;
76 76
 		return $retour;
77 77
 	}
78 78
 
79 79
 	protected function createAjaxParameters(&$original, $parameters) {
80
-		$validParameters = [
80
+		$validParameters=[
81 81
 			"contentType" => "%value%",
82 82
 			"dataType" => "'%value%'",
83 83
 			"beforeSend" => "function(jqXHR,settings){%value%}",
@@ -86,21 +86,21 @@  discard block
 block discarded – undo
86 86
 		];
87 87
 		foreach ($validParameters as $param => $mask) {
88 88
 			if (isset($parameters[$param])) {
89
-				$original[$param] = \str_replace("%value%", $parameters[$param], $mask);
89
+				$original[$param]=\str_replace("%value%", $parameters[$param], $mask);
90 90
 			}
91 91
 		}
92 92
 	}
93 93
 
94 94
 	protected function implodeAjaxParameters($ajaxParameters) {
95
-		$s = '';
95
+		$s='';
96 96
 		foreach ($ajaxParameters as $k => $v) {
97
-			if ($s !== '') {
98
-				$s .= ',';
97
+			if ($s!=='') {
98
+				$s.=',';
99 99
 			}
100 100
 			if (is_array($v)) {
101
-				$s .= "'{$k}':{" . self::implodeAjaxParameters($v) . "}";
101
+				$s.="'{$k}':{".self::implodeAjaxParameters($v)."}";
102 102
 			} else {
103
-				$s .= "'{$k}':{$v}";
103
+				$s.="'{$k}':{$v}";
104 104
 			}
105 105
 		}
106 106
 		return $s;
@@ -108,29 +108,29 @@  discard block
 block discarded – undo
108 108
 
109 109
 	protected function _addJsCondition($jsCondition, $jsSource) {
110 110
 		if (isset($jsCondition)) {
111
-			return "if(" . $jsCondition . "){\n" . $jsSource . "\n}";
111
+			return "if(".$jsCondition."){\n".$jsSource."\n}";
112 112
 		}
113 113
 		return $jsSource;
114 114
 	}
115 115
 
116 116
 	protected function _getAjaxUrl($url, $attr) {
117
-		$url = $this->_correctAjaxUrl($url);
118
-		$retour = "url='" . $url . "';";
119
-		$slash = "/";
120
-		if (JString::endswith($url, "/") === true) {
121
-			$slash = "";
117
+		$url=$this->_correctAjaxUrl($url);
118
+		$retour="url='".$url."';";
119
+		$slash="/";
120
+		if (JString::endswith($url, "/")===true) {
121
+			$slash="";
122 122
 		}
123 123
 
124 124
 		if (JString::isNotNull($attr)) {
125
-			if ($attr === "value") {
126
-				$retour .= "url=url+'" . $slash . "'+$(this).val();\n";
127
-			} elseif ($attr === "html") {
128
-				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
129
-			} elseif (\substr($attr, 0, 3) === "js:") {
130
-				$retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n";
131
-			} elseif ($attr !== null && $attr !== "") {
132
-				$retour .= "let elmUrl=$(this).attr('" . $attr . "')||'';";
133
-				$retour .= "url=(!/^((http|https|ftp):\/\/)/.test(elmUrl))?url+'" . $slash . "'+elmUrl:elmUrl;\n";
125
+			if ($attr==="value") {
126
+				$retour.="url=url+'".$slash."'+$(this).val();\n";
127
+			} elseif ($attr==="html") {
128
+				$retour.="url=url+'".$slash."'+$(this).html();\n";
129
+			} elseif (\substr($attr, 0, 3)==="js:") {
130
+				$retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n";
131
+			} elseif ($attr!==null && $attr!=="") {
132
+				$retour.="let elmUrl=$(this).attr('".$attr."')||'';";
133
+				$retour.="url=(!/^((http|https|ftp):\/\/)/.test(elmUrl))?url+'".$slash."'+elmUrl:elmUrl;\n";
134 134
 			}
135 135
 		}
136 136
 		return $retour;
@@ -140,101 +140,101 @@  discard block
 block discarded – undo
140 140
 		return "window.onpopstate = function(e){if(e.state){var target=e.state.jqueryDone;$(e.state.selector)[target](e.state.html);}};";
141 141
 	}
142 142
 
143
-	protected function autoActiveLinks($previousURL = "window.location.href") {
144
-		$result = "\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}";
145
-		$result .= "\nvar myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
143
+	protected function autoActiveLinks($previousURL="window.location.href") {
144
+		$result="\nfunction getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}";
145
+		$result.="\nvar myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
146 146
 		return $result;
147 147
 	}
148 148
 
149
-	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader = false, $history = null) {
150
-		$retour = "";
151
-		$call = null;
149
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader=false, $history=null) {
150
+		$retour="";
151
+		$call=null;
152 152
 		if (JString::isNotNull($responseElement)) {
153 153
 			if (isset($ajaxTransition)) {
154
-				$call = $this->setAjaxDataCall($ajaxTransition);
154
+				$call=$this->setAjaxDataCall($ajaxTransition);
155 155
 			} elseif (isset($this->ajaxTransition)) {
156
-				$call = $this->ajaxTransition;
156
+				$call=$this->ajaxTransition;
157 157
 			}
158 158
 			if (\is_callable($call))
159
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
159
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
160 160
 			else
161
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
161
+				$retour="\t{$responseElement}.{$jqueryDone}( data );\n";
162 162
 		}
163 163
 		if (isset($history)) {
164 164
 			if ($this->params["autoActiveLinks"]) {
165
-				$retour .= $this->autoActiveLinks("url");
165
+				$retour.=$this->autoActiveLinks("url");
166 166
 			}
167
-			$retour .= "\nwindow.history.pushState({'html':data,'selector':" . Javascript::prep_value($history) . ",'jqueryDone':'{$jqueryDone}'},'', url);";
167
+			$retour.="\nwindow.history.pushState({'html':data,'selector':".Javascript::prep_value($history).",'jqueryDone':'{$jqueryDone}'},'', url);";
168 168
 		}
169
-		if ($hasLoader === 'internal') {
170
-			$retour .= "\n$(self).removeClass('loading');";
171
-		} elseif ($hasLoader === 'internal-x') {
172
-			$retour .= "\n$(self).children('.ajax-loader').remove();";
169
+		if ($hasLoader==='internal') {
170
+			$retour.="\n$(self).removeClass('loading');";
171
+		} elseif ($hasLoader==='internal-x') {
172
+			$retour.="\n$(self).children('.ajax-loader').remove();";
173 173
 		}
174
-		$retour .= "\t" . $jsCallback . "\n";
174
+		$retour.="\t".$jsCallback."\n";
175 175
 		return $retour;
176 176
 	}
177 177
 
178 178
 	protected function _getResponseElement($responseElement) {
179 179
 		if (JString::isNotNull($responseElement)) {
180
-			$responseElement = Javascript::prep_jquery_selector($responseElement);
180
+			$responseElement=Javascript::prep_jquery_selector($responseElement);
181 181
 		}
182 182
 		return $responseElement;
183 183
 	}
184 184
 
185 185
 	protected function _correctAjaxUrl($url) {
186
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
187
-			$url = substr($url, 0, strlen($url) - 1);
188
-		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
189
-			$url = $this->getUrl($url);
186
+		if ($url!=="/" && JString::endsWith($url, "/")===true)
187
+			$url=substr($url, 0, strlen($url)-1);
188
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
189
+			$url=$this->getUrl($url);
190 190
 		}
191 191
 		return $url;
192 192
 	}
193 193
 
194
-	public static function _correctParams($params, $ajaxParameters = []) {
194
+	public static function _correctParams($params, $ajaxParameters=[]) {
195 195
 		if (JString::isNull($params)) {
196 196
 			return "";
197 197
 		}
198 198
 		if (\preg_match("@^\{.*?\}$@", $params)) {
199
-			if (! isset($ajaxParameters['contentType']) || ! JString::contains($ajaxParameters['contentType'], 'json')) {
200
-				return '$.param(' . $params . ')';
199
+			if (!isset($ajaxParameters['contentType']) || !JString::contains($ajaxParameters['contentType'], 'json')) {
200
+				return '$.param('.$params.')';
201 201
 			} else {
202
-				return 'JSON.stringify(' . $params . ')';
202
+				return 'JSON.stringify('.$params.')';
203 203
 			}
204 204
 		}
205 205
 		return $params;
206 206
 	}
207 207
 
208 208
 	public static function _implodeParams($parameters) {
209
-		$allParameters = [];
209
+		$allParameters=[];
210 210
 		foreach ($parameters as $params) {
211 211
 			if (isset($params))
212
-				$allParameters[] = self::_correctParams($params);
212
+				$allParameters[]=self::_correctParams($params);
213 213
 		}
214 214
 		return \implode("+'&'+", $allParameters);
215 215
 	}
216 216
 
217
-	protected function addLoading(&$retour, $responseElement, $ajaxLoader = null) {
218
-		if (! isset($ajaxLoader)) {
219
-			$ajaxLoader = $this->ajaxLoader;
217
+	protected function addLoading(&$retour, $responseElement, $ajaxLoader=null) {
218
+		if (!isset($ajaxLoader)) {
219
+			$ajaxLoader=$this->ajaxLoader;
220 220
 		}
221
-		$loading_notifier = '<div class="ajax-loader ui active inverted dimmer">' . $ajaxLoader . '</div>';
222
-		$retour .= "\t\t{$responseElement}.append('{$loading_notifier}');\n";
221
+		$loading_notifier='<div class="ajax-loader ui active inverted dimmer">'.$ajaxLoader.'</div>';
222
+		$retour.="\t\t{$responseElement}.append('{$loading_notifier}');\n";
223 223
 	}
224 224
 
225
-	protected function addResponseLoading(&$retour, $responseElement, $ajaxLoader = null) {
226
-		if (! isset($ajaxLoader)) {
227
-			$ajaxLoader = $this->ajaxLoader;
225
+	protected function addResponseLoading(&$retour, $responseElement, $ajaxLoader=null) {
226
+		if (!isset($ajaxLoader)) {
227
+			$ajaxLoader=$this->ajaxLoader;
228 228
 		}
229
-		$loading_notifier = '<div class="ajax-loader">' . $ajaxLoader . '</div>';
230
-		$retour .= "{$responseElement}.empty();\n";
231
-		$retour .= "\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
229
+		$loading_notifier='<div class="ajax-loader">'.$ajaxLoader.'</div>';
230
+		$retour.="{$responseElement}.empty();\n";
231
+		$retour.="\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
232 232
 	}
233 233
 
234 234
 	protected function setAjaxDataCall($params) {
235
-		$result = null;
236
-		if (! \is_callable($params)) {
237
-			$result = function ($responseElement, $jqueryDone = 'html') use ($params) {
235
+		$result=null;
236
+		if (!\is_callable($params)) {
237
+			$result=function($responseElement, $jqueryDone='html') use ($params) {
238 238
 				return AjaxTransition::{$params}($responseElement, $jqueryDone);
239 239
 			};
240 240
 		}
@@ -243,13 +243,13 @@  discard block
 block discarded – undo
243 243
 
244 244
 	protected function setDefaultParameters(&$parameters, $default) {
245 245
 		foreach ($default as $k => $v) {
246
-			if (! isset($parameters[$k]))
247
-				$parameters[$k] = $v;
246
+			if (!isset($parameters[$k]))
247
+				$parameters[$k]=$v;
248 248
 		}
249 249
 	}
250 250
 
251 251
 	public function setAjaxLoader($loader) {
252
-		$this->ajaxLoader = $loader;
252
+		$this->ajaxLoader=$loader;
253 253
 	}
254 254
 
255 255
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @param string $responseElement
261 261
 	 *        	selector of the HTML element displaying the answer
262 262
 	 */
263
-	private function _get($url, $responseElement = '', $parameters = []) {
263
+	private function _get($url, $responseElement='', $parameters=[]) {
264 264
 		return $this->_ajax('get', $url, $responseElement, $parameters);
265 265
 	}
266 266
 
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @param array $parameters
275 275
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
276 276
 	 */
277
-	public function get($url, $responseElement = '', $parameters = []) {
278
-		$parameters['immediatly'] = true;
277
+	public function get($url, $responseElement='', $parameters=[]) {
278
+		$parameters['immediatly']=true;
279 279
 		return $this->_get($url, $responseElement, $parameters);
280 280
 	}
281 281
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param array $parameters
292 292
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
293 293
 	 */
294
-	public function ajax($method, $url, $responseElement = '', $parameters = []) {
295
-		$parameters['immediatly'] = true;
294
+	public function ajax($method, $url, $responseElement='', $parameters=[]) {
295
+		$parameters['immediatly']=true;
296 296
 		return $this->_ajax($method, $url, $responseElement, $parameters);
297 297
 	}
298 298
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 *        	$immediatly
315 315
 	 * @return string
316 316
 	 */
317
-	public function ajaxInterval($method, $url, $interval, $globalName = null, $responseElement = '', $parameters = [], $immediatly = true) {
317
+	public function ajaxInterval($method, $url, $interval, $globalName=null, $responseElement='', $parameters=[], $immediatly=true) {
318 318
 		return $this->interval($this->ajaxDeferred($method, $url, $responseElement, $parameters), $interval, $globalName, $immediatly);
319 319
 	}
320 320
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @param array $parameters
331 331
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
332 332
 	 */
333
-	public function ajaxDeferred($method, $url, $responseElement = '', $parameters = []) {
334
-		$parameters['immediatly'] = false;
333
+	public function ajaxDeferred($method, $url, $responseElement='', $parameters=[]) {
334
+		$parameters['immediatly']=false;
335 335
 		return $this->_ajax($method, $url, $responseElement, $parameters);
336 336
 	}
337 337
 
@@ -345,15 +345,15 @@  discard block
 block discarded – undo
345 345
 	 * @param array $parameters
346 346
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
347 347
 	 */
348
-	private function _json($url, $method = "get", $parameters = []) {
349
-		$parameters = \array_merge($parameters, [
348
+	private function _json($url, $method="get", $parameters=[]) {
349
+		$parameters=\array_merge($parameters, [
350 350
 			"hasLoader" => false
351 351
 		]);
352
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
353
-		$context = isset($parameters['context']) ? $parameters['context'] : "document";
354
-		$retour = "\tdata=($.isPlainObject(data))?data:JSON.parse(data);\t" . $jsCallback . ";" . "\n\tfor(var key in data){" . "if($('#'+key," . $context . ").length){ if($('#'+key," . $context . ").is('[value]')) { $('#'+key," . $context . ").val(data[key]);} else { $('#'+key," . $context . ").html(data[key]); }}};\n";
355
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
356
-		$parameters["jsCallback"] = $retour;
352
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
353
+		$context=isset($parameters['context']) ? $parameters['context'] : "document";
354
+		$retour="\tdata=($.isPlainObject(data))?data:JSON.parse(data);\t".$jsCallback.";"."\n\tfor(var key in data){"."if($('#'+key,".$context.").length){ if($('#'+key,".$context.").is('[value]')) { $('#'+key,".$context.").val(data[key]);} else { $('#'+key,".$context.").html(data[key]); }}};\n";
355
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
356
+		$parameters["jsCallback"]=$retour;
357 357
 		return $this->_ajax($method, $url, null, $parameters);
358 358
 	}
359 359
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @param array $parameters
368 368
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
369 369
 	 */
370
-	public function json($url, $method = "get", $parameters = []) {
370
+	public function json($url, $method="get", $parameters=[]) {
371 371
 		return $this->_json($url, $method, $parameters);
372 372
 	}
373 373
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @param array $parameters
384 384
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true,"before"=>null,"listenerOn"=>false)
385 385
 	 */
386
-	public function jsonOn($event, $element, $url, $method = 'get', $parameters = array()) {
386
+	public function jsonOn($event, $element, $url, $method='get', $parameters=array()) {
387 387
 		$this->setDefaultParameters($parameters, [
388 388
 			'preventDefault' => true,
389 389
 			'stopPropagation' => true,
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 	 * @param array $parameters
404 404
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>"document","jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"before"=>null)
405 405
 	 */
406
-	public function jsonDeferred($url, $method = 'get', $parameters = []) {
407
-		$parameters['immediatly'] = false;
406
+	public function jsonDeferred($url, $method='get', $parameters=[]) {
407
+		$parameters['immediatly']=false;
408 408
 		return $this->_json($url, $method, $parameters);
409 409
 	}
410 410
 
@@ -419,29 +419,29 @@  discard block
 block discarded – undo
419 419
 	 * @param array $parameters
420 420
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
421 421
 	 */
422
-	private function _jsonArray($maskSelector, $url, $method = 'get', $parameters = []) {
423
-		$parameters = \array_merge($parameters, [
422
+	private function _jsonArray($maskSelector, $url, $method='get', $parameters=[]) {
423
+		$parameters=\array_merge($parameters, [
424 424
 			"hasLoader" => false
425 425
 		]);
426
-		$rowClass = isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
427
-		$jsCallback = isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
428
-		$context = isset($parameters['context']) ? $parameters['context'] : null;
429
-		if ($context === null) {
430
-			$parent = "$('" . $maskSelector . "').parent()";
431
-			$newElm = "$('#'+newId)";
426
+		$rowClass=isset($parameters['rowClass']) ? $parameters['rowClass'] : "_json";
427
+		$jsCallback=isset($parameters['jsCallback']) ? $parameters['jsCallback'] : "";
428
+		$context=isset($parameters['context']) ? $parameters['context'] : null;
429
+		if ($context===null) {
430
+			$parent="$('".$maskSelector."').parent()";
431
+			$newElm="$('#'+newId)";
432 432
 		} else {
433
-			$parent = $context;
434
-			$newElm = $context . ".find('#'+newId)";
433
+			$parent=$context;
434
+			$newElm=$context.".find('#'+newId)";
435 435
 		}
436
-		$appendTo = "\t\tnewElm.appendTo(" . $parent . ");\n";
437
-		$retour = $parent . ".find('.{$rowClass}').remove();";
438
-		$retour .= "\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.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();
436
+		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
437
+		$retour=$parent.".find('.{$rowClass}').remove();";
438
+		$retour.="\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.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();
439 439
 		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";
440
-		$retour .= $appendTo;
441
-		$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";
442
-		$retour .= "\t$(document).trigger('jsonReady',[data]);\n";
443
-		$retour .= "\t" . $jsCallback;
444
-		$parameters["jsCallback"] = $retour;
440
+		$retour.=$appendTo;
441
+		$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";
442
+		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
443
+		$retour.="\t".$jsCallback;
444
+		$parameters["jsCallback"]=$retour;
445 445
 		return $this->_ajax($method, $url, null, $parameters);
446 446
 	}
447 447
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 * @param array $parameters
457 457
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"immediatly"=>false,"rowClass"=>"_json","before"=>null)
458 458
 	 */
459
-	public function jsonArray($maskSelector, $url, $method = 'get', $parameters = []) {
459
+	public function jsonArray($maskSelector, $url, $method='get', $parameters=[]) {
460 460
 		return $this->_jsonArray($maskSelector, $url, $method, $parameters);
461 461
 	}
462 462
 
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 	 * @param array $parameters
472 472
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","context"=>null,"jsCondition"=>NULL,"headers"=>null,"rowClass"=>"_json","before"=>null)
473 473
 	 */
474
-	public function jsonArrayDeferred($maskSelector, $url, $method = 'get', $parameters = []) {
475
-		$parameters['immediatly'] = false;
474
+	public function jsonArrayDeferred($maskSelector, $url, $method='get', $parameters=[]) {
475
+		$parameters['immediatly']=false;
476 476
 		return $this->jsonArray($maskSelector, $url, $method, $parameters);
477 477
 	}
478 478
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 * @param array $parameters
489 489
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true,"before"=>null,"listenerOn"=>false)
490 490
 	 */
491
-	public function jsonArrayOn($event, $element, $maskSelector, $url, $method = 'get', $parameters = array()) {
491
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $method='get', $parameters=array()) {
492 492
 		$this->setDefaultParameters($parameters, [
493 493
 			'preventDefault' => true,
494 494
 			'stopPropagation' => true,
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	 * @param array $parameters
510 510
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
511 511
 	 */
512
-	public function getDeferred($url, $responseElement = "", $parameters = []) {
513
-		$parameters['immediatly'] = false;
512
+	public function getDeferred($url, $responseElement="", $parameters=[]) {
513
+		$parameters['immediatly']=false;
514 514
 		return $this->_get($url, $responseElement, $parameters);
515 515
 	}
516 516
 
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 	 * @param array $parameters
530 530
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
531 531
 	 */
532
-	public function getOn($event, $element, $url, $responseElement = "", $parameters = array()) {
533
-		$parameters['method'] = 'get';
532
+	public function getOn($event, $element, $url, $responseElement="", $parameters=array()) {
533
+		$parameters['method']='get';
534 534
 		return $this->ajaxOn($event, $element, $url, $responseElement, $parameters);
535 535
 	}
536 536
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 * @param array $parameters
550 550
 	 *        	default : array("method"=>"get","preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
551 551
 	 */
552
-	public function ajaxOn($event, $element, $url, $responseElement = '', $parameters = array()) {
552
+	public function ajaxOn($event, $element, $url, $responseElement='', $parameters=array()) {
553 553
 		$this->setDefaultParameters($parameters, [
554 554
 			'preventDefault' => true,
555 555
 			'stopPropagation' => true,
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 	 * @param array $parameters
574 574
 	 *        	default : array("method"=>"get","preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
575 575
 	 */
576
-	public function ajaxOnClick($element, $url, $responseElement = '', $parameters = array()) {
576
+	public function ajaxOnClick($element, $url, $responseElement='', $parameters=array()) {
577 577
 		return $this->ajaxOn('click', $element, $url, $responseElement, $parameters);
578 578
 	}
579 579
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 * @param array $parameters
591 591
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
592 592
 	 */
593
-	public function getOnClick($element, $url, $responseElement = '', $parameters = array()) {
593
+	public function getOnClick($element, $url, $responseElement='', $parameters=array()) {
594 594
 		return $this->getOn('click', $element, $url, $responseElement, $parameters);
595 595
 	}
596 596
 
@@ -605,15 +605,15 @@  discard block
 block discarded – undo
605 605
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>true,"before"=>null)
606 606
 	 * @return $this
607 607
 	 */
608
-	public function getHref($element, $responseElement = "", $parameters = array()) {
609
-		$parameters['attr'] = 'href';
608
+	public function getHref($element, $responseElement="", $parameters=array()) {
609
+		$parameters['attr']='href';
610 610
 		if (JString::isNull($responseElement)) {
611
-			$responseElement = '%$(self).attr("data-target")%';
611
+			$responseElement='%$(self).attr("data-target")%';
612 612
 		} else {
613
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
613
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
614 614
 		}
615
-		if (! isset($parameters['historize'])) {
616
-			$parameters['historize'] = true;
615
+		if (!isset($parameters['historize'])) {
616
+			$parameters['historize']=true;
617 617
 		}
618 618
 		return $this->getOnClick($element, "", $responseElement, $parameters);
619 619
 	}
@@ -629,21 +629,21 @@  discard block
 block discarded – undo
629 629
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>true,"before"=>null)
630 630
 	 * @return $this
631 631
 	 */
632
-	public function postHref($element, $responseElement = "", $parameters = array()) {
633
-		$parameters['attr'] = 'href';
632
+	public function postHref($element, $responseElement="", $parameters=array()) {
633
+		$parameters['attr']='href';
634 634
 		if (JString::isNull($responseElement)) {
635
-			$responseElement = '%$(this).attr("data-target")%';
635
+			$responseElement='%$(this).attr("data-target")%';
636 636
 		} else {
637
-			$responseElement = '%$(self).attr("data-target") || "' . $responseElement . '"%';
637
+			$responseElement='%$(self).attr("data-target") || "'.$responseElement.'"%';
638 638
 		}
639
-		if (! isset($parameters['historize'])) {
640
-			$parameters['historize'] = true;
639
+		if (!isset($parameters['historize'])) {
640
+			$parameters['historize']=true;
641 641
 		}
642 642
 		return $this->postOnClick($element, '', '{}', $responseElement, $parameters);
643 643
 	}
644 644
 
645
-	private function _post($url, $params = '{}', $responseElement = '', $parameters = []) {
646
-		$parameters['params'] = $params;
645
+	private function _post($url, $params='{}', $responseElement='', $parameters=[]) {
646
+		$parameters['params']=$params;
647 647
 		return $this->_ajax('POST', $url, $responseElement, $parameters);
648 648
 	}
649 649
 
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
 	 * @param array $parameters
660 660
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
661 661
 	 */
662
-	public function post($url, $params = "{}", $responseElement = "", $parameters = []) {
663
-		$parameters['immediatly'] = true;
662
+	public function post($url, $params="{}", $responseElement="", $parameters=[]) {
663
+		$parameters['immediatly']=true;
664 664
 		return $this->_post($url, $params, $responseElement, $parameters);
665 665
 	}
666 666
 
@@ -677,8 +677,8 @@  discard block
 block discarded – undo
677 677
 	 * @param array $parameters
678 678
 	 *        	default : array("jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
679 679
 	 */
680
-	public function postDeferred($url, $params = "{}", $responseElement = "", $parameters = []) {
681
-		$parameters['immediatly'] = false;
680
+	public function postDeferred($url, $params="{}", $responseElement="", $parameters=[]) {
681
+		$parameters['immediatly']=false;
682 682
 		return $this->_post($url, $params, $responseElement, $parameters);
683 683
 	}
684 684
 
@@ -697,9 +697,9 @@  discard block
 block discarded – undo
697 697
 	 * @param array $parameters
698 698
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
699 699
 	 */
700
-	public function postOn($event, $element, $url, $params = "{}", $responseElement = "", $parameters = array()) {
701
-		$parameters['method'] = 'post';
702
-		$parameters['params'] = $params;
700
+	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
701
+		$parameters['method']='post';
702
+		$parameters['params']=$params;
703 703
 		return $this->ajaxOn($event, $element, $url, $responseElement, $parameters);
704 704
 	}
705 705
 
@@ -717,66 +717,66 @@  discard block
 block discarded – undo
717 717
 	 * @param array $parameters
718 718
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null,"before"=>null,"listenerOn"=>false)
719 719
 	 */
720
-	public function postOnClick($element, $url, $params = '{}', $responseElement = '', $parameters = array()) {
720
+	public function postOnClick($element, $url, $params='{}', $responseElement='', $parameters=array()) {
721 721
 		return $this->postOn('click', $element, $url, $params, $responseElement, $parameters);
722 722
 	}
723 723
 
724
-	private function _postForm($url, $form, $responseElement, $parameters = []) {
724
+	private function _postForm($url, $form, $responseElement, $parameters=[]) {
725 725
 		if (isset($this->params['ajax'])) {
726 726
 			extract($this->params['ajax']);
727 727
 		}
728
-		$params = '{}';
729
-		$validation = false;
728
+		$params='{}';
729
+		$validation=false;
730 730
 		\extract($parameters);
731
-		$async = ($async) ? 'true' : 'false';
732
-		$jsCallback = isset($jsCallback) ? $jsCallback : "";
733
-		$retour = $this->_getAjaxUrl($url, $attr);
734
-		$retour .= "\n$('#" . $form . "').trigger('ajaxSubmit');";
735
-		if (! isset($contentType) || $contentType != 'false') {
736
-			$retour .= "\nvar params=$('#" . $form . "').serialize();\n";
731
+		$async=($async) ? 'true' : 'false';
732
+		$jsCallback=isset($jsCallback) ? $jsCallback : "";
733
+		$retour=$this->_getAjaxUrl($url, $attr);
734
+		$retour.="\n$('#".$form."').trigger('ajaxSubmit');";
735
+		if (!isset($contentType) || $contentType!='false') {
736
+			$retour.="\nvar params=$('#".$form."').serialize();\n";
737 737
 			if (isset($params)) {
738
-				$retour .= "params+='&'+" . self::_correctParams($params) . ";\n";
738
+				$retour.="params+='&'+".self::_correctParams($params).";\n";
739 739
 			}
740 740
 		} else {
741
-			$retour .= "\nvar params=new FormData($('#" . $form . "')[0]);\n";
741
+			$retour.="\nvar params=new FormData($('#".$form."')[0]);\n";
742 742
 		}
743
-		$responseElement = $this->_getResponseElement($responseElement);
744
-		$retour .= "var self=this;\n";
745
-		$before = isset($before) ? $before : "";
746
-		$retour .= $before;
747
-		if ($hasLoader === true) {
743
+		$responseElement=$this->_getResponseElement($responseElement);
744
+		$retour.="var self=this;\n";
745
+		$before=isset($before) ? $before : "";
746
+		$retour.=$before;
747
+		if ($hasLoader===true) {
748 748
 			$this->addLoading($retour, $responseElement, $ajaxLoader);
749
-		} elseif ($hasLoader === 'response') {
749
+		} elseif ($hasLoader==='response') {
750 750
 			$this->addResponseLoading($retour, $responseElement, $ajaxLoader);
751
-		} elseif ($hasLoader === 'internal') {
752
-			$retour .= "\n$(this).addClass('loading');";
751
+		} elseif ($hasLoader==='internal') {
752
+			$retour.="\n$(this).addClass('loading');";
753 753
 		}
754
-		$ajaxParameters = [
754
+		$ajaxParameters=[
755 755
 			"url" => "url",
756 756
 			"method" => "'POST'",
757 757
 			"data" => "params",
758 758
 			"async" => $async
759 759
 		];
760 760
 		if (isset($headers)) {
761
-			$ajaxParameters["headers"] = $headers;
761
+			$ajaxParameters["headers"]=$headers;
762 762
 		}
763 763
 		if (isset($partial)) {
764
-			$ajaxParameters["xhr"] = "xhrProvider";
765
-			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
764
+			$ajaxParameters["xhr"]="xhrProvider";
765
+			$retour.="var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;".$partial.";}; };";
766 766
 		}
767 767
 		$this->createAjaxParameters($ajaxParameters, $parameters);
768
-		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data ) {\n";
769
-		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader) . "});\n";
768
+		$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data ) {\n";
769
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader)."});\n";
770 770
 
771 771
 		if ($validation) {
772
-			$retour = "$('#" . $form . "').validate({submitHandler: function(form) {
773
-			" . $retour . "
772
+			$retour="$('#".$form."').validate({submitHandler: function(form) {
773
+			" . $retour."
774 774
 			}});\n";
775
-			$retour .= "$('#" . $form . "').submit();\n";
775
+			$retour.="$('#".$form."').submit();\n";
776 776
 		}
777
-		$retour = $this->_addJsCondition($jsCondition, $retour);
777
+		$retour=$this->_addJsCondition($jsCondition, $retour);
778 778
 		if ($immediatly)
779
-			$this->jquery_code_for_compile[] = $retour;
779
+			$this->jquery_code_for_compile[]=$retour;
780 780
 		return $retour;
781 781
 	}
782 782
 
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 	 * @param array $parameters
793 793
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
794 794
 	 */
795
-	public function postForm($url, $form, $responseElement, $parameters = []) {
796
-		$parameters['immediatly'] = true;
795
+	public function postForm($url, $form, $responseElement, $parameters=[]) {
796
+		$parameters['immediatly']=true;
797 797
 		return $this->_postForm($url, $form, $responseElement, $parameters);
798 798
 	}
799 799
 
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 	 * @param array $parameters
811 811
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false,"before"=>null)
812 812
 	 */
813
-	public function postFormDeferred($url, $form, $responseElement, $parameters = []) {
814
-		$parameters['immediatly'] = false;
813
+	public function postFormDeferred($url, $form, $responseElement, $parameters=[]) {
814
+		$parameters['immediatly']=false;
815 815
 		return $this->_postForm($url, $form, $responseElement, $parameters);
816 816
 	}
817 817
 
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 	 * @param array $parameters
829 829
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
830 830
 	 */
831
-	public function postFormOn($event, $element, $url, $form, $responseElement = "", $parameters = array()) {
831
+	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
832 832
 		$this->setDefaultParameters($parameters, [
833 833
 			'preventDefault' => true,
834 834
 			'stopPropagation' => true,
@@ -850,11 +850,11 @@  discard block
 block discarded – undo
850 850
 	 * @param array $parameters
851 851
 	 *        	default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false,"before"=>null,"listenerOn"=>false)
852 852
 	 */
853
-	public function postFormOnClick($element, $url, $form, $responseElement = "", $parameters = array()) {
853
+	public function postFormOnClick($element, $url, $form, $responseElement="", $parameters=array()) {
854 854
 		return $this->postFormOn("click", $element, $url, $form, $responseElement, $parameters);
855 855
 	}
856 856
 
857
-	public function addCsrf($name = 'csrf-token') {
857
+	public function addCsrf($name='csrf-token') {
858 858
 		return "
859 859
 		$.ajaxSetup({
860 860
 			beforeSend: function(xhr, settings) {
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  */
37 37
 trait FieldAsTrait {
38 38
 
39
-	abstract protected function _getFieldIdentifier($prefix, $name = "");
39
+	abstract protected function _getFieldIdentifier($prefix, $name="");
40 40
 
41 41
 	abstract public function setValueFunction($index, $callback);
42 42
 
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 
45 45
 	abstract protected function _getFieldCaption($index);
46 46
 
47
-	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement = NULL, $parameters = NULL);
47
+	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL);
48 48
 
49 49
 	/**
50 50
 	 *
51 51
 	 * @param HtmlFormField $element
52 52
 	 * @param array $attributes
53 53
 	 */
54
-	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance = null) {
54
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) {
55 55
 		if (isset($attributes["jsCallback"])) {
56
-			$callback = $attributes["jsCallback"];
56
+			$callback=$attributes["jsCallback"];
57 57
 			if (\is_callable($callback)) {
58 58
 				$callback($element, $instance, $index, InstanceViewer::$index);
59 59
 			}
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 		$element->fromArray($attributes);
65 65
 	}
66 66
 
67
-	private function _getLabelField($caption, $icon = NULL) {
68
-		$label = new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
67
+	private function _getLabelField($caption, $icon=NULL) {
68
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
69 69
 		return $label;
70 70
 	}
71 71
 
72 72
 	protected function _addRules(HtmlFormField $element, &$attributes) {
73 73
 		if (isset($attributes["rules"])) {
74
-			$this->_hasRules = true;
75
-			$rules = $attributes["rules"];
74
+			$this->_hasRules=true;
75
+			$rules=$attributes["rules"];
76 76
 			if (\is_array($rules)) {
77 77
 				$element->addRules($rules);
78 78
 			} else {
@@ -88,62 +88,62 @@  discard block
 block discarded – undo
88 88
 		return $field;
89 89
 	}
90 90
 
91
-	protected function _fieldAs($elementCallback, &$index, $attributes = NULL, $prefix = null) {
92
-		$this->setValueFunction($index, function ($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) {
93
-			$caption = $this->_getFieldCaption($index);
94
-			$name = $this->_getFieldName($index);
95
-			$id = $this->_getFieldIdentifier($prefix, $name);
91
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
92
+		$this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) {
93
+			$caption=$this->_getFieldCaption($index);
94
+			$name=$this->_getFieldName($index);
95
+			$id=$this->_getFieldIdentifier($prefix, $name);
96 96
 			if (isset($attributes["name"])) {
97
-				$name = $attributes["name"];
97
+				$name=$attributes["name"];
98 98
 				unset($attributes["name"]);
99 99
 			}
100
-			$element = $elementCallback($id, $name, $value, $caption);
100
+			$element=$elementCallback($id, $name, $value, $caption);
101 101
 			if (\is_array($attributes)) {
102 102
 				$this->_applyAttributes($element, $attributes, $index, $instance);
103 103
 			}
104
-			$element->setDisabled(! $this->_edition);
104
+			$element->setDisabled(!$this->_edition);
105 105
 			return $element;
106 106
 		});
107 107
 		return $this;
108 108
 	}
109 109
 
110
-	public function fieldAsProgress($index, $label = NULL, $attributes = array()) {
111
-		$this->setValueFunction($index, function ($value) use ($label, $attributes) {
112
-			$pb = new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
110
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
111
+		$this->setValueFunction($index, function($value) use ($label, $attributes) {
112
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
113 113
 			return $pb;
114 114
 		});
115 115
 		return $this;
116 116
 	}
117 117
 
118
-	public function fieldAsRating($index, $max = 5, $icon = "") {
119
-		$this->setValueFunction($index, function ($value) use ($max, $icon) {
120
-			$rating = new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
118
+	public function fieldAsRating($index, $max=5, $icon="") {
119
+		$this->setValueFunction($index, function($value) use ($max, $icon) {
120
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
121 121
 			return $rating;
122 122
 		});
123 123
 		return $this;
124 124
 	}
125 125
 
126
-	public function fieldAsLabel($index, $icon = NULL, $attributes = NULL) {
127
-		return $this->_fieldAs(function ($id, $name, $value) use ($icon) {
128
-			$lbl = new HtmlLabel($id, $value);
126
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
127
+		return $this->_fieldAs(function($id, $name, $value) use ($icon) {
128
+			$lbl=new HtmlLabel($id, $value);
129 129
 			if (isset($icon))
130 130
 				$lbl->addIcon($icon);
131 131
 			return $lbl;
132 132
 		}, $index, $attributes, "label");
133 133
 	}
134 134
 
135
-	public function fieldAsHeader($index, $niveau = 1, $icon = NULL, $attributes = NULL) {
136
-		return $this->_fieldAs(function ($id, $name, $value) use ($niveau, $icon) {
137
-			$header = new HtmlHeader($id, $niveau, $value);
135
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
136
+		return $this->_fieldAs(function($id, $name, $value) use ($niveau, $icon) {
137
+			$header=new HtmlHeader($id, $niveau, $value);
138 138
 			if (isset($icon))
139 139
 				$header->asIcon($icon, $value);
140 140
 			return $header;
141 141
 		}, $index, $attributes, "header");
142 142
 	}
143 143
 
144
-	public function fieldAsImage($index, $size = Size::MINI, $circular = false) {
145
-		$this->setValueFunction($index, function ($img) use ($size, $circular) {
146
-			$image = new HtmlImage($this->_getFieldIdentifier("image"), $img);
144
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
145
+		$this->setValueFunction($index, function($img) use ($size, $circular) {
146
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img);
147 147
 			$image->setSize($size);
148 148
 			if ($circular)
149 149
 				$image->setCircular();
@@ -153,65 +153,65 @@  discard block
 block discarded – undo
153 153
 	}
154 154
 
155 155
 	public function fieldAsFlag($index) {
156
-		$this->setValueFunction($index, function ($flag) {
157
-			$flag = new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
156
+		$this->setValueFunction($index, function($flag) {
157
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
158 158
 			return $flag;
159 159
 		});
160 160
 		return $this;
161 161
 	}
162 162
 
163 163
 	public function fieldAsIcon($index) {
164
-		$this->setValueFunction($index, function ($icon) {
165
-			$icon = new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
164
+		$this->setValueFunction($index, function($icon) {
165
+			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
166 166
 			return $icon;
167 167
 		});
168 168
 		return $this;
169 169
 	}
170 170
 
171
-	public function fieldAsAvatar($index, $attributes = NULL) {
172
-		return $this->_fieldAs(function ($id, $name, $value) {
173
-			$img = new HtmlImage($id, $value);
171
+	public function fieldAsAvatar($index, $attributes=NULL) {
172
+		return $this->_fieldAs(function($id, $name, $value) {
173
+			$img=new HtmlImage($id, $value);
174 174
 			$img->asAvatar();
175 175
 			return $img;
176 176
 		}, $index, $attributes, "avatar");
177 177
 	}
178 178
 
179
-	public function fieldAsRadio($index, $attributes = NULL) {
180
-		return $this->_fieldAs(function ($id, $name, $value) use ($attributes) {
181
-			$input = new HtmlFormRadio($id, $name, $value, $value);
179
+	public function fieldAsRadio($index, $attributes=NULL) {
180
+		return $this->_fieldAs(function($id, $name, $value) use ($attributes) {
181
+			$input=new HtmlFormRadio($id, $name, $value, $value);
182 182
 			return $this->_prepareFormFields($input, $name, $attributes);
183 183
 		}, $index, $attributes, "radio");
184 184
 	}
185 185
 
186
-	public function fieldAsRadios($index, $elements = [], $attributes = NULL) {
187
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements) {
186
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
187
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements) {
188 188
 			return HtmlFormFields::radios($name, $elements, $caption, $value);
189 189
 		}, $index, $attributes, "radios");
190 190
 	}
191 191
 
192
-	public function fieldAsList($index, $classNames = "", $attributes = NULL) {
193
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($classNames) {
194
-			$result = new HtmlList($name, $value);
192
+	public function fieldAsList($index, $classNames="", $attributes=NULL) {
193
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($classNames) {
194
+			$result=new HtmlList($name, $value);
195 195
 			$result->addClass($classNames);
196 196
 			return $result;
197 197
 		}, $index, $attributes, "list");
198 198
 	}
199 199
 
200
-	public function fieldAsInput($index, $attributes = NULL) {
201
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
202
-			$input = new HtmlFormInput($id, $caption, "text", $value);
200
+	public function fieldAsInput($index, $attributes=NULL) {
201
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
202
+			$input=new HtmlFormInput($id, $caption, "text", $value);
203 203
 			return $this->_prepareFormFields($input, $name, $attributes);
204 204
 		}, $index, $attributes, "input");
205 205
 	}
206 206
 
207
-	public function fieldAsLabeledInput($index, $attributes = NULL) {
208
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
209
-			$input = new HtmlFormInput($id, '', 'text', $value, $caption);
210
-			$required = '';
207
+	public function fieldAsLabeledInput($index, $attributes=NULL) {
208
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
209
+			$input=new HtmlFormInput($id, '', 'text', $value, $caption);
210
+			$required='';
211 211
 			if (isset($attributes['rules'])) {
212
-				$rules = json_encode($attributes['rules']);
213
-				if (strpos($rules, 'empty') !== false) {
214
-					$required = 'required';
212
+				$rules=json_encode($attributes['rules']);
213
+				if (strpos($rules, 'empty')!==false) {
214
+					$required='required';
215 215
 				}
216 216
 			}
217 217
 			$input->getField()
@@ -222,80 +222,80 @@  discard block
 block discarded – undo
222 222
 		}, $index, $attributes, 'input');
223 223
 	}
224 224
 
225
-	public function fieldAsDataList($index, ?array $items = [], $attributes = NULL) {
226
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $items) {
227
-			$input = new HtmlFormInput($id, $caption, "text", $value);
225
+	public function fieldAsDataList($index, ?array $items=[], $attributes=NULL) {
226
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $items) {
227
+			$input=new HtmlFormInput($id, $caption, "text", $value);
228 228
 			$input->getField()
229 229
 				->addDataList($items);
230 230
 			return $this->_prepareFormFields($input, $name, $attributes);
231 231
 		}, $index, $attributes, "input");
232 232
 	}
233 233
 
234
-	public function fieldAsFile($index, $attributes = NULL) {
234
+	public function fieldAsFile($index, $attributes=NULL) {
235 235
 		if (isset($this->_form)) {
236 236
 			$this->_form->setProperty('enctype', 'multipart/form-data');
237 237
 		}
238
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
239
-			$input = new HtmlFormInput($id, $caption);
238
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
239
+			$input=new HtmlFormInput($id, $caption);
240 240
 			$input->asFile();
241 241
 			return $this->_prepareFormFields($input, $name, $attributes);
242 242
 		}, $index, $attributes, "input");
243 243
 	}
244 244
 
245
-	public function fieldAsTextarea($index, $attributes = NULL) {
246
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
247
-			$textarea = new HtmlFormTextarea($id, $caption, $value);
245
+	public function fieldAsTextarea($index, $attributes=NULL) {
246
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
247
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
248 248
 			return $this->_prepareFormFields($textarea, $name, $attributes);
249 249
 		}, $index, $attributes, "textarea");
250 250
 	}
251 251
 
252
-	public function fieldAsElement($index, $tagName = "div", $baseClass = "", $attributes = NULL) {
253
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) {
254
-			$div = new HtmlSemDoubleElement($id, $tagName, $baseClass);
252
+	public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) {
253
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) {
254
+			$div=new HtmlSemDoubleElement($id, $tagName, $baseClass);
255 255
 			$div->setContent(\htmlentities($value));
256
-			$textarea = new HtmlFormField("field-" . $id, $div, $caption);
256
+			$textarea=new HtmlFormField("field-".$id, $div, $caption);
257 257
 			return $this->_prepareFormFields($textarea, $name, $attributes);
258 258
 		}, $index, $attributes, "element");
259 259
 	}
260 260
 
261
-	public function fieldAsHidden($index, $attributes = NULL) {
262
-		if (! \is_array($attributes)) {
263
-			$attributes = [];
261
+	public function fieldAsHidden($index, $attributes=NULL) {
262
+		if (!\is_array($attributes)) {
263
+			$attributes=[];
264 264
 		}
265
-		$attributes["inputType"] = "hidden";
266
-		$attributes["style"] = "display:none;";
265
+		$attributes["inputType"]="hidden";
266
+		$attributes["style"]="display:none;";
267 267
 		return $this->fieldAsInput($index, $attributes);
268 268
 	}
269 269
 
270
-	public function fieldAsCheckbox($index, $attributes = NULL) {
271
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
272
-			if ($caption === null || $caption === "")
273
-				$caption = "";
274
-			$input = new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
270
+	public function fieldAsCheckbox($index, $attributes=NULL) {
271
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
272
+			if ($caption===null || $caption==="")
273
+				$caption="";
274
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
275 275
 			$input->setChecked(JString::isBooleanTrue($value));
276 276
 			return $this->_prepareFormFields($input, $name, $attributes);
277 277
 		}, $index, $attributes, "ck");
278 278
 	}
279 279
 
280
-	public function fieldAsDropDown($index, $elements = [], $multiple = false, $attributes = NULL) {
281
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements, $multiple, $attributes) {
282
-			$dd = new HtmlFormDropdown($id, $elements, $caption, $value ?? '');
280
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
281
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements, $multiple, $attributes) {
282
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value ?? '');
283 283
 			$dd->asSelect($name, $multiple);
284 284
 			return $this->_prepareFormFields($dd, $name, $attributes);
285 285
 		}, $index, $attributes, "dd");
286 286
 	}
287 287
 
288
-	public function fieldAsMessage($index, $attributes = NULL) {
289
-		return $this->_fieldAs(function ($id, $name, $value, $caption) {
290
-			$mess = new HtmlMessage("message-" . $id, $caption);
288
+	public function fieldAsMessage($index, $attributes=NULL) {
289
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
290
+			$mess=new HtmlMessage("message-".$id, $caption);
291 291
 			$mess->addHeader($value);
292 292
 			return $mess;
293 293
 		}, $index, $attributes, "message");
294 294
 	}
295 295
 
296
-	public function fieldAsLink($index, $attributes = NULL) {
297
-		return $this->_fieldAs(function ($id, $name, $value, $caption) {
298
-			$lnk = new HtmlLink("message-" . $id, "#", $caption);
296
+	public function fieldAsLink($index, $attributes=NULL) {
297
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
298
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
299 299
 			return $lnk;
300 300
 		}, $index, $attributes, "link");
301 301
 	}
@@ -307,28 +307,28 @@  discard block
 block discarded – undo
307 307
 	 *        	an array or associative array $type=>$attributes
308 308
 	 */
309 309
 	public function fieldsAs(array $types) {
310
-		$i = 0;
310
+		$i=0;
311 311
 		if (JArray::isAssociative($types)) {
312 312
 			foreach ($types as $type => $attributes) {
313 313
 				if (\is_int($type))
314
-					$this->fieldAs($i ++, $attributes, []);
314
+					$this->fieldAs($i++, $attributes, []);
315 315
 				else {
316
-					$type = preg_replace('/\d/', '', $type);
317
-					$this->fieldAs($i ++, $type, $attributes);
316
+					$type=preg_replace('/\d/', '', $type);
317
+					$this->fieldAs($i++, $type, $attributes);
318 318
 				}
319 319
 			}
320 320
 		} else {
321 321
 			foreach ($types as $type) {
322
-				$this->fieldAs($i ++, $type);
322
+				$this->fieldAs($i++, $type);
323 323
 			}
324 324
 		}
325 325
 	}
326 326
 
327
-	public function fieldAs($index, $type, $attributes = NULL) {
328
-		$method = "fieldAs" . \ucfirst($type);
327
+	public function fieldAs($index, $type, $attributes=NULL) {
328
+		$method="fieldAs".\ucfirst($type);
329 329
 		if (\method_exists($this, $method)) {
330
-			if (! \is_array($attributes)) {
331
-				$attributes = [
330
+			if (!\is_array($attributes)) {
331
+				$attributes=[
332 332
 					$index
333 333
 				];
334 334
 			} else {
@@ -341,17 +341,17 @@  discard block
 block discarded – undo
341 341
 		}
342 342
 	}
343 343
 
344
-	public function fieldAsSubmit($index, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $attributes = NULL) {
345
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) {
346
-			$button = new HtmlButton($id, $caption, $cssStyle);
344
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
345
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) {
346
+			$button=new HtmlButton($id, $caption, $cssStyle);
347 347
 			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
348 348
 			return $button;
349 349
 		}, $index, $attributes, "submit");
350 350
 	}
351 351
 
352
-	public function fieldAsButton($index, $cssStyle = NULL, $attributes = NULL) {
353
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($cssStyle) {
354
-			$button = new HtmlButton($id, $value, $cssStyle);
352
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
353
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle) {
354
+			$button=new HtmlButton($id, $value, $cssStyle);
355 355
 			return $button;
356 356
 		}, $index, $attributes, "button");
357 357
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +117 added lines, -117 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
 	/**
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	 * @param boolean $_visibleHover
718 718
 	 */
719 719
 	public function setVisibleHover($_visibleHover) {
720
-		$this->_visibleHover = $_visibleHover;
720
+		$this->_visibleHover=$_visibleHover;
721 721
 	}
722 722
 
723 723
 	/**
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		return $this->_paginationToolbar;
729 729
 	}
730 730
 
731
-	public function setInverted($recursive = true) {
731
+	public function setInverted($recursive=true) {
732 732
 		$this->getHtmlComponent()->setInverted($recursive);
733 733
 		if ($this->_emptyMessage instanceof HtmlSemDoubleElement) {
734 734
 			$this->_emptyMessage->setInverted($recursive);
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/AjaxRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 	private $ajaxCall;
18 18
 
19
-	public function __construct($type, $url, $params, $jsCallback = null, $method = 'post', $parameters = [], $prompt = NULL, $value = NULL) {
19
+	public function __construct($type, $url, $params, $jsCallback=null, $method='post', $parameters=[], $prompt=NULL, $value=NULL) {
20 20
 		parent::__construct($type, $prompt, $value);
21
-		$parameters = \array_merge([
21
+		$parameters=\array_merge([
22 22
 			'async' => false,
23 23
 			'url' => $url,
24 24
 			'params' => $params,
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 			'preventDefault' => false,
30 30
 			'responseElement' => null
31 31
 		], $parameters);
32
-		$this->ajaxCall = new AjaxCall($method, $parameters);
32
+		$this->ajaxCall=new AjaxCall($method, $parameters);
33 33
 	}
34 34
 
35 35
 	public function compile(JsUtils $js) {
36
-		$js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;" . $this->ajaxCall->compile($js) . "return result;}"), true);
36
+		$js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;".$this->ajaxCall->compile($js)."return result;}"), true);
37 37
 	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/CustomRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
 
16 16
 	protected $jsFunction;
17 17
 
18
-	public function __construct($type, $jsFunction, $prompt = NULL, $value = NULL) {
18
+	public function __construct($type, $jsFunction, $prompt=NULL, $value=NULL) {
19 19
 		parent::__construct($type, $prompt, $value);
20
-		$this->jsFunction = $jsFunction;
20
+		$this->jsFunction=$jsFunction;
21 21
 	}
22 22
 
23 23
 	public function compile(JsUtils $js) {
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/FieldValidation.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.001
9 9
  * Generates a JSON field validator
10 10
  */
11
-class FieldValidation implements \JsonSerializable{
11
+class FieldValidation implements \JsonSerializable {
12 12
 	/**
13 13
 	 * @var string
14 14
 	 */
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 	protected $optional;
33 33
 
34
-	public function __construct($identifier){
34
+	public function __construct($identifier) {
35 35
 		$this->identifier=$identifier;
36 36
 		$this->rules=[];
37 37
 	}
@@ -55,31 +55,31 @@  discard block
 block discarded – undo
55 55
 	 * @param string $value
56 56
 	 * @return Rule
57 57
 	 */
58
-	public function addRule($type,$prompt=NULL,$value=NULL){
59
-		if($type instanceof  Rule) {
60
-			$rule = $type;
61
-			if($type instanceof CustomRule){
58
+	public function addRule($type, $prompt=NULL, $value=NULL) {
59
+		if ($type instanceof  Rule) {
60
+			$rule=$type;
61
+			if ($type instanceof CustomRule) {
62 62
 				$this->customRules[]=$type;
63 63
 				$this->hasCustomRules=true;
64 64
 			}
65
-		}elseif(\is_array($type)){
65
+		}elseif (\is_array($type)) {
66 66
 			$value=JArray::getValue($type, "value", 2);
67 67
 			$prompt=JArray::getValue($type, "prompt", 1);
68 68
 			$type=JArray::getValue($type, "type", 0);
69
-			$rule=new Rule($type,$prompt,$value);
70
-		}else {
71
-			$rule = new Rule($type, $prompt, $value);
69
+			$rule=new Rule($type, $prompt, $value);
70
+		} else {
71
+			$rule=new Rule($type, $prompt, $value);
72 72
 		}
73 73
 		$this->rules[]=$rule;
74 74
 		return $rule;
75 75
 	}
76 76
 
77
-	public function jsonSerialize(){
78
-		$result=["identifier"=>$this->identifier,"rules"=>$this->rules];
79
-		if($this->optional){
77
+	public function jsonSerialize() {
78
+		$result=["identifier"=>$this->identifier, "rules"=>$this->rules];
79
+		if ($this->optional) {
80 80
 			$result["optional"]=true;
81 81
 		}
82
-		if(isset($this->depends)){
82
+		if (isset($this->depends)) {
83 83
 			$result["depends"]=$this->depends;
84 84
 		}
85 85
 		return $result;
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 		return $this;
96 96
 	}
97 97
 
98
-	public function compile(JsUtils $js){
99
-		if($this->hasCustomRules) {
98
+	public function compile(JsUtils $js) {
99
+		if ($this->hasCustomRules) {
100 100
 			foreach ($this->customRules as $rule) {
101 101
 				$rule->compile($js);
102 102
 			}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormField.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
 	use FieldTrait;
17 17
 	protected $_container;
18 18
 	protected $_validation;
19
-	public function __construct($identifier, $field,$label=NULL) {
20
-		parent::__construct($identifier, "div","field");
19
+	public function __construct($identifier, $field, $label=NULL) {
20
+		parent::__construct($identifier, "div", "field");
21 21
 		$this->content=array();
22
-		$this->_states=[State::ERROR,State::DISABLED];
23
-		if(isset($label) && $label!=="")
22
+		$this->_states=[State::ERROR, State::DISABLED];
23
+		if (isset($label) && $label!=="")
24 24
 			$this->setLabel($label);
25 25
 		$this->setField($field);
26 26
 		$this->_validation=NULL;
27 27
 	}
28 28
 
29
-	public function addPointingLabel($label,$pointing=Direction::NONE){
30
-		$labelO=new HtmlLabel("",$label);
29
+	public function addPointingLabel($label, $pointing=Direction::NONE) {
30
+		$labelO=new HtmlLabel("", $label);
31 31
 		$labelO->setPointing($pointing);
32
-		$this->addContent($labelO,$pointing==="below" || $pointing==="right");
32
+		$this->addContent($labelO, $pointing==="below" || $pointing==="right");
33 33
 		return $labelO;
34 34
 	}
35 35
 
36
-	public function setLabel($label){
36
+	public function setLabel($label) {
37 37
 		$labelO=$label;
38
-		if(\is_string($label)){
39
-			$labelO=new HtmlSemDoubleElement("","label","");
38
+		if (\is_string($label)) {
39
+			$labelO=new HtmlSemDoubleElement("", "label", "");
40 40
 			$labelO->setContent($label);
41
-			$labelO->setProperty("for", \str_replace("field-", "",$this->identifier));
41
+			$labelO->setProperty("for", \str_replace("field-", "", $this->identifier));
42 42
 		}
43 43
 		$this->content["label"]=$labelO;
44 44
 	}
45 45
 
46
-	public function setField($field){
46
+	public function setField($field) {
47 47
 		$this->content["field"]=$field;
48 48
 	}
49 49
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * Returns the label or null
52 52
 	 * @return mixed
53 53
 	 */
54
-	public function getLabel(){
55
-		if(\array_key_exists("label", $this->content))
54
+	public function getLabel() {
55
+		if (\array_key_exists("label", $this->content))
56 56
 			return $this->content["label"];
57 57
 	}
58 58
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * Return the field
61 61
 	 * @return mixed
62 62
 	 */
63
-	public function getField(){
63
+	public function getField() {
64 64
 		return $this->content["field"];
65 65
 	}
66 66
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 * Return the field with data
69 69
 	 * @return mixed
70 70
 	 */
71
-	public function getDataField(){
71
+	public function getDataField() {
72 72
 		return $this->content["field"];
73 73
 	}
74 74
 
75 75
 	/**
76 76
 	 * puts the label before or behind
77 77
 	 */
78
-	public function swapLabel(){
78
+	public function swapLabel() {
79 79
 		$label=$this->getLabel();
80 80
 		unset($this->content["label"]);
81 81
 		$this->content["label"]=$label;
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
 	 * @param int $width
87 87
 	 * @return \Ajax\semantic\html\collections\form\HtmlFormField
88 88
 	 */
89
-	public function setWidth($width){
90
-		if(\is_int($width)){
89
+	public function setWidth($width) {
90
+		if (\is_int($width)) {
91 91
 			$width=Wide::getConstants()["W".$width];
92 92
 		}
93 93
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
94
-		if(isset($this->_container)){
94
+		if (isset($this->_container)) {
95 95
 			$this->_container->setEqualWidth(false);
96 96
 		}
97
-		return $this->addToPropertyCtrl("class", "wide",array("wide"));
97
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
98 98
 	}
99 99
 
100 100
 	/**
101 101
 	 * Field displays an error state
102 102
 	 * @return \Ajax\semantic\html\collections\form\HtmlFormField
103 103
 	 */
104
-	public function setError(){
104
+	public function setError() {
105 105
 		return $this->addToProperty("class", "error");
106 106
 	}
107 107
 
108
-	public function setInline(){
108
+	public function setInline() {
109 109
 		return $this->addToProperty("class", "inline");
110 110
 	}
111 111
 
112
-	public function jsState($state){
113
-		return $this->jsDoJquery("addClass",$state);
112
+	public function jsState($state) {
113
+		return $this->jsDoJquery("addClass", $state);
114 114
 	}
115 115
 
116 116
 	public function setContainer($_container) {
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 		return $this;
119 119
 	}
120 120
 
121
-	public function setReadonly(){
121
+	public function setReadonly() {
122 122
 		$this->getDataField()->setProperty("readonly", "");
123 123
 	}
124 124
 
125
-	public function addRule($type,$prompt=NULL,$value=NULL){
125
+	public function addRule($type, $prompt=NULL, $value=NULL) {
126 126
 		$field=$this->getDataField();
127
-		if(isset($field)){
128
-			if(!isset($this->_validation)){
127
+		if (isset($field)) {
128
+			if (!isset($this->_validation)) {
129 129
 				$this->_validation=new FieldValidation($field->getIdentifier());
130 130
 			}
131
-			if($type==="empty"){
132
-				$this->addToProperty("class","required");
131
+			if ($type==="empty") {
132
+				$this->addToProperty("class", "required");
133 133
 			}
134
-			$this->_validation->addRule($type,$prompt,$value);
134
+			$this->_validation->addRule($type, $prompt, $value);
135 135
 		}
136 136
 		return $this;
137 137
 	}
138 138
 	
139
-	public function setOptional($optional=true){
139
+	public function setOptional($optional=true) {
140 140
 		$field=$this->getDataField();
141
-		if(isset($field)){
142
-			if(!isset($this->_validation)){
141
+		if (isset($field)) {
142
+			if (!isset($this->_validation)) {
143 143
 				$this->_validation=new FieldValidation($field->getIdentifier());
144 144
 			}
145 145
 			$this->_validation->setOptional($optional);
146 146
 		}
147 147
 	}
148 148
 
149
-	public function addRules(array $rules){
150
-		foreach ($rules as $rule){
149
+	public function addRules(array $rules) {
150
+		foreach ($rules as $rule) {
151 151
 			$this->addRule($rule);
152 152
 		}
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function setRules(array $rules){
156
+	public function setRules(array $rules) {
157 157
 		$this->_validation=null;
158 158
 		return $this->addRules($rules);
159 159
 	}
160 160
 
161
-	public function addIcon($icon,$direction=Direction::LEFT){
161
+	public function addIcon($icon, $direction=Direction::LEFT) {
162 162
 		$field=$this->getField();
163
-		return $field->addIcon($icon,$direction);
163
+		return $field->addIcon($icon, $direction);
164 164
 	}
165 165
 
166 166
 	public function getValidation() {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	}
173 173
 
174 174
 	public function run(JsUtils $js) {
175
-		if(isset($this->_validation)){
175
+		if (isset($this->_validation)) {
176 176
 			$this->_validation->compile($js);
177 177
 		}
178 178
 		return parent::run($js);
Please login to merge, or discard this patch.