@@ -60,18 +60,21 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $table->setRowCount(0, \sizeof($captions)); |
| 62 | 62 | $table->setHeaderValues($captions); |
| 63 | - if(isset($this->_compileParts)) |
|
| 64 | - $table->setCompileParts($this->_compileParts); |
|
| 63 | + if(isset($this->_compileParts)) { |
|
| 64 | + $table->setCompileParts($this->_compileParts); |
|
| 65 | + } |
|
| 65 | 66 | if(isset($this->_searchField)){ |
| 66 | - if(isset($js)) |
|
| 67 | - $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 67 | + if(isset($js)) { |
|
| 68 | + $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 69 | + } |
|
| 68 | 70 | } |
| 69 | 71 | |
| 70 | 72 | $this->_generateContent($table); |
| 71 | 73 | |
| 72 | 74 | if($this->_hasCheckboxes){ |
| 73 | - if($table->hasPart("thead")) |
|
| 74 | - $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
| 75 | + if($table->hasPart("thead")) { |
|
| 76 | + $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
| 77 | + } |
|
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
@@ -305,8 +308,9 @@ discard block |
||
| 305 | 308 | private function getDefaultButton($icon,$class=null){ |
| 306 | 309 | $bt=$this->getFieldButton(""); |
| 307 | 310 | $bt->asIcon($icon); |
| 308 | - if(isset($class)) |
|
| 309 | - $bt->addToProperty("class", $class); |
|
| 311 | + if(isset($class)) { |
|
| 312 | + $bt->addToProperty("class", $class); |
|
| 313 | + } |
|
| 310 | 314 | return $bt; |
| 311 | 315 | } |
| 312 | 316 | |
@@ -395,7 +399,9 @@ discard block |
||
| 395 | 399 | |
| 396 | 400 | public function fieldAsImage($index,$size=Size::SMALL,$circular=false){ |
| 397 | 401 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 398 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 402 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 403 | + $image->setCircular(); |
|
| 404 | + } |
|
| 399 | 405 | return $image; |
| 400 | 406 | } |
| 401 | 407 | ); |
@@ -15,16 +15,18 @@ discard block |
||
| 15 | 15 | public function __construct($instance=NULL,$captions=NULL){ |
| 16 | 16 | $this->values=[]; |
| 17 | 17 | $this->afterCompile=[]; |
| 18 | - if(isset($instance)) |
|
| 19 | - $this->setInstance($instance); |
|
| 18 | + if(isset($instance)) { |
|
| 19 | + $this->setInstance($instance); |
|
| 20 | + } |
|
| 20 | 21 | $this->setCaptions($captions); |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | public function getCaption($index){ |
| 24 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
| 25 | - return $this->properties[$index]->getName(); |
|
| 26 | - else |
|
| 27 | - return $this->properties[$index]; |
|
| 25 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
| 26 | + return $this->properties[$index]->getName(); |
|
| 27 | + } else { |
|
| 28 | + return $this->properties[$index]; |
|
| 29 | + } |
|
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | public function getCaptions(){ |
@@ -56,8 +58,9 @@ discard block |
||
| 56 | 58 | |
| 57 | 59 | public function getIdentifier(){ |
| 58 | 60 | $value=self::$index; |
| 59 | - if(isset($this->values["identifier"])) |
|
| 60 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
| 61 | + if(isset($this->values["identifier"])) { |
|
| 62 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
| 63 | + } |
|
| 61 | 64 | self::$index++; |
| 62 | 65 | return $value; |
| 63 | 66 | } |
@@ -74,14 +77,15 @@ discard block |
||
| 74 | 77 | if(isset($this->values[$index])){ |
| 75 | 78 | $value= $this->values[$index]($value); |
| 76 | 79 | } |
| 77 | - }else{ |
|
| 78 | - if(\is_callable($property)) |
|
| 79 | - $value=$property($this->instance); |
|
| 80 | - elseif(\is_array($property)){ |
|
| 80 | + } else{ |
|
| 81 | + if(\is_callable($property)) { |
|
| 82 | + $value=$property($this->instance); |
|
| 83 | + } elseif(\is_array($property)){ |
|
| 81 | 84 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
| 82 | 85 | $value=\implode("", $values); |
| 83 | - }else |
|
| 84 | - $value=$property; |
|
| 86 | + } else { |
|
| 87 | + $value=$property; |
|
| 88 | + } |
|
| 85 | 89 | } |
| 86 | 90 | if(isset($this->afterCompile[$index])){ |
| 87 | 91 | if(\is_callable($this->afterCompile[$index])){ |
@@ -101,10 +105,10 @@ discard block |
||
| 101 | 105 | if(isset($vb[$index])){ |
| 102 | 106 | if(\is_array($vb[$index])){ |
| 103 | 107 | $this->visibleProperties[$index][]=$field; |
| 104 | - }else{ |
|
| 108 | + } else{ |
|
| 105 | 109 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
| 106 | 110 | } |
| 107 | - }else{ |
|
| 111 | + } else{ |
|
| 108 | 112 | return $this->insertField($index, $field); |
| 109 | 113 | } |
| 110 | 114 | return $this; |
@@ -136,24 +140,25 @@ discard block |
||
| 136 | 140 | $this->reflect=new \ReflectionClass($instance); |
| 137 | 141 | if(\sizeof($this->visibleProperties)===0){ |
| 138 | 142 | $this->properties=$this->getDefaultProperties(); |
| 139 | - }else{ |
|
| 143 | + } else{ |
|
| 140 | 144 | foreach ($this->visibleProperties as $property){ |
| 141 | 145 | if(\is_callable($property)){ |
| 142 | 146 | $this->properties[]=$property; |
| 143 | - }elseif(\is_string($property)){ |
|
| 147 | + } elseif(\is_string($property)){ |
|
| 144 | 148 | try{ |
| 145 | 149 | $rProperty=$this->reflect->getProperty($property); |
| 146 | 150 | $this->properties[]=$rProperty; |
| 147 | - }catch(\Exception $e){ |
|
| 151 | + } catch(\Exception $e){ |
|
| 148 | 152 | $this->properties[]=$property; |
| 149 | 153 | } |
| 150 | - }elseif(\is_int($property)){ |
|
| 154 | + } elseif(\is_int($property)){ |
|
| 151 | 155 | $props=$this->getDefaultProperties(); |
| 152 | - if(isset($props[$property])) |
|
| 153 | - $this->properties[]=$props[$property]; |
|
| 154 | - else |
|
| 155 | - $this->properties[]=$property; |
|
| 156 | - }else{ |
|
| 156 | + if(isset($props[$property])) { |
|
| 157 | + $this->properties[]=$props[$property]; |
|
| 158 | + } else { |
|
| 159 | + $this->properties[]=$property; |
|
| 160 | + } |
|
| 161 | + } else{ |
|
| 157 | 162 | $this->properties[]=$property; |
| 158 | 163 | } |
| 159 | 164 | } |