Completed
Push — master ( 4bf172...5f7aee )
by Jean-Christophe
03:35
created
Ajax/semantic/html/collections/table/HtmlTable.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct($identifier, $rowCount, $colCount) {
29 29
 		parent::__construct($identifier, "table", "ui table");
30
-		$this->content=array ();
30
+		$this->content=array();
31 31
 		$this->setRowCount($rowCount, $colCount);
32
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
33
-		$this->_compileParts=["thead","tbody","tfoot"];
32
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
33
+		$this->_compileParts=["thead", "tbody", "tfoot"];
34 34
 		$this->_afterCompileEvents=[];
35 35
 	}
36 36
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * @return HtmlTableContent
49 49
 	 */
50 50
 	public function getPart($key) {
51
-		if (\array_key_exists($key, $this->content) === false) {
51
+		if (\array_key_exists($key, $this->content)===false) {
52 52
 			$this->content[$key]=new HtmlTableContent("", $key);
53
-			if ($key !== "tbody") {
53
+			if ($key!=="tbody") {
54 54
 				$this->content[$key]->setRowCount(1, $this->_colCount);
55 55
 			}
56 56
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return boolean
96 96
 	 */
97 97
 	public function hasPart($key) {
98
-		return \array_key_exists($key, $this->content) === true;
98
+		return \array_key_exists($key, $this->content)===true;
99 99
 	}
100 100
 
101 101
 	/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 	private function colAlign($colIndex, $function) {
232 232
 		if (\is_array($colIndex)) {
233
-			foreach ( $colIndex as $cIndex ) {
233
+			foreach ($colIndex as $cIndex) {
234 234
 				$this->colAlign($cIndex, $function);
235 235
 			}
236 236
 		} else {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @see HtmlSemDoubleElement::compile()
292 292
 	 */
293 293
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
294
-		if(\sizeof($this->_compileParts)<3){
294
+		if (\sizeof($this->_compileParts)<3) {
295 295
 			$this->_template="%content%";
296 296
 			$this->refresh();
297 297
 		}
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 
302 302
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
303 303
 		if ($this->propertyContains("class", "sortable")) {
304
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
304
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
305 305
 		}
306
-		if(isset($this->_activeRowSelector)){
306
+		if (isset($this->_activeRowSelector)) {
307 307
 			$this->_activeRowSelector->compile();
308 308
 		}
309 309
 	}
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 	public function fromDatabaseObject($object, $function) {
318 318
 		$result=$function($object);
319 319
 		if (\is_array($result)) {
320
-			$result= $this->addRow($function($object));
320
+			$result=$this->addRow($function($object));
321 321
 		} else {
322
-			$result= $this->getBody()->_addRow($result);
322
+			$result=$this->getBody()->_addRow($result);
323 323
 		}
324
-		if(isset($this->_afterCompileEvents["onNewRow"])){
325
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
326
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
324
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
325
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
326
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
327 327
 		}
328 328
 		return $result;
329 329
 	}
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 		return $this;
339 339
 	}
340 340
 
341
-	public function refresh(){
341
+	public function refresh() {
342 342
 		$this->_footer=$this->getFooter();
343 343
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
344 344
 	}
345 345
 
346
-	public function run(JsUtils $js){
347
-		$result= parent::run($js);
348
-		if(isset($this->_footer))
346
+	public function run(JsUtils $js) {
347
+		$result=parent::run($js);
348
+		if (isset($this->_footer))
349 349
 			$this->_footer->run($js);
350 350
 		return $result;
351 351
 	}
@@ -368,27 +368,27 @@  discard block
 block discarded – undo
368 368
 	 * @param boolean $multiple
369 369
 	 * @return HtmlTable
370 370
 	 */
371
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
372
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
371
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
372
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
373 373
 		return $this;
374 374
 	}
375 375
 
376
-	public function hideColumn($colIndex){
377
-		if($this->hasPart("thead")){
376
+	public function hideColumn($colIndex) {
377
+		if ($this->hasPart("thead")) {
378 378
 			$this->getHeader()->hideColumn($colIndex);
379 379
 		}
380 380
 		$this->getBody()->hideColumn($colIndex);
381
-		if($this->hasPart("tfoot")){
381
+		if ($this->hasPart("tfoot")) {
382 382
 			$this->getFooter()->hideColumn($colIndex);
383 383
 		}
384 384
 		return $this;
385 385
 	}
386 386
 	
387
-	public function setColWidth($colIndex,$width){
388
-		if($this->hasPart("thead")){
387
+	public function setColWidth($colIndex, $width) {
388
+		if ($this->hasPart("thead")) {
389 389
 			$this->getHeader()->getCell(0, $colIndex)->setWidth($width);
390
-		}else{
391
-			if($this->getBody()->count()>0)
390
+		} else {
391
+			if ($this->getBody()->count()>0)
392 392
 				$this->getBody()->getCell(0, $colIndex)->setWidth($width);
393 393
 		}
394 394
 		return $this;
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -322,8 +322,9 @@  discard block
 block discarded – undo
322 322
 			$result= $this->getBody()->_addRow($result);
323 323
 		}
324 324
 		if(isset($this->_afterCompileEvents["onNewRow"])){
325
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
326
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
325
+			if(\is_callable($this->_afterCompileEvents["onNewRow"])) {
326
+							$this->_afterCompileEvents["onNewRow"]($result,$object);
327
+			}
327 328
 		}
328 329
 		return $result;
329 330
 	}
@@ -345,8 +346,9 @@  discard block
 block discarded – undo
345 346
 
346 347
 	public function run(JsUtils $js){
347 348
 		$result= parent::run($js);
348
-		if(isset($this->_footer))
349
-			$this->_footer->run($js);
349
+		if(isset($this->_footer)) {
350
+					$this->_footer->run($js);
351
+		}
350 352
 		return $result;
351 353
 	}
352 354
 
@@ -387,9 +389,10 @@  discard block
 block discarded – undo
387 389
 	public function setColWidth($colIndex,$width){
388 390
 		if($this->hasPart("thead")){
389 391
 			$this->getHeader()->getCell(0, $colIndex)->setWidth($width);
390
-		}else{
391
-			if($this->getBody()->count()>0)
392
-				$this->getBody()->getCell(0, $colIndex)->setWidth($width);
392
+		} else{
393
+			if($this->getBody()->count()>0) {
394
+							$this->getBody()->getCell(0, $colIndex)->setWidth($width);
395
+			}
393 396
 		}
394 397
 		return $this;
395 398
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButtonGroups.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -15,6 +15,10 @@
 block discarded – undo
15 15
  */
16 16
 class HtmlButtonGroups extends HtmlSemCollection {
17 17
 	protected $_dropdown;
18
+
19
+	/**
20
+	 * @param string $identifier
21
+	 */
18 22
 	public function __construct($identifier, $elements=array(), $asIcons=false) {
19 23
 		parent::__construct($identifier, "div", "ui buttons");
20 24
 		if ($asIcons === true)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 	protected $_dropdown;
18 18
 	public function __construct($identifier, $elements=array(), $asIcons=false) {
19 19
 		parent::__construct($identifier, "div", "ui buttons");
20
-		if ($asIcons === true)
20
+		if ($asIcons===true)
21 21
 			$this->asIcons();
22 22
 		$this->addElements($elements, $asIcons);
23 23
 	}
24
-	protected function createItem($value){
24
+	protected function createItem($value) {
25 25
 		return new HtmlButton("", $value);
26 26
 	}
27 27
 
28
-	public function addDropdown($items,$asCombo=false){
29
-		$dd= new HtmlDropdown("dd-".$this->identifier,null,$items);
28
+	public function addDropdown($items, $asCombo=false) {
29
+		$dd=new HtmlDropdown("dd-".$this->identifier, null, $items);
30 30
 		$dd->asButton();
31
-		if($asCombo){
31
+		if ($asCombo) {
32 32
 			$dd->setAction("combo");
33 33
 			$dd->addToProperty("class", "combo");
34 34
 		}
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 
40 40
 	public function addElement($element, $asIcon=false) {
41 41
 		$item=$this->addItem($element);
42
-		if($asIcon)
42
+		if ($asIcon)
43 43
 			$item->asIcon($element);
44 44
 		return $item;
45 45
 	}
46 46
 
47 47
 	public function addElements($elements, $asIcons=false) {
48
-		foreach ( $elements as $element ) {
48
+		foreach ($elements as $element) {
49 49
 			$this->addElement($element, $asIcons);
50 50
 		}
51 51
 		return $this;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	public function insertOr($aferIndex=0, $or="or") {
55 55
 		$orElement=new HtmlSemDoubleElement("", "div", "or");
56 56
 		$orElement->setProperty("data-text", $or);
57
-		array_splice($this->content, $aferIndex + 1, 0, array ($orElement ));
57
+		array_splice($this->content, $aferIndex+1, 0, array($orElement));
58 58
 		return $this;
59 59
 	}
60 60
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	public function asIcons() {
70
-		foreach ( $this->content as $item ) {
71
-			if($item instanceof HtmlButton)
70
+		foreach ($this->content as $item) {
71
+			if ($item instanceof HtmlButton)
72 72
 			$item->asIcon($item->getContent());
73 73
 		}
74 74
 		return $this->addToProperty("class", "icons");
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
102 102
 	 */
103 103
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
104
-		foreach ( $this->content as $element ) {
104
+		foreach ($this->content as $element) {
105 105
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
106 106
 		}
107 107
 		return $this;
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 
114 114
 	public function addClasses($classes=array()) {
115 115
 		$i=0;
116
-		if(!\is_array($classes)){
117
-			$classes=array_fill (0,$this->count(),$classes);
116
+		if (!\is_array($classes)) {
117
+			$classes=array_fill(0, $this->count(), $classes);
118 118
 		}
119
-		foreach ( $this->content as $button ) {
119
+		foreach ($this->content as $button) {
120 120
 			$button->addToProperty("class", $classes[$i++]);
121 121
 		}
122 122
 		return $this;
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 		$this->addElement($function($object));
131 131
 	}
132 132
 
133
-	public function run(JsUtils $js){
134
-		$result= parent::run($js);
133
+	public function run(JsUtils $js) {
134
+		$result=parent::run($js);
135 135
 		return $result->setItemSelector(".ui.button");
136 136
 	}
137 137
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
 	protected $_dropdown;
18 18
 	public function __construct($identifier, $elements=array(), $asIcons=false) {
19 19
 		parent::__construct($identifier, "div", "ui buttons");
20
-		if ($asIcons === true)
21
-			$this->asIcons();
20
+		if ($asIcons === true) {
21
+					$this->asIcons();
22
+		}
22 23
 		$this->addElements($elements, $asIcons);
23 24
 	}
24 25
 	protected function createItem($value){
@@ -39,8 +40,9 @@  discard block
 block discarded – undo
39 40
 
40 41
 	public function addElement($element, $asIcon=false) {
41 42
 		$item=$this->addItem($element);
42
-		if($asIcon)
43
-			$item->asIcon($element);
43
+		if($asIcon) {
44
+					$item->asIcon($element);
45
+		}
44 46
 		return $item;
45 47
 	}
46 48
 
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 
69 71
 	public function asIcons() {
70 72
 		foreach ( $this->content as $item ) {
71
-			if($item instanceof HtmlButton)
72
-			$item->asIcon($item->getContent());
73
+			if($item instanceof HtmlButton) {
74
+						$item->asIcon($item->getContent());
75
+			}
73 76
 		}
74 77
 		return $this->addToProperty("class", "icons");
75 78
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,27 +13,27 @@  discard block
 block discarded – undo
13 13
  * @author jc
14 14
  *
15 15
  */
16
-trait FormTrait{
16
+trait FormTrait {
17 17
 
18 18
 	/**
19 19
 	 * @return HtmlForm
20 20
 	 */
21 21
 	abstract protected function getForm();
22 22
 
23
-	protected function addCompoValidation($compo,$field){
23
+	protected function addCompoValidation($compo, $field) {
24 24
 		$validation=$field->getValidation();
25
-		if(isset($validation)){
25
+		if (isset($validation)) {
26 26
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
27 27
 			$compo->addFieldValidation($validation);
28 28
 		}
29 29
 		return $compo;
30 30
 	}
31 31
 
32
-	protected function _runValidationParams(&$compo,JsUtils $js=NULL){
32
+	protected function _runValidationParams(&$compo, JsUtils $js=NULL) {
33 33
 		$form=$this->getForm();
34 34
 		$params=$form->getValidationParams();
35
-		if(isset($params["_ajaxSubmit"])){
36
-			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js);
35
+		if (isset($params["_ajaxSubmit"])) {
36
+			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js);
37 37
 			$this->onSuccess($compilation);
38 38
 			$form->removeValidationParam("_ajaxSubmit");
39 39
 		}
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 		$form->addEventsOnRun($js);
43 43
 	}
44 44
 
45
-	protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){
45
+	protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) {
46 46
 		$compilation="";
47
-		if(\is_array($ajaxSubmit)){
48
-			foreach ($ajaxSubmit as $ajaxSubmitItem){
47
+		if (\is_array($ajaxSubmit)) {
48
+			foreach ($ajaxSubmit as $ajaxSubmitItem) {
49 49
 				$compilation.=$ajaxSubmitItem->compile($js);
50 50
 			}
51
-		}elseif($ajaxSubmit instanceof AjaxCall){
51
+		}elseif ($ajaxSubmit instanceof AjaxCall) {
52 52
 			$compilation=$ajaxSubmit->compile($js);
53 53
 		}
54
-		$compilation=str_ireplace("\"","%quote%", $compilation);
54
+		$compilation=str_ireplace("\"", "%quote%", $compilation);
55 55
 		return $compilation;
56 56
 	}
57 57
 
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 		return $this;
65 65
 	}
66 66
 
67
-	public function setAttached($value=true){
67
+	public function setAttached($value=true) {
68 68
 		$form=$this->getForm();
69
-		if($value)
70
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
69
+		if ($value)
70
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
71 71
 		return $form;
72 72
 	}
73 73
 
74
-	public function addErrorMessage(){
74
+	public function addErrorMessage() {
75 75
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
76 76
 	}
77 77
 
@@ -87,47 +87,47 @@  discard block
 block discarded – undo
87 87
 	 * @param array $parameters
88 88
 	 * @return HtmlForm
89 89
 	 */
90
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
90
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
91 91
 		$form=$this->getForm();
92
-		if($identifierOrElement  instanceof BaseHtml)
92
+		if ($identifierOrElement  instanceof BaseHtml)
93 93
 			$elem=$identifierOrElement;
94 94
 		else
95 95
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
96
-		if(isset($elem)){
97
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
96
+		if (isset($elem)) {
97
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
98 98
 		}
99 99
 		return $form;
100 100
 	}
101 101
 
102
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
103
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
102
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
103
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
104 104
 	}
105 105
 
106
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
107
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
108
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
106
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
107
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
108
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
109 109
 	}
110 110
 
111
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
111
+	protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
112 112
 		$form=$this->getForm();
113
-		if(isset($url) && isset($responseElement)){
114
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
115
-			$this->setSubmitParams($url,$responseElement,$parameters);
113
+		if (isset($url) && isset($responseElement)) {
114
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
115
+			$this->setSubmitParams($url, $responseElement, $parameters);
116 116
 		}
117 117
 		return $button;
118 118
 	}
119 119
 
120
-	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
120
+	public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) {
121 121
 		$form=$this->getForm();
122
-		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
123
-		if(\is_array($parameters))
124
-			$params=\array_merge($params,$parameters);
122
+		$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
123
+		if (\is_array($parameters))
124
+			$params=\array_merge($params, $parameters);
125 125
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
126 126
 		return $this;
127 127
 	}
128 128
 
129
-	public function addReset($identifier,$value,$cssStyle=NULL){
130
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
129
+	public function addReset($identifier, $value, $cssStyle=NULL) {
130
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
131 131
 		$bt->setProperty("type", "reset");
132 132
 		return $bt;
133 133
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param string $jsCode
138 138
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
139 139
 	 */
140
-	public function onValid($jsCode){
140
+	public function onValid($jsCode) {
141 141
 		$form=$this->getForm();
142 142
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
143 143
 		return $form;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 * @param string $jsCode can use event and fields parameters
149 149
 	 * @return HtmlForm
150 150
 	 */
151
-	public function onSuccess($jsCode){
151
+	public function onSuccess($jsCode) {
152 152
 		$form=$this->getForm();
153
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
153
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
154 154
 		return $form;
155 155
 	}
156 156
 }
157 157
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			foreach ($ajaxSubmit as $ajaxSubmitItem){
49 49
 				$compilation.=$ajaxSubmitItem->compile($js);
50 50
 			}
51
-		}elseif($ajaxSubmit instanceof AjaxCall){
51
+		} elseif($ajaxSubmit instanceof AjaxCall){
52 52
 			$compilation=$ajaxSubmit->compile($js);
53 53
 		}
54 54
 		$compilation=str_ireplace("\"","%quote%", $compilation);
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
66 66
 
67 67
 	public function setAttached($value=true){
68 68
 		$form=$this->getForm();
69
-		if($value)
70
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
69
+		if($value) {
70
+					$form->addToPropertyCtrl("class", "attached", array ("attached" ));
71
+		}
71 72
 		return $form;
72 73
 	}
73 74
 
@@ -89,10 +90,11 @@  discard block
 block discarded – undo
89 90
 	 */
90 91
 	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
91 92
 		$form=$this->getForm();
92
-		if($identifierOrElement  instanceof BaseHtml)
93
-			$elem=$identifierOrElement;
94
-		else
95
-			$elem=$form->getElementById($identifierOrElement, $form->getContent());
93
+		if($identifierOrElement  instanceof BaseHtml) {
94
+					$elem=$identifierOrElement;
95
+		} else {
96
+					$elem=$form->getElementById($identifierOrElement, $form->getContent());
97
+		}
96 98
 		if(isset($elem)){
97 99
 			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
98 100
 		}
@@ -120,8 +122,9 @@  discard block
 block discarded – undo
120 122
 	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
121 123
 		$form=$this->getForm();
122 124
 		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
123
-		if(\is_array($parameters))
124
-			$params=\array_merge($params,$parameters);
125
+		if(\is_array($parameters)) {
126
+					$params=\array_merge($params,$parameters);
127
+		}
125 128
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
126 129
 		return $this;
127 130
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/HasTimeoutTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 	 * {@inheritDoc}
18 18
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
19 19
 	 */
20
-	public function run(JsUtils $js){
21
-		if(!isset($this->_bsComponent)){
22
-			if(isset($this->_timeout)){
23
-				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true);
20
+	public function run(JsUtils $js) {
21
+		if (!isset($this->_bsComponent)) {
22
+			if (isset($this->_timeout)) {
23
+				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true);
24 24
 			}
25 25
 		}
26 26
 		return parent::run($js);
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
  * @property string $identifier
15 15
  */
16 16
 trait BaseTrait {
17
-	protected $_variations=[ ];
18
-	protected $_states=[ ];
17
+	protected $_variations=[];
18
+	protected $_states=[];
19 19
 	protected $_baseClass;
20 20
 
21 21
 	abstract protected function setPropertyCtrl($name, $value, $typeCtrl);
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	abstract public function setProperty($name, $value);
30 30
 
31
-	abstract public function addContent($content,$before=false);
31
+	abstract public function addContent($content, $before=false);
32 32
 
33 33
 	abstract public function onCreate($jsCode);
34 34
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$this->setProperty("class", $this->_baseClass);
50 50
 		if (\is_string($variations))
51 51
 			$variations=\explode(" ", $variations);
52
-		foreach ( $variations as $variation ) {
52
+		foreach ($variations as $variation) {
53 53
 			$this->addVariation($variation);
54 54
 		}
55 55
 		return $this;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public function addVariations($variations=array()) {
64 64
 		if (\is_string($variations))
65 65
 			$variations=\explode(" ", $variations);
66
-		foreach ( $variations as $variation ) {
66
+		foreach ($variations as $variation) {
67 67
 			$this->addVariation($variation);
68 68
 		}
69 69
 		return $this;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function addStates($states=array()) {
73 73
 		if (\is_string($states))
74 74
 			$states=\explode(" ", $states);
75
-		foreach ( $states as $state ) {
75
+		foreach ($states as $state) {
76 76
 			$this->addState($state);
77 77
 		}
78 78
 		return $this;
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
 		$this->setProperty("class", $this->_baseClass);
83 83
 		if (\is_string($states))
84 84
 			$states=\explode(" ", $states);
85
-		foreach ( $states as $state ) {
85
+		foreach ($states as $state) {
86 86
 			$this->addState($state);
87 87
 		}
88 88
 		return $this;
89 89
 	}
90 90
 
91 91
 	public function addIcon($icon, $before=true) {
92
-		return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before);
92
+		return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before);
93 93
 	}
94 94
 
95
-	public function addSticky($context="body"){
95
+	public function addSticky($context="body") {
96 96
 		$this->onCreate("$('#".$this->identifier."').sticky({ context: '".$context."'});");
97 97
 		return $this;
98 98
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @return HtmlSemDoubleElement
114 114
 	 */
115 115
 	public function setDisabled($disable=true) {
116
-		if($disable)
116
+		if ($disable)
117 117
 			$this->addToProperty("class", "disabled");
118 118
 		return $this;
119 119
 	}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @return HtmlSemDoubleElement
141 141
 	 */
142
-	public function asHeader(){
142
+	public function asHeader() {
143 143
 		return $this->addToProperty("class", "header");
144 144
 	}
145 145
 
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 	 * show it is currently the active user selection
148 148
 	 * @return HtmlSemDoubleElement
149 149
 	 */
150
-	public function setActive($value=true){
151
-		if($value)
150
+	public function setActive($value=true) {
151
+		if ($value)
152 152
 			$this->addToProperty("class", "active");
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function setAttached($value=true){
157
-		if($value)
158
-			$this->addToPropertyCtrl("class", "attached", array ("attached" ));
156
+	public function setAttached($value=true) {
157
+		if ($value)
158
+			$this->addToPropertyCtrl("class", "attached", array("attached"));
159 159
 		return $this;
160 160
 	}
161 161
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	public function setFloated($direction="right") {
174
-		return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated"));
174
+		return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated"));
175 175
 	}
176 176
 
177 177
 	public function floatRight() {
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 		return $this->_baseClass;
187 187
 	}
188 188
 
189
-	protected function addBehavior(&$array,$key,$value,$before="",$after=""){
190
-		if(\is_string($value)){
191
-			if(isset($array[$key])){
189
+	protected function addBehavior(&$array, $key, $value, $before="", $after="") {
190
+		if (\is_string($value)) {
191
+			if (isset($array[$key])) {
192 192
 				$p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, "");
193 193
 				$array[$key]=$before.$p.$value.$after;
194
-			}else
194
+			} else
195 195
 				$array[$key]=$before.$value.$after;
196
-		}else{
196
+		} else {
197 197
 			$array[$key]=$value;
198 198
 		}
199 199
 		return $this;
Please login to merge, or discard this patch.
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 	public function setVariations($variations) {
49 49
 		$this->setProperty("class", $this->_baseClass);
50
-		if (\is_string($variations))
51
-			$variations=\explode(" ", $variations);
50
+		if (\is_string($variations)) {
51
+					$variations=\explode(" ", $variations);
52
+		}
52 53
 		foreach ( $variations as $variation ) {
53 54
 			$this->addVariation($variation);
54 55
 		}
@@ -61,8 +62,9 @@  discard block
 block discarded – undo
61 62
 	}
62 63
 
63 64
 	public function addVariations($variations=array()) {
64
-		if (\is_string($variations))
65
-			$variations=\explode(" ", $variations);
65
+		if (\is_string($variations)) {
66
+					$variations=\explode(" ", $variations);
67
+		}
66 68
 		foreach ( $variations as $variation ) {
67 69
 			$this->addVariation($variation);
68 70
 		}
@@ -70,8 +72,9 @@  discard block
 block discarded – undo
70 72
 	}
71 73
 
72 74
 	public function addStates($states=array()) {
73
-		if (\is_string($states))
74
-			$states=\explode(" ", $states);
75
+		if (\is_string($states)) {
76
+					$states=\explode(" ", $states);
77
+		}
75 78
 		foreach ( $states as $state ) {
76 79
 			$this->addState($state);
77 80
 		}
@@ -80,8 +83,9 @@  discard block
 block discarded – undo
80 83
 
81 84
 	public function setStates($states) {
82 85
 		$this->setProperty("class", $this->_baseClass);
83
-		if (\is_string($states))
84
-			$states=\explode(" ", $states);
86
+		if (\is_string($states)) {
87
+					$states=\explode(" ", $states);
88
+		}
85 89
 		foreach ( $states as $state ) {
86 90
 			$this->addState($state);
87 91
 		}
@@ -113,8 +117,9 @@  discard block
 block discarded – undo
113 117
 	 * @return HtmlSemDoubleElement
114 118
 	 */
115 119
 	public function setDisabled($disable=true) {
116
-		if($disable)
117
-			$this->addToProperty("class", "disabled");
120
+		if($disable) {
121
+					$this->addToProperty("class", "disabled");
122
+		}
118 123
 		return $this;
119 124
 	}
120 125
 
@@ -148,14 +153,16 @@  discard block
 block discarded – undo
148 153
 	 * @return HtmlSemDoubleElement
149 154
 	 */
150 155
 	public function setActive($value=true){
151
-		if($value)
152
-			$this->addToProperty("class", "active");
156
+		if($value) {
157
+					$this->addToProperty("class", "active");
158
+		}
153 159
 		return $this;
154 160
 	}
155 161
 
156 162
 	public function setAttached($value=true){
157
-		if($value)
158
-			$this->addToPropertyCtrl("class", "attached", array ("attached" ));
163
+		if($value) {
164
+					$this->addToPropertyCtrl("class", "attached", array ("attached" ));
165
+		}
159 166
 		return $this;
160 167
 	}
161 168
 
@@ -191,9 +198,10 @@  discard block
 block discarded – undo
191 198
 			if(isset($array[$key])){
192 199
 				$p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, "");
193 200
 				$array[$key]=$before.$p.$value.$after;
194
-			}else
195
-				$array[$key]=$before.$value.$after;
196
-		}else{
201
+			} else {
202
+							$array[$key]=$before.$value.$after;
203
+			}
204
+		} else{
197 205
 			$array[$key]=$value;
198 206
 		}
199 207
 		return $this;
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
26 26
 	 * @param string|callable $ajaxTransition
27 27
 	 */
28
-	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
29
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
28
+	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
29
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
30 30
 	}
31 31
 
32 32
 	/**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param string $jsCallback javascript code to execute after the request
38 38
 	 * @param boolean $immediatly
39 39
 	 */
40
-	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
41
-		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly);
40
+	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
41
+		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly);
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string $url the request address
49 49
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
50 50
 	 */
51
-	public function jsonOn($event,$element, $url,$parameters=array()) {
52
-		return $this->js->_jsonOn($event, $element, $url,$parameters);
51
+	public function jsonOn($event, $element, $url, $parameters=array()) {
52
+		return $this->js->_jsonOn($event, $element, $url, $parameters);
53 53
 	}
54 54
 
55 55
 	/**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param string $jsCallback javascript code to execute after the request
72 72
 	 * @param string $rowClass the css class for the new element
73 73
 	 */
74
-	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") {
75
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL,$rowClass,true);
74
+	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") {
75
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, true);
76 76
 	}
77 77
 
78 78
 	/**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @param string $jsCallback javascript code to execute after the request
85 85
 	 * @param string $rowClass the css class for the new element
86 86
 	 */
87
-	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") {
88
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL, $rowClass,false);
87
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") {
88
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, false);
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 * @param string $url the request url
96 96
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true)
97 97
 	 */
98
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
99
-		return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters);
98
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
99
+		return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters);
100 100
 	}
101 101
 
102 102
 	/**
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
111 111
 	 * @param string|callable $ajaxTransition
112 112
 	 */
113
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
114
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition);
113
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
114
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
115 115
 	}
116 116
 
117 117
 	/**
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
151 151
 	 * @param string|callable $ajaxTransition
152 152
 	 */
153
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
154
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
153
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
154
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
155 155
 	}
156 156
 
157 157
 	/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
167 167
 	 * @param string|callable $ajaxTransition
168 168
 	 */
169
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
170
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
169
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
170
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
171 171
 	}
172 172
 
173 173
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
182 182
 	 */
183 183
 	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
184
-		return $this->js->_postOn($event, $element,  $url, $params, $responseElement, $parameters);
184
+		return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters);
185 185
 	}
186 186
 
187 187
 	/**
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
208 208
 	 * @param string|callable $ajaxTransition
209 209
 	 */
210
-	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
211
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
210
+	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
211
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
212 212
 	}
213 213
 
214 214
 	/**
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
224 224
 	 * @param string|callable $ajaxTransition
225 225
 	 */
226
-	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
227
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
226
+	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
227
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
228 228
 	}
229 229
 
230 230
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
239 239
 	 */
240 240
 	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
241
-		return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters);
241
+		return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters);
242 242
 	}
243 243
 
244 244
 	/**
Please login to merge, or discard this patch.