@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | private function getLastButtonGroup() { |
| 48 | 48 | $nb=sizeof($this->elements); |
| 49 | - if ($nb>0) |
|
| 50 | - $bg=$this->elements [$nb-1]; |
|
| 51 | - else { |
|
| 49 | + if ($nb>0) { |
|
| 50 | + $bg=$this->elements [$nb-1]; |
|
| 51 | + } else { |
|
| 52 | 52 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
| 53 | 53 | $this->elements []=$bg; |
| 54 | 54 | } |
@@ -66,8 +66,9 @@ discard block |
||
| 66 | 66 | public function getLastGroup() { |
| 67 | 67 | $bg=null; |
| 68 | 68 | $nb=sizeof($this->elements); |
| 69 | - if ($nb>0) |
|
| 70 | - $bg=$this->elements [$nb-1]; |
|
| 69 | + if ($nb>0) { |
|
| 70 | + $bg=$this->elements [$nb-1]; |
|
| 71 | + } |
|
| 71 | 72 | return $bg; |
| 72 | 73 | } |
| 73 | 74 | |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function setStyle($value) { |
| 48 | - foreach ( $this->elements as $element ) |
|
| 49 | - $element->setStyle($value); |
|
| 48 | + foreach ( $this->elements as $element ) { |
|
| 49 | + $element->setStyle($value); |
|
| 50 | + } |
|
| 50 | 51 | } |
| 51 | 52 | |
| 52 | 53 | private function dropdownAsButton($bt) { |
@@ -71,16 +72,18 @@ discard block |
||
| 71 | 72 | } elseif ($element instanceof HtmlButton) { |
| 72 | 73 | $this->elements[]=$element; |
| 73 | 74 | } elseif (is_array($element)) { |
| 74 | - if (array_key_exists("glyph", $element)) |
|
| 75 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 76 | - elseif (array_key_exists("btnCaption", $element)) { |
|
| 77 | - if (array_key_exists("split", $element)) |
|
| 78 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 79 | - else |
|
| 80 | - $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 75 | + if (array_key_exists("glyph", $element)) { |
|
| 76 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 77 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
| 78 | + if (array_key_exists("split", $element)) { |
|
| 79 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 80 | + } else { |
|
| 81 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 82 | + } |
|
| 81 | 83 | $this->dropdownAsButton($bt); |
| 82 | - } else |
|
| 83 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 84 | + } else { |
|
| 85 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 86 | + } |
|
| 84 | 87 | $bt->fromArray($element); |
| 85 | 88 | $this->elements[]=$bt; |
| 86 | 89 | $result=$bt; |
@@ -111,8 +114,9 @@ discard block |
||
| 111 | 114 | public function setAlignment($value) { |
| 112 | 115 | if (is_int($value)) { |
| 113 | 116 | $value=CssRef::alignment("btn-group")[$value]; |
| 114 | - } else |
|
| 115 | - $value="btn-group-".$value; |
|
| 117 | + } else { |
|
| 118 | + $value="btn-group-".$value; |
|
| 119 | + } |
|
| 116 | 120 | if (strstr($value, "justified")) { |
| 117 | 121 | foreach ( $this->elements as $element ) { |
| 118 | 122 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -127,9 +131,9 @@ discard block |
||
| 127 | 131 | * @return HtmlButton |
| 128 | 132 | */ |
| 129 | 133 | public function getElement($index) { |
| 130 | - if (is_int($index)) |
|
| 131 | - return $this->elements[$index]; |
|
| 132 | - else { |
|
| 134 | + if (is_int($index)) { |
|
| 135 | + return $this->elements[$index]; |
|
| 136 | + } else { |
|
| 133 | 137 | $elm=$this->getElementById($index, $this->elements); |
| 134 | 138 | return $elm; |
| 135 | 139 | } |
@@ -28,10 +28,11 @@ discard block |
||
| 28 | 28 | $this->setProperty("aria-describedby", $id); |
| 29 | 29 | $span->setContent($text); |
| 30 | 30 | $span->setClass("input-group-addon"); |
| 31 | - if (strtolower($position)==="left") |
|
| 32 | - $this->addonLeft=$span; |
|
| 33 | - else |
|
| 34 | - $this->addonRight=$span; |
|
| 31 | + if (strtolower($position)==="left") { |
|
| 32 | + $this->addonLeft=$span; |
|
| 33 | + } else { |
|
| 34 | + $this->addonRight=$span; |
|
| 35 | + } |
|
| 35 | 36 | return $span; |
| 36 | 37 | } |
| 37 | 38 | |
@@ -74,7 +75,7 @@ discard block |
||
| 74 | 75 | $bt=NULL; |
| 75 | 76 | if(is_string($item)){ |
| 76 | 77 | $bt=new HtmlButton($this->identifier."-bt-".$i++,$item); |
| 77 | - }elseif ($item instanceof HtmlButton){ |
|
| 78 | + } elseif ($item instanceof HtmlButton){ |
|
| 78 | 79 | $bt=$item; |
| 79 | 80 | } |
| 80 | 81 | if(isset($bt)){ |
@@ -88,10 +89,11 @@ discard block |
||
| 88 | 89 | $dropdown->setBtnCaption($caption); |
| 89 | 90 | $dropdown->fromArray($items); |
| 90 | 91 | |
| 91 | - if (strtolower($position)==="left") |
|
| 92 | - $this->addonLeft=$dropdown; |
|
| 93 | - else |
|
| 94 | - $this->addonRight=$dropdown; |
|
| 92 | + if (strtolower($position)==="left") { |
|
| 93 | + $this->addonLeft=$dropdown; |
|
| 94 | + } else { |
|
| 95 | + $this->addonRight=$dropdown; |
|
| 96 | + } |
|
| 95 | 97 | return $dropdown; |
| 96 | 98 | } |
| 97 | 99 | |
@@ -126,10 +128,12 @@ discard block |
||
| 126 | 128 | |
| 127 | 129 | public function run(JsUtils $js) { |
| 128 | 130 | parent::run($js); |
| 129 | - if (isset($this->addonLeft)) |
|
| 130 | - $this->addonLeft->run($js); |
|
| 131 | - if (isset($this->addonRight)) |
|
| 132 | - $this->addonRight->run($js); |
|
| 131 | + if (isset($this->addonLeft)) { |
|
| 132 | + $this->addonLeft->run($js); |
|
| 133 | + } |
|
| 134 | + if (isset($this->addonRight)) { |
|
| 135 | + $this->addonRight->run($js); |
|
| 136 | + } |
|
| 133 | 137 | } |
| 134 | 138 | |
| 135 | 139 | } |
| 136 | 140 | \ No newline at end of file |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | * @return \Ajax\bootstrap\html\HtmlListgroupItem default : "list-group-item-default" |
| 41 | 41 | */ |
| 42 | 42 | public function setStyle($cssStyle) { |
| 43 | - if (!PhalconUtils::startsWith($cssStyle, "list-group-item")) |
|
| 44 | - $cssStyle="list-group-item".$cssStyle; |
|
| 43 | + if (!PhalconUtils::startsWith($cssStyle, "list-group-item")) { |
|
| 44 | + $cssStyle="list-group-item".$cssStyle; |
|
| 45 | + } |
|
| 45 | 46 | $this->element->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("list-group-item")); |
| 46 | 47 | return $this->element; |
| 47 | 48 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | if (is_array($elements)) { |
| 62 | 62 | foreach ( $elements as $key => $element ) { |
| 63 | 63 | $iid=$this->getElementsCount()+1; |
| 64 | - if ($element instanceof HtmlDropdownItem) |
|
| 65 | - $this->elements []=$element; |
|
| 66 | - else if (is_array($element)) { |
|
| 64 | + if ($element instanceof HtmlDropdownItem) { |
|
| 65 | + $this->elements []=$element; |
|
| 66 | + } else if (is_array($element)) { |
|
| 67 | 67 | if (is_string($key)===true) { |
| 68 | 68 | $dropdown=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
| 69 | 69 | $dropdown->addItems($element); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $li=new HtmlBsDoubleElement($this->identifier."-li-".$iid, "li"); |
| 90 | 90 | if($caption instanceof HtmlLink){ |
| 91 | 91 | $link=$caption; |
| 92 | - }else{ |
|
| 92 | + } else{ |
|
| 93 | 93 | $link=new HtmlLink($this->identifier."-link-".$iid, $href, $caption); |
| 94 | 94 | } |
| 95 | 95 | $li->setContent($link); |
@@ -23,8 +23,9 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function getTabItem($index) { |
| 26 | - if ($index<sizeof($this->content)) |
|
| 27 | - return $this->content [$index]; |
|
| 26 | + if ($index<sizeof($this->content)) { |
|
| 27 | + return $this->content [$index]; |
|
| 28 | + } |
|
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | public function getTabItems() { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $result=null; |
| 44 | 44 | if($index<sizeof($this->cols)+1){ |
| 45 | 45 | $result=$this->cols[$index-1]; |
| 46 | - }else if ($force){ |
|
| 46 | + } else if ($force){ |
|
| 47 | 47 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
| 48 | 48 | } |
| 49 | 49 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->cols = array_values($this->cols); |
| 97 | 97 | $width=$width-$widthCol; |
| 98 | 98 | } |
| 99 | - }else{ |
|
| 99 | + } else{ |
|
| 100 | 100 | $width=0; |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -69,7 +69,8 @@ |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function getPanel($index) { |
| 72 | - if ($index<sizeof($this->content)) |
|
| 73 | - return $this->content [$index]; |
|
| 72 | + if ($index<sizeof($this->content)) { |
|
| 73 | + return $this->content [$index]; |
|
| 74 | + } |
|
| 74 | 75 | } |
| 75 | 76 | } |
| 76 | 77 | \ No newline at end of file |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 43 | 43 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
| 44 | - if ($immediatly) |
|
| 45 | - $this->jquery_code_for_compile[]=$retour; |
|
| 44 | + if ($immediatly) { |
|
| 45 | + $this->jquery_code_for_compile[]=$retour; |
|
| 46 | + } |
|
| 46 | 47 | return $retour; |
| 47 | 48 | } |
| 48 | 49 | |
@@ -50,13 +51,15 @@ discard block |
||
| 50 | 51 | $url=$this->_correctAjaxUrl($url); |
| 51 | 52 | $retour="url='".$url."';\n"; |
| 52 | 53 | $slash="/"; |
| 53 | - if(JString::endswith($url, "/")===true) |
|
| 54 | - $slash=""; |
|
| 54 | + if(JString::endswith($url, "/")===true) { |
|
| 55 | + $slash=""; |
|
| 56 | + } |
|
| 55 | 57 | if(JString::isNotNull($attr)){ |
| 56 | - if ($attr=="value") |
|
| 57 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 58 | - else if($attr!=null && $attr!=="") |
|
| 59 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 58 | + if ($attr=="value") { |
|
| 59 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 60 | + } else if($attr!=null && $attr!=="") { |
|
| 61 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 62 | + } |
|
| 60 | 63 | } |
| 61 | 64 | return $retour; |
| 62 | 65 | } |
@@ -78,8 +81,9 @@ discard block |
||
| 78 | 81 | } |
| 79 | 82 | |
| 80 | 83 | protected function _correctAjaxUrl($url) { |
| 81 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
| 82 | - $url=substr($url, 0, strlen($url)-1); |
|
| 84 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
| 85 | + $url=substr($url, 0, strlen($url)-1); |
|
| 86 | + } |
|
| 83 | 87 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 84 | 88 | $url=$this->jsUtils->getUrl($url); |
| 85 | 89 | } |
@@ -103,8 +107,9 @@ discard block |
||
| 103 | 107 | $retour.="\t".$jsCallback."\n". |
| 104 | 108 | "\t$(document).trigger('jsonReady',[data]);\n". |
| 105 | 109 | "});\n"; |
| 106 | - if ($immediatly) |
|
| 107 | - $this->jquery_code_for_compile[]=$retour; |
|
| 110 | + if ($immediatly) { |
|
| 111 | + $this->jquery_code_for_compile[]=$retour; |
|
| 112 | + } |
|
| 108 | 113 | return $retour; |
| 109 | 114 | } |
| 110 | 115 | |
@@ -143,7 +148,7 @@ discard block |
||
| 143 | 148 | if($context===null){ |
| 144 | 149 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 145 | 150 | $newElm = "$('#'+newId)"; |
| 146 | - }else{ |
|
| 151 | + } else{ |
|
| 147 | 152 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 148 | 153 | $newElm = $context.".find('#'+newId)"; |
| 149 | 154 | } |
@@ -153,8 +158,9 @@ discard block |
||
| 153 | 158 | $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"; |
| 154 | 159 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 155 | 160 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 156 | - if ($immediatly) |
|
| 157 | - $this->jquery_code_for_compile[]=$retour; |
|
| 161 | + if ($immediatly) { |
|
| 162 | + $this->jquery_code_for_compile[]=$retour; |
|
| 163 | + } |
|
| 158 | 164 | return $retour; |
| 159 | 165 | } |
| 160 | 166 | /** |
@@ -195,8 +201,9 @@ discard block |
||
| 195 | 201 | }});\n"; |
| 196 | 202 | $retour.="$('#".$form."').submit();\n"; |
| 197 | 203 | } |
| 198 | - if ($immediatly) |
|
| 199 | - $this->jquery_code_for_compile[]=$retour; |
|
| 204 | + if ($immediatly) { |
|
| 205 | + $this->jquery_code_for_compile[]=$retour; |
|
| 206 | + } |
|
| 200 | 207 | return $retour; |
| 201 | 208 | } |
| 202 | 209 | |