Completed
Push — master ( 2c01a5...172c54 )
by Jean-Christophe
03:09
created
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.