@@ -17,12 +17,15 @@ discard block |
||
17 | 17 | parent::__construct($identifier, "a"); |
18 | 18 | $this->setClass("item"); |
19 | 19 | $this->setContent($content); |
20 | - if($value!==NULL) |
|
21 | - $this->setData($value); |
|
22 | - if($image!==NULL) |
|
23 | - $this->asMiniAvatar($image); |
|
24 | - if($description!==NULL) |
|
25 | - $this->setDescription($description); |
|
20 | + if($value!==NULL) { |
|
21 | + $this->setData($value); |
|
22 | + } |
|
23 | + if($image!==NULL) { |
|
24 | + $this->asMiniAvatar($image); |
|
25 | + } |
|
26 | + if($description!==NULL) { |
|
27 | + $this->setDescription($description); |
|
28 | + } |
|
26 | 29 | } |
27 | 30 | |
28 | 31 | public function setDescription($description){ |
@@ -38,8 +41,9 @@ discard block |
||
38 | 41 | |
39 | 42 | public function asOption(){ |
40 | 43 | $this->tagName="option"; |
41 | - if($this->getProperty("data-value")!==null) |
|
42 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
44 | + if($this->getProperty("data-value")!==null) { |
|
45 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
46 | + } |
|
43 | 47 | } |
44 | 48 | |
45 | 49 | /** |
@@ -81,22 +85,25 @@ discard block |
||
81 | 85 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
82 | 86 | $this->setClass("ui icon search input"); |
83 | 87 | $input=new HtmlInput("search-".$this->identifier); |
84 | - if(isset($placeholder)) |
|
85 | - $input->setProperty("placeholder", $placeholder); |
|
88 | + if(isset($placeholder)) { |
|
89 | + $input->setProperty("placeholder", $placeholder); |
|
90 | + } |
|
86 | 91 | $this->content=$input; |
87 | - if(isset($icon)) |
|
88 | - $this->addIcon($icon); |
|
92 | + if(isset($icon)) { |
|
93 | + $this->addIcon($icon); |
|
94 | + } |
|
89 | 95 | return $this; |
90 | 96 | } |
91 | 97 | |
92 | 98 | public function setContent($content){ |
93 | 99 | if($content==="-"){ |
94 | 100 | $this->asDivider(); |
95 | - }elseif($content==="-search-"){ |
|
101 | + } elseif($content==="-search-"){ |
|
96 | 102 | $values=\explode(",",$content,-1); |
97 | 103 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
98 | - }else |
|
99 | - parent::setContent($content); |
|
104 | + } else { |
|
105 | + parent::setContent($content); |
|
106 | + } |
|
100 | 107 | return $this; |
101 | 108 | } |
102 | 109 | |
@@ -117,8 +124,9 @@ discard block |
||
117 | 124 | public function asHeader($caption=NULL,$icon=NULL){ |
118 | 125 | $this->setClass("header"); |
119 | 126 | $this->content=$caption; |
120 | - if(isset($icon)) |
|
121 | - $this->addIcon($icon,true); |
|
127 | + if(isset($icon)) { |
|
128 | + $this->addIcon($icon,true); |
|
129 | + } |
|
122 | 130 | return $this; |
123 | 131 | } |
124 | 132 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | if(!$item instanceof HtmlDropdownItem){ |
72 | 72 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
73 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
73 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
74 | 74 | $this->addToProperty("class", "vertical"); |
75 | 75 | } |
76 | 76 | return $itemO; |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | public function addInput($name){ |
87 | - if(!isset($name)) |
|
88 | - $name="input-".$this->identifier; |
|
87 | + if(!isset($name)) { |
|
88 | + $name="input-".$this->identifier; |
|
89 | + } |
|
89 | 90 | $this->setAction("activate"); |
90 | 91 | $this->input=new HtmlInput($name,"hidden"); |
91 | 92 | } |
@@ -142,7 +143,7 @@ discard block |
||
142 | 143 | foreach ($items as $k=>$v){ |
143 | 144 | $this->addItem($v)->setData($k); |
144 | 145 | } |
145 | - }else{ |
|
146 | + } else{ |
|
146 | 147 | foreach ($items as $item){ |
147 | 148 | $this->addItem($item); |
148 | 149 | } |
@@ -162,7 +163,7 @@ discard block |
||
162 | 163 | if($dropdown===false){ |
163 | 164 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
164 | 165 | $dropdown="menu"; |
165 | - }else{ |
|
166 | + } else{ |
|
166 | 167 | $dropdown="dropdown"; |
167 | 168 | $this->mClass="menu"; |
168 | 169 | } |
@@ -178,20 +179,24 @@ discard block |
||
178 | 179 | } |
179 | 180 | |
180 | 181 | public function asButton($floating=false){ |
181 | - if($floating) |
|
182 | - $this->addToProperty("class", "floating"); |
|
182 | + if($floating) { |
|
183 | + $this->addToProperty("class", "floating"); |
|
184 | + } |
|
183 | 185 | $this->removePropertyValue("class", "selection"); |
184 | 186 | return $this->addToProperty("class", "button"); |
185 | 187 | } |
186 | 188 | |
187 | 189 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
188 | - if(isset($name)) |
|
189 | - $this->addInput($name); |
|
190 | - if($multiple) |
|
191 | - $this->addToProperty("class", "multiple"); |
|
190 | + if(isset($name)) { |
|
191 | + $this->addInput($name); |
|
192 | + } |
|
193 | + if($multiple) { |
|
194 | + $this->addToProperty("class", "multiple"); |
|
195 | + } |
|
192 | 196 | if ($selection){ |
193 | - if($this->propertyContains("class", "button")===false) |
|
194 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
197 | + if($this->propertyContains("class", "button")===false) { |
|
198 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
199 | + } |
|
195 | 200 | } |
196 | 201 | return $this; |
197 | 202 | } |
@@ -202,8 +207,9 @@ discard block |
||
202 | 207 | } |
203 | 208 | |
204 | 209 | public function setSelect($name=NULL,$multiple=false){ |
205 | - if(!isset($name)) |
|
206 | - $name="select-".$this->identifier; |
|
210 | + if(!isset($name)) { |
|
211 | + $name="select-".$this->identifier; |
|
212 | + } |
|
207 | 213 | $this->input=null; |
208 | 214 | if($multiple){ |
209 | 215 | $this->setProperty("multiple", true); |
@@ -234,12 +240,13 @@ discard block |
||
234 | 240 | public function setValue($value){ |
235 | 241 | if(isset($this->input)){ |
236 | 242 | $this->input->setProperty("value", $value); |
237 | - }else{ |
|
243 | + } else{ |
|
238 | 244 | $this->setProperty("value", $value); |
239 | 245 | } |
240 | 246 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
241 | - if(isset($textElement)) |
|
242 | - $textElement->setContent($value); |
|
247 | + if(isset($textElement)) { |
|
248 | + $textElement->setContent($value); |
|
249 | + } |
|
243 | 250 | return $this; |
244 | 251 | } |
245 | 252 | |
@@ -249,8 +256,9 @@ discard block |
||
249 | 256 | */ |
250 | 257 | public function run(JsUtils $js) { |
251 | 258 | if($this->propertyContains("class", "simple")===false){ |
252 | - if(isset($this->_bsComponent)===false) |
|
253 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
259 | + if(isset($this->_bsComponent)===false) { |
|
260 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
261 | + } |
|
254 | 262 | $this->addEventsOnRun($js); |
255 | 263 | return $this->_bsComponent; |
256 | 264 | } |