@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | } |
49 | 49 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
50 | 50 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$jsCallback)."});\n"; |
51 | - if ($immediatly) |
|
52 | - $this->jquery_code_for_compile[]=$retour; |
|
51 | + if ($immediatly) { |
|
52 | + $this->jquery_code_for_compile[]=$retour; |
|
53 | + } |
|
53 | 54 | return $retour; |
54 | 55 | } |
55 | 56 | |
@@ -63,15 +64,17 @@ discard block |
||
63 | 64 | $url=$this->_correctAjaxUrl($url); |
64 | 65 | $retour="url='".$url."';"; |
65 | 66 | $slash="/"; |
66 | - if(JString::endswith($url, "/")===true) |
|
67 | - $slash=""; |
|
67 | + if(JString::endswith($url, "/")===true) { |
|
68 | + $slash=""; |
|
69 | + } |
|
68 | 70 | if(JString::isNotNull($attr)){ |
69 | - if ($attr==="value") |
|
70 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
71 | - elseif ($attr==="html") |
|
72 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
73 | - elseif($attr!=null && $attr!=="") |
|
74 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
71 | + if ($attr==="value") { |
|
72 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
73 | + } elseif ($attr==="html") { |
|
74 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
75 | + } elseif($attr!=null && $attr!=="") { |
|
76 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
77 | + } |
|
75 | 78 | } |
76 | 79 | return $retour; |
77 | 80 | } |
@@ -93,8 +96,9 @@ discard block |
||
93 | 96 | } |
94 | 97 | |
95 | 98 | protected function _correctAjaxUrl($url) { |
96 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
97 | - $url=substr($url, 0, strlen($url)-1); |
|
99 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
100 | + $url=substr($url, 0, strlen($url)-1); |
|
101 | + } |
|
98 | 102 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
99 | 103 | $url=$this->jsUtils->getUrl($url); |
100 | 104 | } |
@@ -118,8 +122,9 @@ discard block |
||
118 | 122 | $retour.="\t".$jsCallback."\n". |
119 | 123 | "\t$(document).trigger('jsonReady',[data]);\n". |
120 | 124 | "});\n"; |
121 | - if ($immediatly) |
|
122 | - $this->jquery_code_for_compile[]=$retour; |
|
125 | + if ($immediatly) { |
|
126 | + $this->jquery_code_for_compile[]=$retour; |
|
127 | + } |
|
123 | 128 | return $retour; |
124 | 129 | } |
125 | 130 | |
@@ -158,7 +163,7 @@ discard block |
||
158 | 163 | if($context===null){ |
159 | 164 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
160 | 165 | $newElm = "$('#'+newId)"; |
161 | - }else{ |
|
166 | + } else{ |
|
162 | 167 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
163 | 168 | $newElm = $context.".find('#'+newId)"; |
164 | 169 | } |
@@ -168,8 +173,9 @@ discard block |
||
168 | 173 | $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"; |
169 | 174 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
170 | 175 | $retour.="\t".$jsCallback."\n"."});\n"; |
171 | - if ($immediatly) |
|
172 | - $this->jquery_code_for_compile[]=$retour; |
|
176 | + if ($immediatly) { |
|
177 | + $this->jquery_code_for_compile[]=$retour; |
|
178 | + } |
|
173 | 179 | return $retour; |
174 | 180 | } |
175 | 181 | /** |
@@ -210,8 +216,9 @@ discard block |
||
210 | 216 | }});\n"; |
211 | 217 | $retour.="$('#".$form."').submit();\n"; |
212 | 218 | } |
213 | - if ($immediatly) |
|
214 | - $this->jquery_code_for_compile[]=$retour; |
|
219 | + if ($immediatly) { |
|
220 | + $this->jquery_code_for_compile[]=$retour; |
|
221 | + } |
|
215 | 222 | return $retour; |
216 | 223 | } |
217 | 224 |
@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function setStyle($value) { |
52 | - foreach ( $this->elements as $element ) |
|
53 | - $element->setStyle($value); |
|
52 | + foreach ( $this->elements as $element ) { |
|
53 | + $element->setStyle($value); |
|
54 | + } |
|
54 | 55 | } |
55 | 56 | |
56 | 57 | private function dropdownAsButton($bt) { |
@@ -76,18 +77,19 @@ discard block |
||
76 | 77 | } elseif (is_string($element)) { |
77 | 78 | $result=new HtmlButton($this->identifier."-button-".$iid,$element); |
78 | 79 | } |
79 | - if($result instanceof HtmlButton) |
|
80 | - $this->elements[]=$result; |
|
80 | + if($result instanceof HtmlButton) { |
|
81 | + $this->elements[]=$result; |
|
82 | + } |
|
81 | 83 | return $result; |
82 | 84 | } |
83 | 85 | |
84 | 86 | private function _addArrayElement(array $element,$iid){ |
85 | - if (array_key_exists("glyph", $element)) |
|
86 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
87 | - elseif (array_key_exists("btnCaption", $element)) { |
|
88 | - if (array_key_exists("split", $element)) |
|
89 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
90 | - else{ |
|
87 | + if (array_key_exists("glyph", $element)) { |
|
88 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
89 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
90 | + if (array_key_exists("split", $element)) { |
|
91 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
92 | + } else{ |
|
91 | 93 | $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
92 | 94 | $this->dropdownAsButton($bt); |
93 | 95 | } |
@@ -116,8 +118,9 @@ discard block |
||
116 | 118 | public function setAlignment($value) { |
117 | 119 | if (is_int($value)) { |
118 | 120 | $value=CssRef::alignment("btn-group")[$value]; |
119 | - } else |
|
120 | - $value="btn-group-".$value; |
|
121 | + } else { |
|
122 | + $value="btn-group-".$value; |
|
123 | + } |
|
121 | 124 | if (strstr($value, "justified")) { |
122 | 125 | foreach ( $this->elements as $element ) { |
123 | 126 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -132,9 +135,9 @@ discard block |
||
132 | 135 | * @return HtmlButton |
133 | 136 | */ |
134 | 137 | public function getElement($index) { |
135 | - if (is_int($index)) |
|
136 | - return $this->elements[$index]; |
|
137 | - else { |
|
138 | + if (is_int($index)) { |
|
139 | + return $this->elements[$index]; |
|
140 | + } else { |
|
138 | 141 | $elm=$this->getElementById($index, $this->elements); |
139 | 142 | return $elm; |
140 | 143 | } |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | public function setAttached($value=true){ |
44 | 44 | $form=$this->getForm(); |
45 | - if($value) |
|
46 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
45 | + if($value) { |
|
46 | + $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
47 | + } |
|
47 | 48 | return $form; |
48 | 49 | } |
49 | 50 | |
@@ -85,8 +86,9 @@ discard block |
||
85 | 86 | if(isset($url) && isset($responseElement)){ |
86 | 87 | $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');"); |
87 | 88 | $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
88 | - if(\is_array($parameters)) |
|
89 | - $params=\array_merge($params,$parameters); |
|
89 | + if(\is_array($parameters)) { |
|
90 | + $params=\array_merge($params,$parameters); |
|
91 | + } |
|
90 | 92 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
91 | 93 | } |
92 | 94 | return $button; |
@@ -33,8 +33,9 @@ |
||
33 | 33 | |
34 | 34 | |
35 | 35 | public function addSeparatorAfter($fieldNum){ |
36 | - if(\array_search($fieldNum, $this->separators)===false) |
|
37 | - $this->separators[]=$fieldNum; |
|
36 | + if(\array_search($fieldNum, $this->separators)===false) { |
|
37 | + $this->separators[]=$fieldNum; |
|
38 | + } |
|
38 | 39 | return $this; |
39 | 40 | } |
40 | 41 |
@@ -54,14 +54,14 @@ |
||
54 | 54 | foreach ($values as $v){ |
55 | 55 | $form->addField($v); |
56 | 56 | } |
57 | - }else{ |
|
57 | + } else{ |
|
58 | 58 | $separators[]=$count; |
59 | 59 | for($i=0;$i<$size;$i++){ |
60 | 60 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
61 | 61 | //TODO check why $fields is empty |
62 | 62 | if(\sizeof($fields)===1){ |
63 | 63 | $form->addField($fields[0]); |
64 | - }elseif(\sizeof($fields)>1){ |
|
64 | + } elseif(\sizeof($fields)>1){ |
|
65 | 65 | $form->addFields($fields); |
66 | 66 | } |
67 | 67 | } |
@@ -50,10 +50,12 @@ discard block |
||
50 | 50 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
51 | 51 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
52 | 52 | } |
53 | - if($this->_hasDelete) |
|
54 | - $this->_generateBehavior("delete", $js); |
|
55 | - if($this->_hasEdit) |
|
56 | - $this->_generateBehavior("edit", $js); |
|
53 | + if($this->_hasDelete) { |
|
54 | + $this->_generateBehavior("delete", $js); |
|
55 | + } |
|
56 | + if($this->_hasEdit) { |
|
57 | + $this->_generateBehavior("edit", $js); |
|
58 | + } |
|
57 | 59 | return parent::run($js); |
58 | 60 | } |
59 | 61 | |
@@ -76,8 +78,9 @@ discard block |
||
76 | 78 | } |
77 | 79 | |
78 | 80 | protected function _generateBehavior($op,JsUtils $js){ |
79 | - if(isset($this->_urls[$op])) |
|
80 | - $js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector(),["attr"=>"data-ajax"]); |
|
81 | + if(isset($this->_urls[$op])) { |
|
82 | + $js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector(),["attr"=>"data-ajax"]); |
|
83 | + } |
|
81 | 84 | } |
82 | 85 | |
83 | 86 | /** |
@@ -102,12 +105,14 @@ discard block |
||
102 | 105 | |
103 | 106 | $table->setRowCount(0, \sizeof($captions)); |
104 | 107 | $table->setHeaderValues($captions); |
105 | - if(isset($this->_compileParts)) |
|
106 | - $table->setCompileParts($this->_compileParts); |
|
108 | + if(isset($this->_compileParts)) { |
|
109 | + $table->setCompileParts($this->_compileParts); |
|
110 | + } |
|
107 | 111 | |
108 | 112 | if(isset($this->_searchField) && isset($js)){ |
109 | - if(isset($this->_urls["refresh"])) |
|
110 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
113 | + if(isset($this->_urls["refresh"])) { |
|
114 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
115 | + } |
|
111 | 116 | } |
112 | 117 | |
113 | 118 | $this->_generateContent($table); |
@@ -132,8 +137,9 @@ discard block |
||
132 | 137 | private function _generateMainCheckbox(&$captions){ |
133 | 138 | $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
134 | 139 | $checkedMessageCall=""; |
135 | - if($this->_hasCheckedMessage) |
|
136 | - $checkedMessageCall="updateChecked();"; |
|
140 | + if($this->_hasCheckedMessage) { |
|
141 | + $checkedMessageCall="updateChecked();"; |
|
142 | + } |
|
137 | 143 | $ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall); |
138 | 144 | $ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall); |
139 | 145 | \array_unshift($captions, $ck); |
@@ -170,8 +176,9 @@ discard block |
||
170 | 176 | $menu->floatRight(); |
171 | 177 | $menu->setActiveItem($this->_pagination->getPage()-1); |
172 | 178 | $footer->setValues($menu); |
173 | - if(isset($this->_urls["refresh"])) |
|
174 | - $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
179 | + if(isset($this->_urls["refresh"])) { |
|
180 | + $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
181 | + } |
|
175 | 182 | } |
176 | 183 | |
177 | 184 | protected function _getFieldName($index){ |
@@ -214,7 +221,7 @@ discard block |
||
214 | 221 | $hasPart=$table->hasPart($part); |
215 | 222 | if($hasPart){ |
216 | 223 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
217 | - }else{ |
|
224 | + } else{ |
|
218 | 225 | $row=$table->getPart($part)->getRow(0); |
219 | 226 | } |
220 | 227 | $row->mergeCol(); |
@@ -239,7 +246,7 @@ discard block |
||
239 | 246 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
240 | 247 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
241 | 248 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
242 | - }else{ |
|
249 | + } else{ |
|
243 | 250 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
244 | 251 | } |
245 | 252 | return $this; |
@@ -295,8 +302,9 @@ discard block |
||
295 | 302 | |
296 | 303 | protected function getTargetSelector() { |
297 | 304 | $result=$this->_targetSelector; |
298 | - if(!isset($result)) |
|
299 | - $result="#".$this->identifier; |
|
305 | + if(!isset($result)) { |
|
306 | + $result="#".$this->identifier; |
|
307 | + } |
|
300 | 308 | return $result; |
301 | 309 | } |
302 | 310 | |
@@ -334,8 +342,9 @@ discard block |
||
334 | 342 | * @param callable $callback |
335 | 343 | */ |
336 | 344 | public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){ |
337 | - if(isset($checkedMessage)) |
|
338 | - $this->_checkedMessage=$checkedMessage; |
|
345 | + if(isset($checkedMessage)) { |
|
346 | + $this->_checkedMessage=$checkedMessage; |
|
347 | + } |
|
339 | 348 | $checkedMessage=$this->getCheckedMessage(); |
340 | 349 | $this->_hasCheckboxes=true; |
341 | 350 | $this->_hasCheckedMessage=true; |
@@ -58,8 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private function getFieldButton($caption,$visibleHover=true){ |
60 | 60 | $bt= new HtmlButton("",$caption); |
61 | - if($visibleHover) |
|
62 | - $this->_visibleOver($bt); |
|
61 | + if($visibleHover) { |
|
62 | + $this->_visibleOver($bt); |
|
63 | + } |
|
63 | 64 | return $bt; |
64 | 65 | } |
65 | 66 | |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
77 | 78 | $button=new HtmlButton($id,$value,$cssStyle); |
78 | 79 | $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
79 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
80 | - $this->_visibleOver($button); |
|
80 | + if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) { |
|
81 | + $this->_visibleOver($button); |
|
82 | + } |
|
81 | 83 | return $button; |
82 | 84 | }, $index,$attributes); |
83 | 85 | } |
@@ -136,8 +138,9 @@ discard block |
||
136 | 138 | private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
137 | 139 | $bt=$this->getFieldButton("",$visibleHover); |
138 | 140 | $bt->asIcon($icon); |
139 | - if(isset($class)) |
|
140 | - $bt->addClass($class); |
|
141 | + if(isset($class)) { |
|
142 | + $bt->addClass($class); |
|
143 | + } |
|
141 | 144 | return $bt; |
142 | 145 | } |
143 | 146 |