@@ -79,8 +79,9 @@ discard block |
||
79 | 79 | $actionO=$action; |
80 | 80 | if (\is_object($action) === false) { |
81 | 81 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
82 | - if (isset($icon)) |
|
83 | - $actionO->addIcon($icon, true, $labeled); |
|
82 | + if (isset($icon)) { |
|
83 | + $actionO->addIcon($icon, true, $labeled); |
|
84 | + } |
|
84 | 85 | } |
85 | 86 | $field->addToProperty("class", $direction . " action"); |
86 | 87 | $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -120,8 +121,9 @@ discard block |
||
120 | 121 | |
121 | 122 | public function setDisabled($disable=true) { |
122 | 123 | $field=$this->getField(); |
123 | - if($disable) |
|
124 | - $field->addToProperty("class", "disabled"); |
|
124 | + if($disable) { |
|
125 | + $field->addToProperty("class", "disabled"); |
|
126 | + } |
|
125 | 127 | return $this; |
126 | 128 | } |
127 | 129 |
@@ -29,11 +29,12 @@ discard block |
||
29 | 29 | if(\is_array($value)){ |
30 | 30 | $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
31 | 31 | return $itemO; |
32 | - }elseif(\is_object($value)){ |
|
32 | + } elseif(\is_object($value)){ |
|
33 | 33 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
34 | 34 | return $itemO; |
35 | - }else |
|
36 | - return new HtmlFormInput($value); |
|
35 | + } else { |
|
36 | + return new HtmlFormInput($value); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | protected function createCondition($value){ |
@@ -67,8 +68,7 @@ discard block |
||
67 | 68 | if(isset($c)){ |
68 | 69 | $df=$c->getDataField(); |
69 | 70 | $df->setProperty($property,$value); |
70 | - } |
|
71 | - else{ |
|
71 | + } else{ |
|
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | } |
@@ -163,10 +163,12 @@ discard block |
||
163 | 163 | public function addButtonIcon($identifier,$icon,$cssStyle=NULL,$onClick=NULL){ |
164 | 164 | $bt=new HtmlButton($identifier); |
165 | 165 | $bt->asIcon($icon); |
166 | - if(isset($onClick)) |
|
167 | - $bt->onClick($onClick); |
|
168 | - if (isset($cssStyle)) |
|
169 | - $bt->addClass($cssStyle); |
|
166 | + if(isset($onClick)) { |
|
167 | + $bt->onClick($onClick); |
|
168 | + } |
|
169 | + if (isset($cssStyle)) { |
|
170 | + $bt->addClass($cssStyle); |
|
171 | + } |
|
170 | 172 | return $this->addItem($bt); |
171 | 173 | } |
172 | 174 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $retour.=$before; |
37 | 37 | if($hasLoader===true && JString::isNotNull($responseElement)){ |
38 | 38 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
39 | - }elseif($hasLoader==="internal"){ |
|
39 | + } elseif($hasLoader==="internal"){ |
|
40 | 40 | $retour.="\n$(this).addClass('loading');"; |
41 | 41 | } |
42 | 42 | $ajaxParameters=["url"=>"url","method"=>"'".\strtoupper($method)."'"]; |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | $retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n"; |
54 | 54 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback,$hasLoader,($historize?$originalSelector:null))."});\n"; |
55 | 55 | $retour=$this->_addJsCondition($jsCondition,$retour); |
56 | - if ($immediatly) |
|
57 | - $this->jquery_code_for_compile[]=$retour; |
|
56 | + if ($immediatly) { |
|
57 | + $this->jquery_code_for_compile[]=$retour; |
|
58 | + } |
|
58 | 59 | return $retour; |
59 | 60 | } |
60 | 61 | |
@@ -75,7 +76,7 @@ discard block |
||
75 | 76 | } |
76 | 77 | if(is_array($v)){ |
77 | 78 | $s .= "'{$k}':{".self::implodeAjaxParameters($v)."}"; |
78 | - }else{ |
|
79 | + } else{ |
|
79 | 80 | $s .= "'{$k}':{$v}"; |
80 | 81 | } |
81 | 82 | } |
@@ -100,12 +101,13 @@ discard block |
||
100 | 101 | if(JString::isNotNull($attr)){ |
101 | 102 | if ($attr==="value"){ |
102 | 103 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
103 | - }elseif ($attr==="html"){ |
|
104 | + } elseif ($attr==="html"){ |
|
104 | 105 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
105 | - }elseif(\substr($attr, 0,3)==="js:"){ |
|
106 | + } elseif(\substr($attr, 0,3)==="js:"){ |
|
106 | 107 | $retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n"; |
107 | - }elseif($attr!==null && $attr!=="") |
|
108 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
108 | + } elseif($attr!==null && $attr!=="") { |
|
109 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
110 | + } |
|
109 | 111 | } |
110 | 112 | return $retour; |
111 | 113 | } |
@@ -125,13 +127,14 @@ discard block |
||
125 | 127 | if (JString::isNotNull($responseElement)) { |
126 | 128 | if(isset($ajaxTransition)){ |
127 | 129 | $call=$this->setAjaxDataCall($ajaxTransition); |
128 | - }elseif(isset($this->ajaxTransition)){ |
|
130 | + } elseif(isset($this->ajaxTransition)){ |
|
129 | 131 | $call=$this->ajaxTransition; |
130 | 132 | } |
131 | - if(\is_callable($call)) |
|
132 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
133 | - else |
|
134 | - $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
133 | + if(\is_callable($call)) { |
|
134 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
135 | + } else { |
|
136 | + $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
137 | + } |
|
135 | 138 | } |
136 | 139 | if(isset($history)){ |
137 | 140 | if($this->params["autoActiveLinks"]){ |
@@ -154,8 +157,9 @@ discard block |
||
154 | 157 | } |
155 | 158 | |
156 | 159 | protected function _correctAjaxUrl($url) { |
157 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
158 | - $url=substr($url, 0, strlen($url)-1); |
|
160 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
161 | + $url=substr($url, 0, strlen($url)-1); |
|
162 | + } |
|
159 | 163 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
160 | 164 | $url=$this->getUrl($url); |
161 | 165 | } |
@@ -169,7 +173,7 @@ discard block |
||
169 | 173 | if(\preg_match("@^\{.*?\}$@", $params)){ |
170 | 174 | if( !isset($ajaxParameters['contentType'])|| !UString::contains('json', $ajaxParameters['contentType'])){ |
171 | 175 | return '$.param('.$params.')'; |
172 | - }else{ |
|
176 | + } else{ |
|
173 | 177 | return 'JSON.stringify('.$params.')'; |
174 | 178 | } |
175 | 179 | } |
@@ -179,8 +183,9 @@ discard block |
||
179 | 183 | public static function _implodeParams($parameters){ |
180 | 184 | $allParameters=[]; |
181 | 185 | foreach ($parameters as $params){ |
182 | - if(isset($params)) |
|
183 | - $allParameters[]=self::_correctParams($params); |
|
186 | + if(isset($params)) { |
|
187 | + $allParameters[]=self::_correctParams($params); |
|
188 | + } |
|
184 | 189 | } |
185 | 190 | return \implode("+'&'+", $allParameters); |
186 | 191 | } |
@@ -206,8 +211,9 @@ discard block |
||
206 | 211 | |
207 | 212 | protected function setDefaultParameters(&$parameters,$default){ |
208 | 213 | foreach ($default as $k=>$v){ |
209 | - if(!isset($parameters[$k])) |
|
210 | - $parameters[$k]=$v; |
|
214 | + if(!isset($parameters[$k])) { |
|
215 | + $parameters[$k]=$v; |
|
216 | + } |
|
211 | 217 | } |
212 | 218 | } |
213 | 219 | |
@@ -340,7 +346,7 @@ discard block |
||
340 | 346 | if($context===null){ |
341 | 347 | $parent="$('".$maskSelector."').parent()"; |
342 | 348 | $newElm = "$('#'+newId)"; |
343 | - }else{ |
|
349 | + } else{ |
|
344 | 350 | $parent=$context; |
345 | 351 | $newElm = $context.".find('#'+newId)"; |
346 | 352 | } |
@@ -567,7 +573,7 @@ discard block |
||
567 | 573 | $retour.="var self=this;\n"; |
568 | 574 | if($hasLoader===true){ |
569 | 575 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
570 | - }elseif($hasLoader==="internal"){ |
|
576 | + } elseif($hasLoader==="internal"){ |
|
571 | 577 | $retour.="\n$(this).addClass('loading');"; |
572 | 578 | } |
573 | 579 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -585,8 +591,9 @@ discard block |
||
585 | 591 | $retour.="$('#".$form."').submit();\n"; |
586 | 592 | } |
587 | 593 | $retour=$this->_addJsCondition($jsCondition, $retour); |
588 | - if ($immediatly) |
|
589 | - $this->jquery_code_for_compile[]=$retour; |
|
594 | + if ($immediatly) { |
|
595 | + $this->jquery_code_for_compile[]=$retour; |
|
596 | + } |
|
590 | 597 | return $retour; |
591 | 598 | } |
592 | 599 |
@@ -35,8 +35,9 @@ |
||
35 | 35 | */ |
36 | 36 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
37 | 37 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
38 | - if(isset($msg) && $styles!==null) |
|
39 | - $msg->setStyle($styles); |
|
38 | + if(isset($msg) && $styles!==null) { |
|
39 | + $msg->setStyle($styles); |
|
40 | + } |
|
40 | 41 | return $msg; |
41 | 42 | } |
42 | 43 |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | public function compile($internal=false) { |
45 | - if ($internal===false&&$this->autoCompile===true) |
|
46 | - throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
45 | + if ($internal===false&&$this->autoCompile===true) { |
|
46 | + throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
47 | + } |
|
47 | 48 | foreach ( $this->components as $component ) { |
48 | 49 | $component->compile(); |
49 | 50 | } |
@@ -60,13 +61,14 @@ discard block |
||
60 | 61 | $this->components [$attachTo]=$component; |
61 | 62 | } |
62 | 63 | $component->attach($attachTo); |
63 | - }else{ |
|
64 | + } else{ |
|
64 | 65 | $this->components []=$component; |
65 | 66 | } |
66 | 67 | } |
67 | - if (isset($params)) |
|
68 | - if (\is_array($params)) |
|
68 | + if (isset($params)) { |
|
69 | + if (\is_array($params)) |
|
69 | 70 | $component->setParams($params); |
71 | + } |
|
70 | 72 | return $component; |
71 | 73 | } |
72 | 74 |