@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $itemO=$item; |
| 35 | 35 | if(\is_object($item)===false){ |
| 36 | 36 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
| 37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 37 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 38 | 38 | $this->addToProperty("class", "vertical"); |
| 39 | 39 | } |
| 40 | 40 | $this->items[]=$itemO; |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function addInput($name){ |
| 45 | - if(!isset($name)) |
|
| 46 | - $name="input-".$this->identifier; |
|
| 45 | + if(!isset($name)) { |
|
| 46 | + $name="input-".$this->identifier; |
|
| 47 | + } |
|
| 47 | 48 | $this->setAction("activate"); |
| 48 | 49 | $this->input=new HtmlInput($name,"hidden"); |
| 49 | 50 | } |
@@ -53,7 +54,7 @@ discard block |
||
| 53 | 54 | foreach ($items as $k=>$v){ |
| 54 | 55 | $this->addItem($v)->setData($k); |
| 55 | 56 | } |
| 56 | - }else{ |
|
| 57 | + } else{ |
|
| 57 | 58 | foreach ($items as $item){ |
| 58 | 59 | $this->addItem($item); |
| 59 | 60 | } |
@@ -67,7 +68,7 @@ discard block |
||
| 67 | 68 | if($dropdown===false){ |
| 68 | 69 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 69 | 70 | $dropdown="menu"; |
| 70 | - }else{ |
|
| 71 | + } else{ |
|
| 71 | 72 | $dropdown="dropdown"; |
| 72 | 73 | $this->mClass="menu"; |
| 73 | 74 | } |
@@ -83,18 +84,22 @@ discard block |
||
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | public function asButton($floating=false){ |
| 86 | - if($floating) |
|
| 87 | - $this->addToProperty("class", "floating"); |
|
| 87 | + if($floating) { |
|
| 88 | + $this->addToProperty("class", "floating"); |
|
| 89 | + } |
|
| 88 | 90 | return $this->addToProperty("class", "button"); |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | 93 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 92 | - if(isset($name)) |
|
| 93 | - $this->addInput($name); |
|
| 94 | - if($multiple) |
|
| 95 | - $this->addToProperty("class", "multiple"); |
|
| 96 | - if ($selection) |
|
| 97 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 94 | + if(isset($name)) { |
|
| 95 | + $this->addInput($name); |
|
| 96 | + } |
|
| 97 | + if($multiple) { |
|
| 98 | + $this->addToProperty("class", "multiple"); |
|
| 99 | + } |
|
| 100 | + if ($selection) { |
|
| 101 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 102 | + } |
|
| 98 | 103 | return $this; |
| 99 | 104 | } |
| 100 | 105 | |
@@ -104,8 +109,9 @@ discard block |
||
| 104 | 109 | } |
| 105 | 110 | |
| 106 | 111 | public function setSelect($name=NULL,$multiple=false){ |
| 107 | - if(!isset($name)) |
|
| 108 | - $name="select-".$this->identifier; |
|
| 112 | + if(!isset($name)) { |
|
| 113 | + $name="select-".$this->identifier; |
|
| 114 | + } |
|
| 109 | 115 | $this->input=null; |
| 110 | 116 | if($multiple){ |
| 111 | 117 | $this->setProperty("multiple", true); |
@@ -136,12 +142,13 @@ discard block |
||
| 136 | 142 | public function setValue($value){ |
| 137 | 143 | if(isset($this->input)){ |
| 138 | 144 | $this->input->setProperty("value", $value); |
| 139 | - }else{ |
|
| 145 | + } else{ |
|
| 140 | 146 | $this->setProperty("value", $value); |
| 141 | 147 | } |
| 142 | 148 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 143 | - if(isset($textElement)) |
|
| 144 | - $textElement->setContent($value); |
|
| 149 | + if(isset($textElement)) { |
|
| 150 | + $textElement->setContent($value); |
|
| 151 | + } |
|
| 145 | 152 | return $this; |
| 146 | 153 | } |
| 147 | 154 | |
@@ -151,8 +158,9 @@ discard block |
||
| 151 | 158 | */ |
| 152 | 159 | public function run(JsUtils $js) { |
| 153 | 160 | if($this->propertyContains("class", "simple")===false){ |
| 154 | - if(isset($this->_bsComponent)===false) |
|
| 155 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
| 161 | + if(isset($this->_bsComponent)===false) { |
|
| 162 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
| 163 | + } |
|
| 156 | 164 | $this->addEventsOnRun($js); |
| 157 | 165 | return $this->_bsComponent; |
| 158 | 166 | } |