@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function setVariations($variations) { |
| 47 | 47 | $this->setProperty("class", $this->_baseClass); |
| 48 | - if (\is_string($variations)) |
|
| 49 | - $variations=\explode(" ", $variations); |
|
| 48 | + if (\is_string($variations)) { |
|
| 49 | + $variations=\explode(" ", $variations); |
|
| 50 | + } |
|
| 50 | 51 | foreach ( $variations as $variation ) { |
| 51 | 52 | $this->addVariation($variation); |
| 52 | 53 | } |
@@ -59,8 +60,9 @@ discard block |
||
| 59 | 60 | } |
| 60 | 61 | |
| 61 | 62 | public function addVariations($variations=array()) { |
| 62 | - if (\is_string($variations)) |
|
| 63 | - $variations=\explode(" ", $variations); |
|
| 63 | + if (\is_string($variations)) { |
|
| 64 | + $variations=\explode(" ", $variations); |
|
| 65 | + } |
|
| 64 | 66 | foreach ( $variations as $variation ) { |
| 65 | 67 | $this->addVariation($variation); |
| 66 | 68 | } |
@@ -68,8 +70,9 @@ discard block |
||
| 68 | 70 | } |
| 69 | 71 | |
| 70 | 72 | public function addStates($states=array()) { |
| 71 | - if (\is_string($states)) |
|
| 72 | - $states=\explode(" ", $states); |
|
| 73 | + if (\is_string($states)) { |
|
| 74 | + $states=\explode(" ", $states); |
|
| 75 | + } |
|
| 73 | 76 | foreach ( $states as $state ) { |
| 74 | 77 | $this->addState($state); |
| 75 | 78 | } |
@@ -78,8 +81,9 @@ discard block |
||
| 78 | 81 | |
| 79 | 82 | public function setStates($states) { |
| 80 | 83 | $this->setProperty("class", $this->_baseClass); |
| 81 | - if (\is_string($states)) |
|
| 82 | - $states=\explode(" ", $states); |
|
| 84 | + if (\is_string($states)) { |
|
| 85 | + $states=\explode(" ", $states); |
|
| 86 | + } |
|
| 83 | 87 | foreach ( $states as $state ) { |
| 84 | 88 | $this->addState($state); |
| 85 | 89 | } |
@@ -111,8 +115,9 @@ discard block |
||
| 111 | 115 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
| 112 | 116 | */ |
| 113 | 117 | public function setDisabled($disable=true) { |
| 114 | - if($disable) |
|
| 115 | - $this->addToProperty("class", "disabled"); |
|
| 118 | + if($disable) { |
|
| 119 | + $this->addToProperty("class", "disabled"); |
|
| 120 | + } |
|
| 116 | 121 | return $this; |
| 117 | 122 | } |
| 118 | 123 | |
@@ -146,14 +151,16 @@ discard block |
||
| 146 | 151 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 147 | 152 | */ |
| 148 | 153 | public function setActive($value=true){ |
| 149 | - if($value) |
|
| 150 | - $this->addToProperty("class", "active"); |
|
| 154 | + if($value) { |
|
| 155 | + $this->addToProperty("class", "active"); |
|
| 156 | + } |
|
| 151 | 157 | return $this; |
| 152 | 158 | } |
| 153 | 159 | |
| 154 | 160 | public function setAttached($value=true){ |
| 155 | - if($value) |
|
| 156 | - $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 161 | + if($value) { |
|
| 162 | + $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 163 | + } |
|
| 157 | 164 | return $this; |
| 158 | 165 | } |
| 159 | 166 | |
@@ -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]; |
| 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; |
@@ -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 | |
@@ -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 | |
@@ -67,22 +70,21 @@ discard block |
||
| 67 | 70 | $value=$property->getValue($this->instance); |
| 68 | 71 | if(isset($this->values[$index])){ |
| 69 | 72 | $value= $this->values[$index]($value,$this->instance,$index); |
| 70 | - }else{ |
|
| 73 | + } else{ |
|
| 71 | 74 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
| 72 | 75 | } |
| 73 | - }else{ |
|
| 74 | - if(\is_callable($property)) |
|
| 75 | - $value=$property($this->instance); |
|
| 76 | - elseif(\is_array($property)){ |
|
| 76 | + } else{ |
|
| 77 | + if(\is_callable($property)) { |
|
| 78 | + $value=$property($this->instance); |
|
| 79 | + } elseif(\is_array($property)){ |
|
| 77 | 80 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
| 78 | 81 | $value=\implode("", $values); |
| 79 | - }else{ |
|
| 82 | + } else{ |
|
| 80 | 83 | if(isset($this->values[$index])){ |
| 81 | 84 | $value= $this->values[$index]($property,$this->instance,$index); |
| 82 | - }elseif(isset($this->instance->{$property})){ |
|
| 85 | + } elseif(isset($this->instance->{$property})){ |
|
| 83 | 86 | $value=$this->instance->{$property}; |
| 84 | - } |
|
| 85 | - else{ |
|
| 87 | + } else{ |
|
| 86 | 88 | $value=null; |
| 87 | 89 | } |
| 88 | 90 | } |
@@ -105,10 +107,10 @@ discard block |
||
| 105 | 107 | if(isset($vb[$index])){ |
| 106 | 108 | if(\is_array($vb[$index])){ |
| 107 | 109 | $this->visibleProperties[$index][]=$field; |
| 108 | - }else{ |
|
| 110 | + } else{ |
|
| 109 | 111 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
| 110 | 112 | } |
| 111 | - }else{ |
|
| 113 | + } else{ |
|
| 112 | 114 | return $this->insertField($index, $field); |
| 113 | 115 | } |
| 114 | 116 | return $this; |
@@ -135,9 +137,9 @@ discard block |
||
| 135 | 137 | $property=$this->getProperty($index); |
| 136 | 138 | if($property instanceof \ReflectionProperty){ |
| 137 | 139 | $result=$property->getName(); |
| 138 | - }elseif(\is_callable($property)){ |
|
| 140 | + } elseif(\is_callable($property)){ |
|
| 139 | 141 | $result=$this->visibleProperties[$index]; |
| 140 | - }else{ |
|
| 142 | + } else{ |
|
| 141 | 143 | $result=$property; |
| 142 | 144 | } |
| 143 | 145 | return $result; |
@@ -157,7 +159,7 @@ discard block |
||
| 157 | 159 | $this->reflect=new \ReflectionClass($instance); |
| 158 | 160 | if(\sizeof($this->visibleProperties)===0){ |
| 159 | 161 | $this->properties=$this->getDefaultProperties(); |
| 160 | - }else{ |
|
| 162 | + } else{ |
|
| 161 | 163 | foreach ($this->visibleProperties as $property){ |
| 162 | 164 | $this->setInstanceProperty($property); |
| 163 | 165 | } |
@@ -168,22 +170,23 @@ discard block |
||
| 168 | 170 | private function setInstanceProperty($property){ |
| 169 | 171 | if(\is_callable($property)){ |
| 170 | 172 | $this->properties[]=$property; |
| 171 | - }elseif(\is_string($property)){ |
|
| 173 | + } elseif(\is_string($property)){ |
|
| 172 | 174 | try{ |
| 173 | 175 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 174 | 176 | $rProperty=$this->reflect->getProperty($property); |
| 175 | 177 | $this->properties[]=$rProperty; |
| 176 | - }catch(\Exception $e){ |
|
| 178 | + } catch(\Exception $e){ |
|
| 177 | 179 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 178 | 180 | $this->properties[]=$property; |
| 179 | 181 | } |
| 180 | - }elseif(\is_int($property)){ |
|
| 182 | + } elseif(\is_int($property)){ |
|
| 181 | 183 | $props=$this->getDefaultProperties(); |
| 182 | - if(isset($props[$property])) |
|
| 183 | - $this->properties[]=$props[$property]; |
|
| 184 | - else |
|
| 185 | - $this->properties[]=$property; |
|
| 186 | - }else{ |
|
| 184 | + if(isset($props[$property])) { |
|
| 185 | + $this->properties[]=$props[$property]; |
|
| 186 | + } else { |
|
| 187 | + $this->properties[]=$property; |
|
| 188 | + } |
|
| 189 | + } else{ |
|
| 187 | 190 | $this->properties[]=$property; |
| 188 | 191 | } |
| 189 | 192 | } |
@@ -227,12 +230,13 @@ discard block |
||
| 227 | 230 | if(isset($this->captions[$index])){ |
| 228 | 231 | return $this->captions[$index]; |
| 229 | 232 | } |
| 230 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
| 231 | - return $this->properties[$index]->getName(); |
|
| 232 | - elseif(\is_callable($this->properties[$index])) |
|
| 233 | - return ""; |
|
| 234 | - else |
|
| 235 | - return $this->properties[$index]; |
|
| 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]; |
|
| 239 | + } |
|
| 236 | 240 | } |
| 237 | 241 | |
| 238 | 242 | public function getCaptions(){ |
@@ -241,7 +245,7 @@ discard block |
||
| 241 | 245 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
| 242 | 246 | $captions[]=""; |
| 243 | 247 | } |
| 244 | - }else{ |
|
| 248 | + } else{ |
|
| 245 | 249 | $captions=[]; |
| 246 | 250 | $index=0; |
| 247 | 251 | $count=$this->count(); |
@@ -257,8 +261,9 @@ discard block |
||
| 257 | 261 | } |
| 258 | 262 | |
| 259 | 263 | public function setCaption($index,$caption){ |
| 260 | - if(isset($this->captions)===false) |
|
| 261 | - $this->captions=[]; |
|
| 264 | + if(isset($this->captions)===false) { |
|
| 265 | + $this->captions=[]; |
|
| 266 | + } |
|
| 262 | 267 | $this->captions[$index]=$caption; |
| 263 | 268 | return $this; |
| 264 | 269 | } |
@@ -72,8 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $table->setRowCount(0, \sizeof($captions)); |
| 74 | 74 | $table->setHeaderValues($captions); |
| 75 | - if(isset($this->_compileParts)) |
|
| 76 | - $table->setCompileParts($this->_compileParts); |
|
| 75 | + if(isset($this->_compileParts)) { |
|
| 76 | + $table->setCompileParts($this->_compileParts); |
|
| 77 | + } |
|
| 77 | 78 | if(isset($this->_searchField) && isset($js)){ |
| 78 | 79 | $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
| 79 | 80 | } |
@@ -178,7 +179,7 @@ discard block |
||
| 178 | 179 | $hasPart=$table->hasPart($part); |
| 179 | 180 | if($hasPart){ |
| 180 | 181 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 181 | - }else{ |
|
| 182 | + } else{ |
|
| 182 | 183 | $row=$table->getPart($part)->getRow(0); |
| 183 | 184 | } |
| 184 | 185 | $row->mergeCol(); |
@@ -257,8 +258,9 @@ discard block |
||
| 257 | 258 | */ |
| 258 | 259 | private function getFieldButton($caption,$visibleHover=true){ |
| 259 | 260 | $bt= new HtmlButton("",$caption); |
| 260 | - if($visibleHover) |
|
| 261 | - $this->_visibleOver($bt); |
|
| 261 | + if($visibleHover) { |
|
| 262 | + $this->_visibleOver($bt); |
|
| 263 | + } |
|
| 262 | 264 | return $bt; |
| 263 | 265 | } |
| 264 | 266 | |
@@ -311,8 +313,9 @@ discard block |
||
| 311 | 313 | private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
| 312 | 314 | $bt=$this->getFieldButton("",$visibleHover); |
| 313 | 315 | $bt->asIcon($icon); |
| 314 | - if(isset($class)) |
|
| 315 | - $bt->addToProperty("class", $class); |
|
| 316 | + if(isset($class)) { |
|
| 317 | + $bt->addToProperty("class", $class); |
|
| 318 | + } |
|
| 316 | 319 | return $bt; |
| 317 | 320 | } |
| 318 | 321 | |
@@ -370,8 +373,9 @@ discard block |
||
| 370 | 373 | return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
| 371 | 374 | $button=new HtmlButton($id,$value,$cssStyle); |
| 372 | 375 | $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
| 373 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 374 | - $this->_visibleOver($button); |
|
| 376 | + if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) { |
|
| 377 | + $this->_visibleOver($button); |
|
| 378 | + } |
|
| 375 | 379 | return $button; |
| 376 | 380 | }, $index,$attributes); |
| 377 | 381 | } |