@@ -11,7 +11,6 @@ |
||
11 | 11 | use Ajax\semantic\html\modules\HtmlDropdown; |
12 | 12 | use Ajax\semantic\html\modules\HtmlPopup; |
13 | 13 | use Ajax\semantic\html\elements\HtmlIcon; |
14 | -use Ajax\semantic\html\elements\html5\HtmlLink; |
|
15 | 14 | use Ajax\semantic\html\elements\HtmlInput; |
16 | 15 | use Ajax\semantic\html\elements\HtmlButton; |
17 | 16 | use Ajax\semantic\html\base\traits\AttachedTrait; |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | private function afterInsert($item) { |
61 | - if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
|
62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
63 | - else { |
|
61 | + if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) { |
|
62 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
63 | + } else { |
|
64 | 64 | $this->setSecondary(); |
65 | 65 | } |
66 | 66 | return $item; |
@@ -146,10 +146,11 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | public function setSecondary($value=true) { |
149 | - if($value) |
|
150 | - $this->addToProperty("class", "secondary"); |
|
151 | - else |
|
152 | - $this->removePropertyValue("class", "secondary"); |
|
149 | + if($value) { |
|
150 | + $this->addToProperty("class", "secondary"); |
|
151 | + } else { |
|
152 | + $this->removePropertyValue("class", "secondary"); |
|
153 | + } |
|
153 | 154 | } |
154 | 155 | |
155 | 156 | public function setVertical() { |
@@ -168,8 +169,9 @@ discard block |
||
168 | 169 | $this->apply(function (HtmlDoubleElement &$item) { |
169 | 170 | $item->setTagName("a"); |
170 | 171 | }); |
171 | - if ($vertical === true) |
|
172 | - $this->setVertical(); |
|
172 | + if ($vertical === true) { |
|
173 | + $this->setVertical(); |
|
174 | + } |
|
173 | 175 | return $this->addToProperty("class", "tabular"); |
174 | 176 | } |
175 | 177 | |
@@ -198,10 +200,11 @@ discard block |
||
198 | 200 | */ |
199 | 201 | public function fromDatabaseObject($object, $function) { |
200 | 202 | $return=$function($object); |
201 | - if (\is_array($return)) |
|
202 | - $this->addItems($return); |
|
203 | - else |
|
204 | - $this->addItem($return); |
|
203 | + if (\is_array($return)) { |
|
204 | + $this->addItems($return); |
|
205 | + } else { |
|
206 | + $this->addItem($return); |
|
207 | + } |
|
205 | 208 | } |
206 | 209 | |
207 | 210 | /** |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -11,14 +11,15 @@ discard block |
||
11 | 11 | public function setContent($content){ |
12 | 12 | if($content==="-"){ |
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
14 | + } elseif($content==="-search-"){ |
|
15 | 15 | $values=\explode(",",$content,-1); |
16 | 16 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
17 | - }elseif(JString::startswith($content, "-")){ |
|
17 | + } elseif(JString::startswith($content, "-")){ |
|
18 | 18 | $content=\ltrim($content,"-"); |
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
21 | - parent::setContent($content); |
|
20 | + } else { |
|
21 | + parent::setContent($content); |
|
22 | + } |
|
22 | 23 | return $this; |
23 | 24 | } |
24 | 25 | |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
31 | 32 | $this->setClass("ui icon search input"); |
32 | 33 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
34 | - $input->setProperty("placeholder", $placeholder); |
|
34 | + if(isset($placeholder)) { |
|
35 | + $input->setProperty("placeholder", $placeholder); |
|
36 | + } |
|
35 | 37 | $this->content=$input; |
36 | - if(isset($icon)) |
|
37 | - $this->addIcon($icon); |
|
38 | + if(isset($icon)) { |
|
39 | + $this->addIcon($icon); |
|
40 | + } |
|
38 | 41 | return $this; |
39 | 42 | } |
40 | 43 | |
@@ -57,8 +60,9 @@ discard block |
||
57 | 60 | $this->setClass("header"); |
58 | 61 | $this->tagName="div"; |
59 | 62 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
63 | + if(isset($icon)) { |
|
64 | + $this->addIcon($icon,Direction::LEFT); |
|
65 | + } |
|
62 | 66 | return $this; |
63 | 67 | } |
64 | 68 | } |
65 | 69 | \ No newline at end of file |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
35 | - if (isset($this->_popup)) |
|
36 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
35 | + if (isset($this->_popup)) { |
|
36 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
@@ -60,8 +61,9 @@ discard block |
||
60 | 61 | $labelO=$label; |
61 | 62 | if (\is_object($label) === false) { |
62 | 63 | $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
63 | - if (isset($icon)) |
|
64 | - $labelO->addIcon($icon); |
|
64 | + if (isset($icon)) { |
|
65 | + $labelO->addIcon($icon); |
|
66 | + } |
|
65 | 67 | } else { |
66 | 68 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
67 | 69 | } |
@@ -80,21 +82,24 @@ discard block |
||
80 | 82 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
81 | 83 | */ |
82 | 84 | public function asLink($href=NULL) { |
83 | - if (isset($href)) |
|
84 | - $this->setProperty("href", $href); |
|
85 | + if (isset($href)) { |
|
86 | + $this->setProperty("href", $href); |
|
87 | + } |
|
85 | 88 | return $this->setTagName("a"); |
86 | 89 | } |
87 | 90 | |
88 | 91 | public function jsShowDimmer($show=true) { |
89 | 92 | $status="hide"; |
90 | - if ($show === true) |
|
91 | - $status="show"; |
|
93 | + if ($show === true) { |
|
94 | + $status="show"; |
|
95 | + } |
|
92 | 96 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
93 | 97 | } |
94 | 98 | |
95 | 99 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
96 | - if (isset($this->_popup)) |
|
97 | - $this->_popup->compile($js); |
|
100 | + if (isset($this->_popup)) { |
|
101 | + $this->_popup->compile($js); |
|
102 | + } |
|
98 | 103 | return parent::compile($js, $view); |
99 | 104 | } |
100 | 105 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | if(!$item instanceof HtmlDropdownItem){ |
73 | 73 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
74 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
74 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
75 | 75 | $this->addToProperty("class", "vertical"); |
76 | 76 | } |
77 | 77 | return $itemO; |
@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | public function addInput($name){ |
88 | - if(!isset($name)) |
|
89 | - $name="input-".$this->identifier; |
|
88 | + if(!isset($name)) { |
|
89 | + $name="input-".$this->identifier; |
|
90 | + } |
|
90 | 91 | $this->setAction("activate"); |
91 | 92 | $this->input=new HtmlInput($name,"hidden"); |
92 | 93 | } |
@@ -143,7 +144,7 @@ discard block |
||
143 | 144 | foreach ($items as $k=>$v){ |
144 | 145 | $this->addItem($v)->setData($k); |
145 | 146 | } |
146 | - }else{ |
|
147 | + } else{ |
|
147 | 148 | foreach ($items as $item){ |
148 | 149 | $this->addItem($item); |
149 | 150 | } |
@@ -167,7 +168,7 @@ discard block |
||
167 | 168 | if($dropdown===false){ |
168 | 169 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
169 | 170 | $dropdown="menu"; |
170 | - }else{ |
|
171 | + } else{ |
|
171 | 172 | $dropdown="dropdown"; |
172 | 173 | $this->mClass="menu"; |
173 | 174 | } |
@@ -187,20 +188,24 @@ discard block |
||
187 | 188 | } |
188 | 189 | |
189 | 190 | public function asButton($floating=false){ |
190 | - if($floating) |
|
191 | - $this->addToProperty("class", "floating"); |
|
191 | + if($floating) { |
|
192 | + $this->addToProperty("class", "floating"); |
|
193 | + } |
|
192 | 194 | $this->removePropertyValue("class", "selection"); |
193 | 195 | return $this->addToProperty("class", "button"); |
194 | 196 | } |
195 | 197 | |
196 | 198 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
197 | - if(isset($name)) |
|
198 | - $this->addInput($name); |
|
199 | - if($multiple) |
|
200 | - $this->addToProperty("class", "multiple"); |
|
199 | + if(isset($name)) { |
|
200 | + $this->addInput($name); |
|
201 | + } |
|
202 | + if($multiple) { |
|
203 | + $this->addToProperty("class", "multiple"); |
|
204 | + } |
|
201 | 205 | if ($selection){ |
202 | - if($this->propertyContains("class", "button")===false) |
|
203 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
206 | + if($this->propertyContains("class", "button")===false) { |
|
207 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
208 | + } |
|
204 | 209 | } |
205 | 210 | return $this; |
206 | 211 | } |
@@ -211,8 +216,9 @@ discard block |
||
211 | 216 | } |
212 | 217 | |
213 | 218 | public function setSelect($name=NULL,$multiple=false){ |
214 | - if(!isset($name)) |
|
215 | - $name="select-".$this->identifier; |
|
219 | + if(!isset($name)) { |
|
220 | + $name="select-".$this->identifier; |
|
221 | + } |
|
216 | 222 | $this->input=null; |
217 | 223 | if($multiple){ |
218 | 224 | $this->setProperty("multiple", true); |
@@ -248,12 +254,13 @@ discard block |
||
248 | 254 | $value=$this->value; |
249 | 255 | if(isset($this->input) && isset($value)){ |
250 | 256 | $this->input->setProperty("value", $value); |
251 | - }else{ |
|
257 | + } else{ |
|
252 | 258 | $this->setProperty("value", $value); |
253 | 259 | } |
254 | 260 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
255 | - if(isset($textElement)) |
|
256 | - $textElement->setContent($value); |
|
261 | + if(isset($textElement)) { |
|
262 | + $textElement->setContent($value); |
|
263 | + } |
|
257 | 264 | return $this; |
258 | 265 | } |
259 | 266 | |
@@ -263,8 +270,9 @@ discard block |
||
263 | 270 | */ |
264 | 271 | public function run(JsUtils $js) { |
265 | 272 | if($this->propertyContains("class", "simple")===false){ |
266 | - if(isset($this->_bsComponent)===false) |
|
267 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
273 | + if(isset($this->_bsComponent)===false) { |
|
274 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
275 | + } |
|
268 | 276 | $this->addEventsOnRun($js); |
269 | 277 | return $this->_bsComponent; |
270 | 278 | } |
@@ -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){ |
@@ -39,8 +42,9 @@ discard block |
||
39 | 42 | |
40 | 43 | public function asOption(){ |
41 | 44 | $this->tagName="option"; |
42 | - if($this->getProperty("data-value")!==null) |
|
43 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
45 | + if($this->getProperty("data-value")!==null) { |
|
46 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
47 | + } |
|
44 | 48 | } |
45 | 49 | |
46 | 50 | /** |
@@ -47,8 +47,9 @@ |
||
47 | 47 | if($item instanceof HtmlSemDoubleElement){ |
48 | 48 | $comp=$item->compile($js); |
49 | 49 | $bs=$item->run($js); |
50 | - if(isset($bs)) |
|
51 | - $this->params['onShow']=$bs->getScript(); |
|
50 | + if(isset($bs)) { |
|
51 | + $this->params['onShow']=$bs->getScript(); |
|
52 | + } |
|
52 | 53 | $item=$comp; |
53 | 54 | } |
54 | 55 | }); |