@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $retour.=$before; |
36 | 36 | if($hasLoader===true && JString::isNotNull($responseElement)){ |
37 | 37 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
38 | - }elseif($hasLoader==="internal"){ |
|
38 | + } elseif($hasLoader==="internal"){ |
|
39 | 39 | $retour.="\n$(this).addClass('loading');"; |
40 | 40 | } |
41 | 41 | $ajaxParameters=["url"=>"url","method"=>"'".\strtoupper($method)."'"]; |
@@ -52,8 +52,9 @@ discard block |
||
52 | 52 | $retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n"; |
53 | 53 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback,$hasLoader,($historize?$originalSelector:null))."});\n"; |
54 | 54 | $retour=$this->_addJsCondition($jsCondition,$retour); |
55 | - if ($immediatly) |
|
56 | - $this->jquery_code_for_compile[]=$retour; |
|
55 | + if ($immediatly) { |
|
56 | + $this->jquery_code_for_compile[]=$retour; |
|
57 | + } |
|
57 | 58 | return $retour; |
58 | 59 | } |
59 | 60 | |
@@ -89,12 +90,13 @@ discard block |
||
89 | 90 | if(JString::isNotNull($attr)){ |
90 | 91 | if ($attr==="value"){ |
91 | 92 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
92 | - }elseif ($attr==="html"){ |
|
93 | + } elseif ($attr==="html"){ |
|
93 | 94 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
94 | - }elseif(\substr($attr, 0,3)==="js:"){ |
|
95 | + } elseif(\substr($attr, 0,3)==="js:"){ |
|
95 | 96 | $retour.="url=url+'".$slash."'+".\substr($attr, 3).";\n"; |
96 | - }elseif($attr!==null && $attr!=="") |
|
97 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
97 | + } elseif($attr!==null && $attr!=="") { |
|
98 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
99 | + } |
|
98 | 100 | } |
99 | 101 | return $retour; |
100 | 102 | } |
@@ -114,13 +116,14 @@ discard block |
||
114 | 116 | if (JString::isNotNull($responseElement)) { |
115 | 117 | if(isset($ajaxTransition)){ |
116 | 118 | $call=$this->setAjaxDataCall($ajaxTransition); |
117 | - }elseif(isset($this->ajaxTransition)){ |
|
119 | + } elseif(isset($this->ajaxTransition)){ |
|
118 | 120 | $call=$this->ajaxTransition; |
119 | 121 | } |
120 | - if(\is_callable($call)) |
|
121 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
122 | - else |
|
123 | - $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
122 | + if(\is_callable($call)) { |
|
123 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
124 | + } else { |
|
125 | + $retour="\t{$responseElement}.{$jqueryDone}( data );\n"; |
|
126 | + } |
|
124 | 127 | } |
125 | 128 | if(isset($history)){ |
126 | 129 | if($this->params["autoActiveLinks"]){ |
@@ -143,8 +146,9 @@ discard block |
||
143 | 146 | } |
144 | 147 | |
145 | 148 | protected function _correctAjaxUrl($url) { |
146 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
147 | - $url=substr($url, 0, strlen($url)-1); |
|
149 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
150 | + $url=substr($url, 0, strlen($url)-1); |
|
151 | + } |
|
148 | 152 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
149 | 153 | $url=$this->getUrl($url); |
150 | 154 | } |
@@ -164,8 +168,9 @@ discard block |
||
164 | 168 | public static function _implodeParams($parameters){ |
165 | 169 | $allParameters=[]; |
166 | 170 | foreach ($parameters as $params){ |
167 | - if(isset($params)) |
|
168 | - $allParameters[]=self::_correctParams($params); |
|
171 | + if(isset($params)) { |
|
172 | + $allParameters[]=self::_correctParams($params); |
|
173 | + } |
|
169 | 174 | } |
170 | 175 | return \implode("+'&'+", $allParameters); |
171 | 176 | } |
@@ -191,8 +196,9 @@ discard block |
||
191 | 196 | |
192 | 197 | protected function setDefaultParameters(&$parameters,$default){ |
193 | 198 | foreach ($default as $k=>$v){ |
194 | - if(!isset($parameters[$k])) |
|
195 | - $parameters[$k]=$v; |
|
199 | + if(!isset($parameters[$k])) { |
|
200 | + $parameters[$k]=$v; |
|
201 | + } |
|
196 | 202 | } |
197 | 203 | } |
198 | 204 | |
@@ -325,7 +331,7 @@ discard block |
||
325 | 331 | if($context===null){ |
326 | 332 | $parent="$('".$maskSelector."').parent()"; |
327 | 333 | $newElm = "$('#'+newId)"; |
328 | - }else{ |
|
334 | + } else{ |
|
329 | 335 | $parent=$context; |
330 | 336 | $newElm = $context.".find('#'+newId)"; |
331 | 337 | } |
@@ -552,7 +558,7 @@ discard block |
||
552 | 558 | $retour.="var self=this;\n"; |
553 | 559 | if($hasLoader===true){ |
554 | 560 | $this->addLoading($retour, $responseElement,$ajaxLoader); |
555 | - }elseif($hasLoader==="internal"){ |
|
561 | + } elseif($hasLoader==="internal"){ |
|
556 | 562 | $retour.="\n$(this).addClass('loading');"; |
557 | 563 | } |
558 | 564 | $ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params","async"=>$async]; |
@@ -570,8 +576,9 @@ discard block |
||
570 | 576 | $retour.="$('#".$form."').submit();\n"; |
571 | 577 | } |
572 | 578 | $retour=$this->_addJsCondition($jsCondition, $retour); |
573 | - if ($immediatly) |
|
574 | - $this->jquery_code_for_compile[]=$retour; |
|
579 | + if ($immediatly) { |
|
580 | + $this->jquery_code_for_compile[]=$retour; |
|
581 | + } |
|
575 | 582 | return $retour; |
576 | 583 | } |
577 | 584 |
@@ -32,15 +32,17 @@ discard block |
||
32 | 32 | |
33 | 33 | public function addContent($content,$before=false) { |
34 | 34 | if (!\is_array($this->content)) { |
35 | - if(isset($this->content)) |
|
36 | - $this->content=array ($this->content); |
|
37 | - else |
|
38 | - $this->content=array(); |
|
35 | + if(isset($this->content)) { |
|
36 | + $this->content=array ($this->content); |
|
37 | + } else { |
|
38 | + $this->content=array(); |
|
39 | + } |
|
40 | + } |
|
41 | + if($before) { |
|
42 | + array_unshift($this->content,$content); |
|
43 | + } else { |
|
44 | + $this->content []=$content; |
|
39 | 45 | } |
40 | - if($before) |
|
41 | - array_unshift($this->content,$content); |
|
42 | - else |
|
43 | - $this->content []=$content; |
|
44 | 46 | return $this; |
45 | 47 | } |
46 | 48 | |
@@ -78,9 +80,9 @@ discard block |
||
78 | 80 | $instances=[]; |
79 | 81 | if($content instanceof $class){ |
80 | 82 | $instances[]=$content; |
81 | - }elseif($content instanceof HtmlDoubleElement){ |
|
83 | + } elseif($content instanceof HtmlDoubleElement){ |
|
82 | 84 | $instances=\array_merge($instances,$content->getContentInstances($class)); |
83 | - }elseif (\is_array($content)){ |
|
85 | + } elseif (\is_array($content)){ |
|
84 | 86 | foreach ($content as $element){ |
85 | 87 | $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
86 | 88 | } |
@@ -93,10 +95,12 @@ discard block |
||
93 | 95 | * @return HtmlDoubleElement |
94 | 96 | */ |
95 | 97 | public function asLink($href=NULL,$target=NULL) { |
96 | - if (isset($href)) |
|
97 | - $this->setProperty("href", $href); |
|
98 | - if(isset($target)) |
|
99 | - $this->setProperty("target", $target); |
|
98 | + if (isset($href)) { |
|
99 | + $this->setProperty("href", $href); |
|
100 | + } |
|
101 | + if(isset($target)) { |
|
102 | + $this->setProperty("target", $target); |
|
103 | + } |
|
100 | 104 | return $this->setTagName("a"); |
101 | 105 | } |
102 | 106 | |
@@ -121,7 +125,7 @@ discard block |
||
121 | 125 | $this->_editableContent=$frm; |
122 | 126 | $keypress=""; |
123 | 127 | $focusOut=""; |
124 | - }else{ |
|
128 | + } else{ |
|
125 | 129 | $focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');"; |
126 | 130 | $this->_editableContent=$field; |
127 | 131 | $keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});"; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++); |
65 | 65 | $i++; |
66 | 66 | } |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | $separators[]=$count; |
69 | 69 | for($i=0;$i<$size;$i++){ |
70 | 70 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -78,17 +78,19 @@ discard block |
||
78 | 78 | |
79 | 79 | protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers,$nb){ |
80 | 80 | $wrapper=null; |
81 | - if(isset($headers[$sepFirst+1])) |
|
82 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
81 | + if(isset($headers[$sepFirst+1])) { |
|
82 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
83 | + } |
|
83 | 84 | if(isset($wrappers[$sepFirst+1])){ |
84 | 85 | $wrapper=$wrappers[$sepFirst+1]; |
85 | 86 | } |
86 | 87 | if(\sizeof($values)===1){ |
87 | 88 | $added=$form->addField($values[0]); |
88 | - }elseif(\sizeof($values)>1){ |
|
89 | + } elseif(\sizeof($values)>1){ |
|
89 | 90 | $added=$form->addFields($values); |
90 | - }else |
|
91 | - return; |
|
91 | + } else { |
|
92 | + return; |
|
93 | + } |
|
92 | 94 | if(isset($wrapper)){ |
93 | 95 | $added->wrap($wrapper[0],$wrapper[1]); |
94 | 96 | } |
@@ -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 |