@@ -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;}; |
@@ -40,8 +41,9 @@ discard block |
||
| 40 | 41 | |
| 41 | 42 | public function getIdentifier(){ |
| 42 | 43 | $value=self::$index; |
| 43 | - if(isset($this->values["identifier"])) |
|
| 44 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
| 44 | + if(isset($this->values["identifier"])) { |
|
| 45 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
| 46 | + } |
|
| 45 | 47 | return $value; |
| 46 | 48 | } |
| 47 | 49 | |
@@ -65,19 +67,19 @@ discard block |
||
| 65 | 67 | $value=$property->getValue($this->instance); |
| 66 | 68 | if(isset($this->values[$index])){ |
| 67 | 69 | $value= $this->values[$index]($value,$this->instance,$index); |
| 68 | - }else{ |
|
| 70 | + } else{ |
|
| 69 | 71 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
| 70 | 72 | } |
| 71 | - }else{ |
|
| 72 | - if(\is_callable($property)) |
|
| 73 | - $value=$property($this->instance); |
|
| 74 | - elseif(\is_array($property)){ |
|
| 73 | + } else{ |
|
| 74 | + if(\is_callable($property)) { |
|
| 75 | + $value=$property($this->instance); |
|
| 76 | + } elseif(\is_array($property)){ |
|
| 75 | 77 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
| 76 | 78 | $value=\implode("", $values); |
| 77 | - }else{ |
|
| 79 | + } else{ |
|
| 78 | 80 | if(isset($this->values[$index])){ |
| 79 | 81 | $value= $this->values[$index]($property,$this->instance,$index); |
| 80 | - }else{ |
|
| 82 | + } else{ |
|
| 81 | 83 | $value=$property; |
| 82 | 84 | } |
| 83 | 85 | } |
@@ -100,10 +102,10 @@ discard block |
||
| 100 | 102 | if(isset($vb[$index])){ |
| 101 | 103 | if(\is_array($vb[$index])){ |
| 102 | 104 | $this->visibleProperties[$index][]=$field; |
| 103 | - }else{ |
|
| 105 | + } else{ |
|
| 104 | 106 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
| 105 | 107 | } |
| 106 | - }else{ |
|
| 108 | + } else{ |
|
| 107 | 109 | return $this->insertField($index, $field); |
| 108 | 110 | } |
| 109 | 111 | return $this; |
@@ -139,7 +141,7 @@ discard block |
||
| 139 | 141 | $this->reflect=new \ReflectionClass($instance); |
| 140 | 142 | if(\sizeof($this->visibleProperties)===0){ |
| 141 | 143 | $this->properties=$this->getDefaultProperties(); |
| 142 | - }else{ |
|
| 144 | + } else{ |
|
| 143 | 145 | foreach ($this->visibleProperties as $property){ |
| 144 | 146 | $this->setInstanceProperty($property); |
| 145 | 147 | } |
@@ -150,22 +152,23 @@ discard block |
||
| 150 | 152 | private function setInstanceProperty($property){ |
| 151 | 153 | if(\is_callable($property)){ |
| 152 | 154 | $this->properties[]=$property; |
| 153 | - }elseif(\is_string($property)){ |
|
| 155 | + } elseif(\is_string($property)){ |
|
| 154 | 156 | try{ |
| 155 | 157 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 156 | 158 | $rProperty=$this->reflect->getProperty($property); |
| 157 | 159 | $this->properties[]=$rProperty; |
| 158 | - }catch(\Exception $e){ |
|
| 160 | + } catch(\Exception $e){ |
|
| 159 | 161 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
| 160 | 162 | $this->properties[]=$property; |
| 161 | 163 | } |
| 162 | - }elseif(\is_int($property)){ |
|
| 164 | + } elseif(\is_int($property)){ |
|
| 163 | 165 | $props=$this->getDefaultProperties(); |
| 164 | - if(isset($props[$property])) |
|
| 165 | - $this->properties[]=$props[$property]; |
|
| 166 | - else |
|
| 167 | - $this->properties[]=$property; |
|
| 168 | - }else{ |
|
| 166 | + if(isset($props[$property])) { |
|
| 167 | + $this->properties[]=$props[$property]; |
|
| 168 | + } else { |
|
| 169 | + $this->properties[]=$property; |
|
| 170 | + } |
|
| 171 | + } else{ |
|
| 169 | 172 | $this->properties[]=$property; |
| 170 | 173 | } |
| 171 | 174 | } |
@@ -209,12 +212,13 @@ discard block |
||
| 209 | 212 | if(isset($this->captions[$index])){ |
| 210 | 213 | return $this->captions[$index]; |
| 211 | 214 | } |
| 212 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
| 213 | - return $this->properties[$index]->getName(); |
|
| 214 | - elseif(\is_callable($this->properties[$index])) |
|
| 215 | - return ""; |
|
| 216 | - else |
|
| 217 | - return $this->properties[$index]; |
|
| 215 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
| 216 | + return $this->properties[$index]->getName(); |
|
| 217 | + } elseif(\is_callable($this->properties[$index])) { |
|
| 218 | + return ""; |
|
| 219 | + } else { |
|
| 220 | + return $this->properties[$index]; |
|
| 221 | + } |
|
| 218 | 222 | } |
| 219 | 223 | |
| 220 | 224 | public function getCaptions(){ |
@@ -223,7 +227,7 @@ discard block |
||
| 223 | 227 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
| 224 | 228 | $captions[]=""; |
| 225 | 229 | } |
| 226 | - }else{ |
|
| 230 | + } else{ |
|
| 227 | 231 | $captions=[]; |
| 228 | 232 | $index=0; |
| 229 | 233 | $count=$this->count(); |
@@ -239,8 +243,9 @@ discard block |
||
| 239 | 243 | } |
| 240 | 244 | |
| 241 | 245 | public function setCaption($index,$caption){ |
| 242 | - if(isset($this->captions)===false) |
|
| 243 | - $this->captions=[]; |
|
| 246 | + if(isset($this->captions)===false) { |
|
| 247 | + $this->captions=[]; |
|
| 248 | + } |
|
| 244 | 249 | $this->captions[$index]=$caption; |
| 245 | 250 | return $this; |
| 246 | 251 | } |
@@ -56,8 +56,9 @@ discard block |
||
| 56 | 56 | $name=$attributes["name"]; |
| 57 | 57 | } |
| 58 | 58 | $element=$elementCallback($this->_getFieldIdentifier($prefix),$name,$value,""); |
| 59 | - if(\is_array($attributes)) |
|
| 60 | - $this->_applyAttributes($element, $attributes,$index); |
|
| 59 | + if(\is_array($attributes)) { |
|
| 60 | + $this->_applyAttributes($element, $attributes,$index); |
|
| 61 | + } |
|
| 61 | 62 | $element->setDisabled(!$this->_edition); |
| 62 | 63 | return $element; |
| 63 | 64 | }); |
@@ -92,8 +93,9 @@ discard block |
||
| 92 | 93 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 93 | 94 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 94 | 95 | $header=new HtmlHeader($id,$niveau,$value); |
| 95 | - if(isset($icon)) |
|
| 96 | - $header->asIcon($icon, $value); |
|
| 96 | + if(isset($icon)) { |
|
| 97 | + $header->asIcon($icon, $value); |
|
| 98 | + } |
|
| 97 | 99 | return $header; |
| 98 | 100 | }, $index,$attributes,"header"); |
| 99 | 101 | } |
@@ -101,7 +103,9 @@ discard block |
||
| 101 | 103 | |
| 102 | 104 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 103 | 105 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 104 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 106 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 107 | + $image->setCircular(); |
|
| 108 | + } |
|
| 105 | 109 | return $image; |
| 106 | 110 | }); |
| 107 | 111 | return $this; |
@@ -47,8 +47,9 @@ discard block |
||
| 47 | 47 | $actionO=$action; |
| 48 | 48 | if (\is_object($action) === false) { |
| 49 | 49 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
| 50 | - if (isset($icon)) |
|
| 51 | - $actionO->addIcon($icon, true, $labeled); |
|
| 50 | + if (isset($icon)) { |
|
| 51 | + $actionO->addIcon($icon, true, $labeled); |
|
| 52 | + } |
|
| 52 | 53 | } |
| 53 | 54 | $field->addToProperty("class", $direction . " action"); |
| 54 | 55 | $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | public function setDisabled($disable=true) { |
| 84 | 85 | $field=$this->getField(); |
| 85 | - if($disable) |
|
| 86 | - $field->addToProperty("class", "disabled"); |
|
| 86 | + if($disable) { |
|
| 87 | + $field->addToProperty("class", "disabled"); |
|
| 88 | + } |
|
| 87 | 89 | return $this; |
| 88 | 90 | } |
| 89 | 91 | } |
| 90 | 92 | \ No newline at end of file |
@@ -49,8 +49,9 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function getDataField(){ |
| 51 | 51 | $field= $this->getField(); |
| 52 | - if($field instanceof AbstractCheckbox) |
|
| 53 | - $field=$field->getField(); |
|
| 52 | + if($field instanceof AbstractCheckbox) { |
|
| 53 | + $field=$field->getField(); |
|
| 54 | + } |
|
| 54 | 55 | return $field; |
| 55 | 56 | } |
| 56 | 57 | |
@@ -62,7 +63,7 @@ discard block |
||
| 62 | 63 | public function setChecked($value=true){ |
| 63 | 64 | if($value===true){ |
| 64 | 65 | $this->getDataField()->setProperty("checked", "checked"); |
| 65 | - }else{ |
|
| 66 | + } else{ |
|
| 66 | 67 | $this->getDataField()->removeProperty("checked"); |
| 67 | 68 | } |
| 68 | 69 | return $this; |
@@ -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)) |
|
| 22 | - $this->setLabel($label); |
|
| 21 | + if(isset($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 | /** |
@@ -34,8 +34,9 @@ |
||
| 34 | 34 | * @see BaseHtml::run() |
| 35 | 35 | */ |
| 36 | 36 | public function run(JsUtils $js) { |
| 37 | - if(isset($this->_bsComponent)===false) |
|
| 38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 37 | + if(isset($this->_bsComponent)===false) { |
|
| 38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 39 | + } |
|
| 39 | 40 | $this->addEventsOnRun($js); |
| 40 | 41 | return $this->_bsComponent; |
| 41 | 42 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function setActive($value=true){ |
| 12 | 12 | if($value){ |
| 13 | 13 | $this->addToPropertyCtrl("class", "active", ["active"]); |
| 14 | - }else{ |
|
| 14 | + } else{ |
|
| 15 | 15 | $this->removePropertyValue("class", "active"); |
| 16 | 16 | } |
| 17 | 17 | return $this; |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | public function __construct($identifier, $width=NULL) { |
| 21 | 21 | parent::__construct($identifier, "div"); |
| 22 | 22 | $this->setClass("column"); |
| 23 | - if (isset($width)) |
|
| 24 | - $this->setWidth($width); |
|
| 23 | + if (isset($width)) { |
|
| 24 | + $this->setWidth($width); |
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | /** |
@@ -48,10 +49,11 @@ discard block |
||
| 48 | 49 | |
| 49 | 50 | public function addDivider($vertical=true, $content=NULL) { |
| 50 | 51 | $divider=new HtmlDivider("", $content); |
| 51 | - if ($vertical) |
|
| 52 | - $divider->setVertical(); |
|
| 53 | - else |
|
| 54 | - $divider->setHorizontal(); |
|
| 52 | + if ($vertical) { |
|
| 53 | + $divider->setVertical(); |
|
| 54 | + } else { |
|
| 55 | + $divider->setHorizontal(); |
|
| 56 | + } |
|
| 55 | 57 | $this->wrap($divider,""); |
| 56 | 58 | return $divider; |
| 57 | 59 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | 20 | $desc=@$content[2]; |
| 21 | - }else{ |
|
| 21 | + } else{ |
|
| 22 | 22 | $icon=@$content["icon"]; |
| 23 | 23 | $title=@$content["title"]; |
| 24 | 24 | $desc=@$content["description"]; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if(isset($title)){ |
| 30 | 30 | $this->setTitle($title,$desc); |
| 31 | 31 | } |
| 32 | - }else{ |
|
| 32 | + } else{ |
|
| 33 | 33 | $this->setContent($content); |
| 34 | 34 | } |
| 35 | 35 | } |