@@ -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 | |
@@ -54,8 +54,9 @@ discard block |
||
| 54 | 54 | $this->params[$key]=$params[$key]; |
| 55 | 55 | } |
| 56 | 56 | $this->jsUtils=$jsUtils; |
| 57 | - if(isset($params["ajaxTransition"])) |
|
| 58 | - $this->ajaxTransition=$this->setAjaxDataCall($params["ajaxTransition"]); |
|
| 57 | + if(isset($params["ajaxTransition"])) { |
|
| 58 | + $this->ajaxTransition=$this->setAjaxDataCall($params["ajaxTransition"]); |
|
| 59 | + } |
|
| 59 | 60 | } |
| 60 | 61 | |
| 61 | 62 | /** |
@@ -138,10 +139,12 @@ discard block |
||
| 138 | 139 | if (isset($param)) { |
| 139 | 140 | $param=Javascript::prep_value($param); |
| 140 | 141 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 141 | - } else |
|
| 142 | - $str="$({$element}).{$jQueryCall}();"; |
|
| 143 | - if ($immediatly) |
|
| 144 | - $this->jquery_code_for_compile[]=$str; |
|
| 142 | + } else { |
|
| 143 | + $str="$({$element}).{$jQueryCall}();"; |
|
| 144 | + } |
|
| 145 | + if ($immediatly) { |
|
| 146 | + $this->jquery_code_for_compile[]=$str; |
|
| 147 | + } |
|
| 145 | 148 | return $str; |
| 146 | 149 | } |
| 147 | 150 | /** |
@@ -156,8 +159,9 @@ discard block |
||
| 156 | 159 | $to=Javascript::prep_element($to); |
| 157 | 160 | $element=Javascript::prep_element($element); |
| 158 | 161 | $str="$({$to}).{$jQueryCall}({$element});"; |
| 159 | - if ($immediatly) |
|
| 160 | - $this->jquery_code_for_compile[]=$str; |
|
| 162 | + if ($immediatly) { |
|
| 163 | + $this->jquery_code_for_compile[]=$str; |
|
| 164 | + } |
|
| 161 | 165 | return $str; |
| 162 | 166 | } |
| 163 | 167 | |
@@ -213,12 +217,14 @@ discard block |
||
| 213 | 217 | if ($stopPropagation===true) { |
| 214 | 218 | $js=Javascript::$stopPropagation.$js; |
| 215 | 219 | } |
| 216 | - if (array_search($event, $this->jquery_events)===false) |
|
| 217 | - $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 218 | - else |
|
| 219 | - $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 220 | - if($immediatly) |
|
| 221 | - $this->jquery_code_for_compile[]=$event; |
|
| 220 | + if (array_search($event, $this->jquery_events)===false) { |
|
| 221 | + $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 222 | + } else { |
|
| 223 | + $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 224 | + } |
|
| 225 | + if($immediatly) { |
|
| 226 | + $this->jquery_code_for_compile[]=$event; |
|
| 227 | + } |
|
| 222 | 228 | return $event; |
| 223 | 229 | } |
| 224 | 230 | |
@@ -303,7 +309,9 @@ discard block |
||
| 303 | 309 | } |
| 304 | 310 | |
| 305 | 311 | private function minify($input) { |
| 306 | - if(trim($input) === "") return $input; |
|
| 312 | + if(trim($input) === "") { |
|
| 313 | + return $input; |
|
| 314 | + } |
|
| 307 | 315 | return preg_replace( |
| 308 | 316 | array( |
| 309 | 317 | // Remove comment(s) |
@@ -48,8 +48,9 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function setAttached($value=true){ |
| 50 | 50 | $form=$this->getForm(); |
| 51 | - if($value) |
|
| 52 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 51 | + if($value) { |
|
| 52 | + $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 53 | + } |
|
| 53 | 54 | return $form; |
| 54 | 55 | } |
| 55 | 56 | |
@@ -91,8 +92,9 @@ discard block |
||
| 91 | 92 | if(isset($url) && isset($responseElement)){ |
| 92 | 93 | $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
| 93 | 94 | $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
| 94 | - if(\is_array($parameters)) |
|
| 95 | - $params=\array_merge($params,$parameters); |
|
| 95 | + if(\is_array($parameters)) { |
|
| 96 | + $params=\array_merge($params,$parameters); |
|
| 97 | + } |
|
| 96 | 98 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
| 97 | 99 | } |
| 98 | 100 | return $button; |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | protected function _generateMainCheckbox(&$captions){ |
| 43 | 43 | $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
| 44 | 44 | $checkedMessageCall=""; |
| 45 | - if($this->_hasCheckedMessage) |
|
| 46 | - $checkedMessageCall="updateChecked();"; |
|
| 45 | + if($this->_hasCheckedMessage) { |
|
| 46 | + $checkedMessageCall="updateChecked();"; |
|
| 47 | + } |
|
| 47 | 48 | |
| 48 | 49 | $ck->setOnChecked($this->_setAllChecked("true").$checkedMessageCall); |
| 49 | 50 | $ck->setOnUnchecked($this->_setAllChecked("false").$checkedMessageCall); |
@@ -91,8 +92,9 @@ discard block |
||
| 91 | 92 | * @param callable $callback |
| 92 | 93 | */ |
| 93 | 94 | public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){ |
| 94 | - if(isset($checkedMessage)) |
|
| 95 | - $this->_checkedMessage=$checkedMessage; |
|
| 95 | + if(isset($checkedMessage)) { |
|
| 96 | + $this->_checkedMessage=$checkedMessage; |
|
| 97 | + } |
|
| 96 | 98 | $checkedMessage=$this->getCheckedMessage(); |
| 97 | 99 | $this->_hasCheckboxes=true; |
| 98 | 100 | $this->_hasCheckedMessage=true; |
@@ -46,10 +46,12 @@ discard block |
||
| 46 | 46 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 47 | 47 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 48 | 48 | } |
| 49 | - if(\is_array($this->_deleteBehavior)) |
|
| 50 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 51 | - if(\is_array($this->_editBehavior)) |
|
| 52 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 49 | + if(\is_array($this->_deleteBehavior)) { |
|
| 50 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 51 | + } |
|
| 52 | + if(\is_array($this->_editBehavior)) { |
|
| 53 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 54 | + } |
|
| 53 | 55 | return parent::run($js); |
| 54 | 56 | } |
| 55 | 57 | |
@@ -84,12 +86,14 @@ discard block |
||
| 84 | 86 | |
| 85 | 87 | $table->setRowCount(0, \sizeof($captions)); |
| 86 | 88 | $table->setHeaderValues($captions); |
| 87 | - if(isset($this->_compileParts)) |
|
| 88 | - $table->setCompileParts($this->_compileParts); |
|
| 89 | + if(isset($this->_compileParts)) { |
|
| 90 | + $table->setCompileParts($this->_compileParts); |
|
| 91 | + } |
|
| 89 | 92 | |
| 90 | 93 | if(isset($this->_searchField) && isset($js)){ |
| 91 | - if(isset($this->_urls["refresh"])) |
|
| 92 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 94 | + if(isset($this->_urls["refresh"])) { |
|
| 95 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 96 | + } |
|
| 93 | 97 | } |
| 94 | 98 | |
| 95 | 99 | $this->_generateContent($table); |
@@ -144,8 +148,9 @@ discard block |
||
| 144 | 148 | $menu->floatRight(); |
| 145 | 149 | $menu->setActiveItem($this->_pagination->getPage()-1); |
| 146 | 150 | $footer->setValues($menu); |
| 147 | - if(isset($this->_urls["refresh"])) |
|
| 148 | - $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 151 | + if(isset($this->_urls["refresh"])) { |
|
| 152 | + $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 153 | + } |
|
| 149 | 154 | } |
| 150 | 155 | |
| 151 | 156 | protected function _getFieldName($index){ |
@@ -188,7 +193,7 @@ discard block |
||
| 188 | 193 | $hasPart=$table->hasPart($part); |
| 189 | 194 | if($hasPart){ |
| 190 | 195 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 191 | - }else{ |
|
| 196 | + } else{ |
|
| 192 | 197 | $row=$table->getPart($part)->getRow(0); |
| 193 | 198 | } |
| 194 | 199 | $row->mergeCol(); |
@@ -213,7 +218,7 @@ discard block |
||
| 213 | 218 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
| 214 | 219 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
| 215 | 220 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
| 216 | - }else{ |
|
| 221 | + } else{ |
|
| 217 | 222 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
| 218 | 223 | } |
| 219 | 224 | return $this; |
@@ -262,8 +267,9 @@ discard block |
||
| 262 | 267 | |
| 263 | 268 | protected function getTargetSelector() { |
| 264 | 269 | $result=$this->_targetSelector; |
| 265 | - if(!isset($result)) |
|
| 266 | - $result="#".$this->identifier; |
|
| 270 | + if(!isset($result)) { |
|
| 271 | + $result="#".$this->identifier; |
|
| 272 | + } |
|
| 267 | 273 | return $result; |
| 268 | 274 | } |
| 269 | 275 | |
@@ -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,$ajaxTransition,$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 | |
@@ -67,15 +68,17 @@ discard block |
||
| 67 | 68 | $url=$this->_correctAjaxUrl($url); |
| 68 | 69 | $retour="url='".$url."';"; |
| 69 | 70 | $slash="/"; |
| 70 | - if(JString::endswith($url, "/")===true) |
|
| 71 | - $slash=""; |
|
| 71 | + if(JString::endswith($url, "/")===true) { |
|
| 72 | + $slash=""; |
|
| 73 | + } |
|
| 72 | 74 | if(JString::isNotNull($attr)){ |
| 73 | - if ($attr==="value") |
|
| 74 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 75 | - elseif ($attr==="html") |
|
| 76 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
| 77 | - elseif($attr!=null && $attr!=="") |
|
| 78 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 75 | + if ($attr==="value") { |
|
| 76 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 77 | + } elseif ($attr==="html") { |
|
| 78 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
| 79 | + } elseif($attr!=null && $attr!=="") { |
|
| 80 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 81 | + } |
|
| 79 | 82 | } |
| 80 | 83 | return $retour; |
| 81 | 84 | } |
@@ -85,13 +88,14 @@ discard block |
||
| 85 | 88 | if ($responseElement!=="") { |
| 86 | 89 | if(isset($ajaxTransition)){ |
| 87 | 90 | $call=$this->setAjaxDataCall($ajaxTransition); |
| 88 | - }elseif(isset($this->ajaxTransition)){ |
|
| 91 | + } elseif(isset($this->ajaxTransition)){ |
|
| 89 | 92 | $call=$this->ajaxTransition; |
| 90 | 93 | } |
| 91 | - if(\is_callable($call)) |
|
| 92 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
| 93 | - else |
|
| 94 | - $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
|
| 94 | + if(\is_callable($call)) { |
|
| 95 | + $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
| 96 | + } else { |
|
| 97 | + $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
|
| 98 | + } |
|
| 95 | 99 | } |
| 96 | 100 | $retour.="\t".$jsCallback."\n"; |
| 97 | 101 | return $retour; |
@@ -105,8 +109,9 @@ discard block |
||
| 105 | 109 | } |
| 106 | 110 | |
| 107 | 111 | protected function _correctAjaxUrl($url) { |
| 108 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
| 109 | - $url=substr($url, 0, strlen($url)-1); |
|
| 112 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
| 113 | + $url=substr($url, 0, strlen($url)-1); |
|
| 114 | + } |
|
| 110 | 115 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 111 | 116 | $url=$this->jsUtils->getUrl($url); |
| 112 | 117 | } |
@@ -130,8 +135,9 @@ discard block |
||
| 130 | 135 | $retour.="\t".$jsCallback."\n". |
| 131 | 136 | "\t$(document).trigger('jsonReady',[data]);\n". |
| 132 | 137 | "});\n"; |
| 133 | - if ($immediatly) |
|
| 134 | - $this->jquery_code_for_compile[]=$retour; |
|
| 138 | + if ($immediatly) { |
|
| 139 | + $this->jquery_code_for_compile[]=$retour; |
|
| 140 | + } |
|
| 135 | 141 | return $retour; |
| 136 | 142 | } |
| 137 | 143 | |
@@ -170,7 +176,7 @@ discard block |
||
| 170 | 176 | if($context===null){ |
| 171 | 177 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 172 | 178 | $newElm = "$('#'+newId)"; |
| 173 | - }else{ |
|
| 179 | + } else{ |
|
| 174 | 180 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 175 | 181 | $newElm = $context.".find('#'+newId)"; |
| 176 | 182 | } |
@@ -180,8 +186,9 @@ discard block |
||
| 180 | 186 | $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"; |
| 181 | 187 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 182 | 188 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 183 | - if ($immediatly) |
|
| 184 | - $this->jquery_code_for_compile[]=$retour; |
|
| 189 | + if ($immediatly) { |
|
| 190 | + $this->jquery_code_for_compile[]=$retour; |
|
| 191 | + } |
|
| 185 | 192 | return $retour; |
| 186 | 193 | } |
| 187 | 194 | /** |
@@ -222,8 +229,9 @@ discard block |
||
| 222 | 229 | }});\n"; |
| 223 | 230 | $retour.="$('#".$form."').submit();\n"; |
| 224 | 231 | } |
| 225 | - if ($immediatly) |
|
| 226 | - $this->jquery_code_for_compile[]=$retour; |
|
| 232 | + if ($immediatly) { |
|
| 233 | + $this->jquery_code_for_compile[]=$retour; |
|
| 234 | + } |
|
| 227 | 235 | return $retour; |
| 228 | 236 | } |
| 229 | 237 | |
@@ -47,15 +47,17 @@ |
||
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | public function addSeparatorAfter($fieldNum){ |
| 50 | - if(\array_search($fieldNum, $this->separators)===false) |
|
| 51 | - $this->separators[]=$fieldNum; |
|
| 50 | + if(\array_search($fieldNum, $this->separators)===false) { |
|
| 51 | + $this->separators[]=$fieldNum; |
|
| 52 | + } |
|
| 52 | 53 | return $this; |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | public function addHeaderDividerBefore($fieldNum,$header){ |
| 56 | 57 | $this->headers[$fieldNum]=$header; |
| 57 | - if($fieldNum>0) |
|
| 58 | - $this->addSeparatorAfter($fieldNum-1); |
|
| 58 | + if($fieldNum>0) { |
|
| 59 | + $this->addSeparatorAfter($fieldNum-1); |
|
| 60 | + } |
|
| 59 | 61 | return $this; |
| 60 | 62 | } |
| 61 | 63 | |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | parent::__construct($identifier, "div","field"); |
| 19 | 19 | $this->content=array(); |
| 20 | 20 | $this->_states=[State::ERROR,State::DISABLED]; |
| 21 | - if(isset($label) && $label!=="") |
|
| 22 | - $this->setLabel($label); |
|
| 21 | + if(isset($label) && $label!=="") { |
|
| 22 | + $this->setLabel($label); |
|
| 23 | + } |
|
| 23 | 24 | $this->setField($field); |
| 24 | 25 | $this->_validation=NULL; |
| 25 | 26 | } |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | * @return mixed |
| 51 | 52 | */ |
| 52 | 53 | public function getLabel(){ |
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 54 | - return $this->content["label"]; |
|
| 54 | + if(\array_key_exists("label", $this->content)) { |
|
| 55 | + return $this->content["label"]; |
|
| 56 | + } |
|
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | /** |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | $rules=$attributes["rules"]; |
| 63 | 63 | if(\is_array($rules)){ |
| 64 | 64 | $element->addRules($rules); |
| 65 | - } |
|
| 66 | - else{ |
|
| 65 | + } else{ |
|
| 67 | 66 | $element->addRule($rules); |
| 68 | 67 | } |
| 69 | 68 | unset($attributes["rules"]); |
@@ -123,8 +122,9 @@ discard block |
||
| 123 | 122 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 124 | 123 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 125 | 124 | $header=new HtmlHeader($id,$niveau,$value); |
| 126 | - if(isset($icon)) |
|
| 127 | - $header->asIcon($icon, $value); |
|
| 125 | + if(isset($icon)) { |
|
| 126 | + $header->asIcon($icon, $value); |
|
| 127 | + } |
|
| 128 | 128 | return $header; |
| 129 | 129 | }, $index,$attributes,"header"); |
| 130 | 130 | } |
@@ -132,7 +132,9 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 134 | 134 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 135 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 135 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 136 | + $image->setCircular(); |
|
| 137 | + } |
|
| 136 | 138 | return $image; |
| 137 | 139 | }); |
| 138 | 140 | return $this; |
@@ -221,14 +223,14 @@ discard block |
||
| 221 | 223 | $i=0; |
| 222 | 224 | if(JArray::isAssociative($types)){ |
| 223 | 225 | foreach ($types as $type=>$attributes){ |
| 224 | - if(\is_int($type)) |
|
| 225 | - $this->fieldAs($i++,$attributes,[]); |
|
| 226 | - else{ |
|
| 226 | + if(\is_int($type)) { |
|
| 227 | + $this->fieldAs($i++,$attributes,[]); |
|
| 228 | + } else{ |
|
| 227 | 229 | $type=preg_replace('/\d/', '', $type ); |
| 228 | 230 | $this->fieldAs($i++,$type,$attributes); |
| 229 | 231 | } |
| 230 | 232 | } |
| 231 | - }else{ |
|
| 233 | + } else{ |
|
| 232 | 234 | foreach ($types as $type){ |
| 233 | 235 | $this->fieldAs($i++,$type); |
| 234 | 236 | } |
@@ -240,7 +242,7 @@ discard block |
||
| 240 | 242 | if(\method_exists($this, $method)){ |
| 241 | 243 | if(!\is_array($attributes)){ |
| 242 | 244 | $attributes=[$index]; |
| 243 | - }else{ |
|
| 245 | + } else{ |
|
| 244 | 246 | \array_unshift($attributes, $index); |
| 245 | 247 | } |
| 246 | 248 | \call_user_func_array([$this,$method], $attributes); |