@@ -9,8 +9,9 @@ |
||
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
12 | - if(!isset($placeholder) && $type==="text") |
|
13 | - $placeholder=$label; |
|
12 | + if(!isset($placeholder) && $type==="text") { |
|
13 | + $placeholder=$label; |
|
14 | + } |
|
14 | 15 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
15 | 16 | } |
16 | 17 |
@@ -10,8 +10,9 @@ |
||
10 | 10 | use TextFieldsTrait; |
11 | 11 | |
12 | 12 | public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
13 | - if(!isset($placeholder)) |
|
14 | - $placeholder=$label; |
|
13 | + if(!isset($placeholder)) { |
|
14 | + $placeholder=$label; |
|
15 | + } |
|
15 | 16 | parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
16 | 17 | } |
17 | 18 |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | parent::__construct($identifier, "div","field"); |
15 | 15 | $this->content=array(); |
16 | 16 | $this->_states=[State::ERROR,State::DISABLED]; |
17 | - if(isset($label)) |
|
18 | - $this->setLabel($label); |
|
17 | + if(isset($label)) { |
|
18 | + $this->setLabel($label); |
|
19 | + } |
|
19 | 20 | $this->setField($field); |
20 | 21 | } |
21 | 22 | |
@@ -45,8 +46,9 @@ discard block |
||
45 | 46 | * @return mixed |
46 | 47 | */ |
47 | 48 | public function getLabel(){ |
48 | - if(\array_key_exists("label", $this->content)) |
|
49 | - return $this->content["label"]; |
|
49 | + if(\array_key_exists("label", $this->content)) { |
|
50 | + return $this->content["label"]; |
|
51 | + } |
|
50 | 52 | } |
51 | 53 | |
52 | 54 | /** |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | private function afterInsert($item) { |
60 | - if (!$item instanceof HtmlMenu) |
|
61 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
62 | - else { |
|
60 | + if (!$item instanceof HtmlMenu) { |
|
61 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
62 | + } else { |
|
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
65 | 65 | return $item; |
@@ -158,8 +158,9 @@ discard block |
||
158 | 158 | $this->apply(function (HtmlDoubleElement &$item) { |
159 | 159 | $item->setTagName("a"); |
160 | 160 | }); |
161 | - if ($vertical === true) |
|
162 | - $this->setVertical(); |
|
161 | + if ($vertical === true) { |
|
162 | + $this->setVertical(); |
|
163 | + } |
|
163 | 164 | return $this->addToProperty("class", "tabular"); |
164 | 165 | } |
165 | 166 | |
@@ -188,10 +189,11 @@ discard block |
||
188 | 189 | */ |
189 | 190 | public function fromDatabaseObject($object, $function) { |
190 | 191 | $return=$function($object); |
191 | - if (\is_array($return)) |
|
192 | - $this->addItems($return); |
|
193 | - else |
|
194 | - $this->addItem($return); |
|
192 | + if (\is_array($return)) { |
|
193 | + $this->addItems($return); |
|
194 | + } else { |
|
195 | + $this->addItem($return); |
|
196 | + } |
|
195 | 197 | } |
196 | 198 | |
197 | 199 | /** |
@@ -181,9 +181,9 @@ |
||
181 | 181 | protected function createItem($value) { |
182 | 182 | $count=$this->count(); |
183 | 183 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
184 | - if (\is_array($value)) |
|
185 | - $itemO->fromArray($value); |
|
186 | - else { |
|
184 | + if (\is_array($value)) { |
|
185 | + $itemO->fromArray($value); |
|
186 | + } else { |
|
187 | 187 | $itemO->setContent($value); |
188 | 188 | } |
189 | 189 | return $itemO; |
@@ -55,10 +55,11 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public function setDismissable($dismiss=true){ |
58 | - if($dismiss===true) |
|
59 | - $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
60 | - else |
|
61 | - $this->close=NULL; |
|
58 | + if($dismiss===true) { |
|
59 | + $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
60 | + } else { |
|
61 | + $this->close=NULL; |
|
62 | + } |
|
62 | 63 | return $this; |
63 | 64 | } |
64 | 65 |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | public function addCol($width=NULL) { |
82 | 82 | $colCount=$this->colCount() + 1; |
83 | 83 | $this->setColsCount($colCount, true, $width); |
84 | - if ($this->hasOnlyCols($this->count())) |
|
85 | - return $this->content[$colCount - 1]; |
|
84 | + if ($this->hasOnlyCols($this->count())) { |
|
85 | + return $this->content[$colCount - 1]; |
|
86 | + } |
|
86 | 87 | return $this; |
87 | 88 | } |
88 | 89 | |
@@ -170,8 +171,9 @@ discard block |
||
170 | 171 | */ |
171 | 172 | public function rowCount() { |
172 | 173 | $count=$this->count(); |
173 | - if ($this->hasOnlyCols($count)) |
|
174 | - return 0; |
|
174 | + if ($this->hasOnlyCols($count)) { |
|
175 | + return 0; |
|
176 | + } |
|
175 | 177 | return $count; |
176 | 178 | } |
177 | 179 | |
@@ -181,10 +183,12 @@ discard block |
||
181 | 183 | */ |
182 | 184 | public function colCount() { |
183 | 185 | $count=$this->count(); |
184 | - if ($this->hasOnlyCols($count)) |
|
185 | - return $count; |
|
186 | - if ($count > 0) |
|
187 | - return $this->getItem(0)->count(); |
|
186 | + if ($this->hasOnlyCols($count)) { |
|
187 | + return $count; |
|
188 | + } |
|
189 | + if ($count > 0) { |
|
190 | + return $this->getItem(0)->count(); |
|
191 | + } |
|
188 | 192 | return 0; |
189 | 193 | } |
190 | 194 | |
@@ -195,8 +199,9 @@ discard block |
||
195 | 199 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
196 | 200 | */ |
197 | 201 | public function getCell($row, $col) { |
198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
199 | - return $this->getItem($col); |
|
202 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
203 | + return $this->getItem($col); |
|
204 | + } |
|
200 | 205 | $row=$this->getItem($row); |
201 | 206 | if (isset($row)) { |
202 | 207 | $col=$row->getItem($col); |
@@ -245,8 +250,9 @@ discard block |
||
245 | 250 | * @return \Ajax\semantic\html\collections\HtmlGrid |
246 | 251 | */ |
247 | 252 | public function setPadded($value=NULL) { |
248 | - if (isset($value)) |
|
249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
253 | + if (isset($value)) { |
|
254 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
255 | + } |
|
250 | 256 | return $this->addToProperty("class", "padded"); |
251 | 257 | } |
252 | 258 | |
@@ -271,8 +277,9 @@ discard block |
||
271 | 277 | * @see \Ajax\common\html\HtmlCollection::createItem() |
272 | 278 | */ |
273 | 279 | protected function createItem($value) { |
274 | - if ($this->_createCols === false) |
|
275 | - $value=null; |
|
280 | + if ($this->_createCols === false) { |
|
281 | + $value=null; |
|
282 | + } |
|
276 | 283 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
277 | 284 | return $item; |
278 | 285 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
20 | 20 | $this->addContent($iconO,false); |
21 | 21 | $this->_hasIcon=true; |
22 | - }else{ |
|
22 | + } else{ |
|
23 | 23 | $iconO=$this->getIcon(); |
24 | 24 | $iconO->setIcon($icon); |
25 | 25 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -30,8 +30,9 @@ discard block |
||
30 | 30 | public function getIcon(){ |
31 | 31 | if(\is_array($this->content)){ |
32 | 32 | foreach ($this->content as $item){ |
33 | - if($item instanceof HtmlIcon) |
|
34 | - return $item; |
|
33 | + if($item instanceof HtmlIcon) { |
|
34 | + return $item; |
|
35 | + } |
|
35 | 36 | } |
36 | 37 | } |
37 | 38 | } |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | public function setVariations($variations) { |
37 | 37 | $this->setProperty("class", $this->_baseClass); |
38 | - if (\is_string($variations)) |
|
39 | - $variations=\explode(" ", $variations); |
|
38 | + if (\is_string($variations)) { |
|
39 | + $variations=\explode(" ", $variations); |
|
40 | + } |
|
40 | 41 | foreach ( $variations as $variation ) { |
41 | 42 | $this->addVariation($variation); |
42 | 43 | } |
@@ -49,8 +50,9 @@ discard block |
||
49 | 50 | } |
50 | 51 | |
51 | 52 | public function addVariations($variations=array()) { |
52 | - if (\is_string($variations)) |
|
53 | - $variations=\explode(" ", $variations); |
|
53 | + if (\is_string($variations)) { |
|
54 | + $variations=\explode(" ", $variations); |
|
55 | + } |
|
54 | 56 | foreach ( $variations as $variation ) { |
55 | 57 | $this->addVariation($variation); |
56 | 58 | } |
@@ -58,8 +60,9 @@ discard block |
||
58 | 60 | } |
59 | 61 | |
60 | 62 | public function addStates($states=array()) { |
61 | - if (\is_string($states)) |
|
62 | - $states=\explode(" ", $states); |
|
63 | + if (\is_string($states)) { |
|
64 | + $states=\explode(" ", $states); |
|
65 | + } |
|
63 | 66 | foreach ( $states as $state ) { |
64 | 67 | $this->addState($state); |
65 | 68 | } |
@@ -68,8 +71,9 @@ discard block |
||
68 | 71 | |
69 | 72 | public function setStates($states) { |
70 | 73 | $this->setProperty("class", $this->_baseClass); |
71 | - if (\is_string($states)) |
|
72 | - $states=\explode(" ", $states); |
|
74 | + if (\is_string($states)) { |
|
75 | + $states=\explode(" ", $states); |
|
76 | + } |
|
73 | 77 | foreach ( $states as $state ) { |
74 | 78 | $this->addState($state); |
75 | 79 | } |