@@ -17,15 +17,17 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function setBasic($very=false) { |
| 19 | 19 | $table=$this->getTable(); |
| 20 | - if ($very) |
|
| 21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 20 | + if ($very) { |
|
| 21 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 22 | + } |
|
| 22 | 23 | return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | public function setCompact($very=false) { |
| 26 | 27 | $table=$this->getTable(); |
| 27 | - if ($very) |
|
| 28 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 28 | + if ($very) { |
|
| 29 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 30 | + } |
|
| 29 | 31 | return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
| 30 | 32 | } |
| 31 | 33 | |
@@ -136,10 +136,12 @@ discard block |
||
| 136 | 136 | if (isset($param)) { |
| 137 | 137 | $param=Javascript::prep_value($param); |
| 138 | 138 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 139 | - } else |
|
| 140 | - $str="$({$element}).{$jQueryCall}();"; |
|
| 141 | - if ($immediatly) |
|
| 142 | - $this->jquery_code_for_compile[]=$str; |
|
| 139 | + } else { |
|
| 140 | + $str="$({$element}).{$jQueryCall}();"; |
|
| 141 | + } |
|
| 142 | + if ($immediatly) { |
|
| 143 | + $this->jquery_code_for_compile[]=$str; |
|
| 144 | + } |
|
| 143 | 145 | return $str; |
| 144 | 146 | } |
| 145 | 147 | /** |
@@ -154,8 +156,9 @@ discard block |
||
| 154 | 156 | $to=Javascript::prep_element($to); |
| 155 | 157 | $element=Javascript::prep_element($element); |
| 156 | 158 | $str="$({$to}).{$jQueryCall}({$element});"; |
| 157 | - if ($immediatly) |
|
| 158 | - $this->jquery_code_for_compile[]=$str; |
|
| 159 | + if ($immediatly) { |
|
| 160 | + $this->jquery_code_for_compile[]=$str; |
|
| 161 | + } |
|
| 159 | 162 | return $str; |
| 160 | 163 | } |
| 161 | 164 | |
@@ -211,12 +214,14 @@ discard block |
||
| 211 | 214 | if ($stopPropagation===true) { |
| 212 | 215 | $js=Javascript::$stopPropagation.$js; |
| 213 | 216 | } |
| 214 | - if (array_search($event, $this->jquery_events)===false) |
|
| 215 | - $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 216 | - else |
|
| 217 | - $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 218 | - if($immediatly) |
|
| 219 | - $this->jquery_code_for_compile[]=$event; |
|
| 217 | + if (array_search($event, $this->jquery_events)===false) { |
|
| 218 | + $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 219 | + } else { |
|
| 220 | + $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 221 | + } |
|
| 222 | + if($immediatly) { |
|
| 223 | + $this->jquery_code_for_compile[]=$event; |
|
| 224 | + } |
|
| 220 | 225 | return $event; |
| 221 | 226 | } |
| 222 | 227 | |
@@ -301,7 +306,9 @@ discard block |
||
| 301 | 306 | } |
| 302 | 307 | |
| 303 | 308 | private function minify($input) { |
| 304 | - if(trim($input) === "") return $input; |
|
| 309 | + if(trim($input) === "") { |
|
| 310 | + return $input; |
|
| 311 | + } |
|
| 305 | 312 | return preg_replace( |
| 306 | 313 | array( |
| 307 | 314 | // Remove comment(s) |
@@ -33,8 +33,9 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function getProperty($name) { |
| 36 | - if (array_key_exists($name, $this->properties)) |
|
| 37 | - return $this->properties[$name]; |
|
| 36 | + if (array_key_exists($name, $this->properties)) { |
|
| 37 | + return $this->properties[$name]; |
|
| 38 | + } |
|
| 38 | 39 | } |
| 39 | 40 | |
| 40 | 41 | public function addToProperty($name, $value, $separator=" ") { |
@@ -44,10 +45,11 @@ discard block |
||
| 44 | 45 | } |
| 45 | 46 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
| 46 | 47 | $v=@$this->properties[$name]; |
| 47 | - if (isset($v) && $v !== "") |
|
| 48 | - $v=$v . $separator . $value; |
|
| 49 | - else |
|
| 50 | - $v=$value; |
|
| 48 | + if (isset($v) && $v !== "") { |
|
| 49 | + $v=$v . $separator . $value; |
|
| 50 | + } else { |
|
| 51 | + $v=$value; |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | return $this->setProperty($name, $v); |
| 53 | 55 | } |
@@ -70,8 +72,9 @@ discard block |
||
| 70 | 72 | } |
| 71 | 73 | |
| 72 | 74 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 73 | - if (@class_exists($typeCtrl, true)) |
|
| 74 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 75 | + if (@class_exists($typeCtrl, true)) { |
|
| 76 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 77 | + } |
|
| 75 | 78 | if (\is_array($typeCtrl)) { |
| 76 | 79 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
| 77 | 80 | } |
@@ -90,8 +93,9 @@ discard block |
||
| 90 | 93 | } |
| 91 | 94 | |
| 92 | 95 | public function removeProperty($name) { |
| 93 | - if (\array_key_exists($name, $this->properties)) |
|
| 94 | - unset($this->properties[$name]); |
|
| 96 | + if (\array_key_exists($name, $this->properties)) { |
|
| 97 | + unset($this->properties[$name]); |
|
| 98 | + } |
|
| 95 | 99 | return $this; |
| 96 | 100 | } |
| 97 | 101 | |
@@ -104,8 +108,9 @@ discard block |
||
| 104 | 108 | } |
| 105 | 109 | |
| 106 | 110 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 107 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 108 | - return $this->setProperty($name, $value); |
|
| 111 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 112 | + return $this->setProperty($name, $value); |
|
| 113 | + } |
|
| 109 | 114 | return $this; |
| 110 | 115 | } |
| 111 | 116 | |
@@ -99,15 +99,18 @@ discard block |
||
| 99 | 99 | $flag=false; |
| 100 | 100 | $index=0; |
| 101 | 101 | while ( !$flag && $index < sizeof($elements) ) { |
| 102 | - if ($elements[$index] instanceof BaseHtml) |
|
| 103 | - $flag=($callback($elements[$index])); |
|
| 102 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 103 | + $flag=($callback($elements[$index])); |
|
| 104 | + } |
|
| 104 | 105 | $index++; |
| 105 | 106 | } |
| 106 | - if ($flag === true) |
|
| 107 | - return $elements[$index - 1]; |
|
| 107 | + if ($flag === true) { |
|
| 108 | + return $elements[$index - 1]; |
|
| 109 | + } |
|
| 108 | 110 | } elseif ($elements instanceof BaseHtml) { |
| 109 | - if ($callback($elements)) |
|
| 110 | - return $elements; |
|
| 111 | + if ($callback($elements)) { |
|
| 112 | + return $elements; |
|
| 113 | + } |
|
| 111 | 114 | } |
| 112 | 115 | return null; |
| 113 | 116 | } |
@@ -140,8 +143,9 @@ discard block |
||
| 140 | 143 | |
| 141 | 144 | public function fromArray($array) { |
| 142 | 145 | foreach ( $this as $key => $value ) { |
| 143 | - if(array_key_exists($key, $array)===true) |
|
| 144 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 146 | + if(array_key_exists($key, $array)===true) { |
|
| 147 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 148 | + } |
|
| 145 | 149 | } |
| 146 | 150 | foreach ( $array as $key => $value ) { |
| 147 | 151 | if($this->_callSetter($key, $key, $value, $array)===false){ |
@@ -21,8 +21,9 @@ discard block |
||
| 21 | 21 | $this->widgetIdentifier=$identifier; |
| 22 | 22 | $this->values=[]; |
| 23 | 23 | $this->afterCompile=[]; |
| 24 | - if(isset($instance)) |
|
| 25 | - $this->setInstance($instance); |
|
| 24 | + if(isset($instance)) { |
|
| 25 | + $this->setInstance($instance); |
|
| 26 | + } |
|
| 26 | 27 | $this->setCaptions($captions); |
| 27 | 28 | $this->captionCallback=NULL; |
| 28 | 29 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -39,11 +40,13 @@ discard block |
||
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | public function getIdentifier($index=NULL){ |
| 42 | - if(!isset($index)) |
|
| 43 | - $index=self::$index; |
|
| 43 | + if(!isset($index)) { |
|
| 44 | + $index=self::$index; |
|
| 45 | + } |
|
| 44 | 46 | $value=$index; |
| 45 | - if(isset($this->values["identifier"])) |
|
| 46 | - $value=$this->values["identifier"]($index,$this->instance); |
|
| 47 | + if(isset($this->values["identifier"])) { |
|
| 48 | + $value=$this->values["identifier"]($index,$this->instance); |
|
| 49 | + } |
|
| 47 | 50 | return $value; |
| 48 | 51 | } |
| 49 | 52 | |
@@ -66,7 +69,7 @@ discard block |
||
| 66 | 69 | $value=$property->getValue($this->instance); |
| 67 | 70 | if(isset($this->values[$index])){ |
| 68 | 71 | $value= $this->values[$index]($value,$this->instance,$index); |
| 69 | - }else{ |
|
| 72 | + } else{ |
|
| 70 | 73 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
| 71 | 74 | } |
| 72 | 75 | return $value; |
@@ -76,16 +79,16 @@ discard block |
||
| 76 | 79 | $value=null; |
| 77 | 80 | if($property instanceof \ReflectionProperty){ |
| 78 | 81 | $value=$this->_getPropertyValue($property, $index); |
| 79 | - }else{ |
|
| 80 | - if(\is_callable($property)) |
|
| 81 | - $value=$property($this->instance); |
|
| 82 | - elseif(\is_array($property)){ |
|
| 82 | + } else{ |
|
| 83 | + if(\is_callable($property)) { |
|
| 84 | + $value=$property($this->instance); |
|
| 85 | + } elseif(\is_array($property)){ |
|
| 83 | 86 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
| 84 | 87 | $value=\implode("", $values); |
| 85 | - }else{ |
|
| 88 | + } else{ |
|
| 86 | 89 | if(isset($this->values[$index])){ |
| 87 | 90 | $value= $this->values[$index]($property,$this->instance,$index); |
| 88 | - }elseif(isset($this->instance->{$property})){ |
|
| 91 | + } elseif(isset($this->instance->{$property})){ |
|
| 89 | 92 | $value=$this->instance->{$property}; |
| 90 | 93 | } |
| 91 | 94 | } |
@@ -108,10 +111,10 @@ discard block |
||
| 108 | 111 | if(isset($vb[$index])){ |
| 109 | 112 | if(\is_array($vb[$index])){ |
| 110 | 113 | $this->visibleProperties[$index][]=$field; |
| 111 | - }else{ |
|
| 114 | + } else{ |
|
| 112 | 115 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
| 113 | 116 | } |
| 114 | - }else{ |
|
| 117 | + } else{ |
|
| 115 | 118 | return $this->insertField($index, $field); |
| 116 | 119 | } |
| 117 | 120 | return $this; |
@@ -138,9 +141,9 @@ discard block |
||
| 138 | 141 | $property=$this->getProperty($index); |
| 139 | 142 | if($property instanceof \ReflectionProperty){ |
| 140 | 143 | $result=$property->getName(); |
| 141 | - }elseif(\is_callable($property)){ |
|
| 144 | + } elseif(\is_callable($property)){ |
|
| 142 | 145 | $result=$this->visibleProperties[$index]; |
| 143 | - }else{ |
|
| 146 | + } else{ |
|
| 144 | 147 | $result=$property; |
| 145 | 148 | } |
| 146 | 149 | return $result; |
@@ -160,7 +163,7 @@ discard block |
||
| 160 | 163 | $this->reflect=new \ReflectionClass($instance); |
| 161 | 164 | if(\sizeof($this->visibleProperties)===0){ |
| 162 | 165 | $this->properties=$this->getDefaultProperties(); |
| 163 | - }else{ |
|
| 166 | + } else{ |
|
| 164 | 167 | foreach ($this->visibleProperties as $property){ |
| 165 | 168 | $this->setInstanceProperty($property); |
| 166 | 169 | } |
@@ -171,22 +174,23 @@ discard block |
||
| 171 | 174 | private function setInstanceProperty($property){ |
| 172 | 175 | if(\is_callable($property)){ |
| 173 | 176 | $this->properties[]=$property; |
| 174 | - }elseif(\is_string($property)){ |
|
| 177 | + } elseif(\is_string($property)){ |
|
| 175 | 178 | try{ |
| 176 | 179 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 177 | 180 | $rProperty=$this->reflect->getProperty($property); |
| 178 | 181 | $this->properties[]=$rProperty; |
| 179 | - }catch(\Exception $e){ |
|
| 182 | + } catch(\Exception $e){ |
|
| 180 | 183 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 181 | 184 | $this->properties[]=$property; |
| 182 | 185 | } |
| 183 | - }elseif(\is_int($property)){ |
|
| 186 | + } elseif(\is_int($property)){ |
|
| 184 | 187 | $props=$this->getDefaultProperties(); |
| 185 | - if(isset($props[$property])) |
|
| 186 | - $this->properties[]=$props[$property]; |
|
| 187 | - else |
|
| 188 | - $this->properties[]=$property; |
|
| 189 | - }else{ |
|
| 188 | + if(isset($props[$property])) { |
|
| 189 | + $this->properties[]=$props[$property]; |
|
| 190 | + } else { |
|
| 191 | + $this->properties[]=$property; |
|
| 192 | + } |
|
| 193 | + } else{ |
|
| 190 | 194 | $this->properties[]=$property; |
| 191 | 195 | } |
| 192 | 196 | } |
@@ -230,12 +234,13 @@ discard block |
||
| 230 | 234 | if(isset($this->captions[$index])){ |
| 231 | 235 | return $this->captions[$index]; |
| 232 | 236 | } |
| 233 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
| 234 | - return $this->properties[$index]->getName(); |
|
| 235 | - elseif(\is_callable($this->properties[$index])) |
|
| 236 | - return ""; |
|
| 237 | - else |
|
| 238 | - return $this->properties[$index]; |
|
| 237 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
| 238 | + return $this->properties[$index]->getName(); |
|
| 239 | + } elseif(\is_callable($this->properties[$index])) { |
|
| 240 | + return ""; |
|
| 241 | + } else { |
|
| 242 | + return $this->properties[$index]; |
|
| 243 | + } |
|
| 239 | 244 | } |
| 240 | 245 | |
| 241 | 246 | public function getCaptions(){ |
@@ -244,7 +249,7 @@ discard block |
||
| 244 | 249 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
| 245 | 250 | $captions[]=""; |
| 246 | 251 | } |
| 247 | - }else{ |
|
| 252 | + } else{ |
|
| 248 | 253 | $captions=[]; |
| 249 | 254 | $index=0; |
| 250 | 255 | $count=$this->count(); |
@@ -260,8 +265,9 @@ discard block |
||
| 260 | 265 | } |
| 261 | 266 | |
| 262 | 267 | public function setCaption($index,$caption){ |
| 263 | - if(isset($this->captions)===false) |
|
| 264 | - $this->captions=[]; |
|
| 268 | + if(isset($this->captions)===false) { |
|
| 269 | + $this->captions=[]; |
|
| 270 | + } |
|
| 265 | 271 | $this->captions[$index]=$caption; |
| 266 | 272 | return $this; |
| 267 | 273 | } |
@@ -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 | |