@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
59 | + if ($value===true) |
|
60 | 60 | $this->setProperty("tabindex", "0"); |
61 | 61 | else { |
62 | 62 | $this->removeProperty("tabindex"); |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | |
67 | 67 | public function setAnimated($content, $animation="") { |
68 | 68 | $this->setTagName("div"); |
69 | - $this->addToProperty("class", "animated " . $animation); |
|
70 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
69 | + $this->addToProperty("class", "animated ".$animation); |
|
70 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
71 | 71 | $visible->setClass("visible content"); |
72 | 72 | $visible->setContent($this->content); |
73 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
73 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
74 | 74 | $hidden->setClass("hidden content"); |
75 | 75 | $hidden->setContent($content); |
76 | - $this->content=array ($visible,$hidden ); |
|
76 | + $this->content=array($visible, $hidden); |
|
77 | 77 | return $hidden; |
78 | 78 | } |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function asIcon($icon) { |
86 | 86 | $iconO=$icon; |
87 | 87 | if (\is_string($icon)) { |
88 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
88 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
89 | 89 | } |
90 | 90 | $this->addToProperty("class", "icon"); |
91 | 91 | $this->content=$iconO; |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | * @return HtmlLabel |
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | - $this->tagName="div";$prefix=""; |
|
109 | - if($before) |
|
108 | + $this->tagName="div"; $prefix=""; |
|
109 | + if ($before) |
|
110 | 110 | $prefix="left "; |
111 | 111 | $this->addToProperty("class", $prefix."labeled"); |
112 | 112 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
113 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
114 | - if($isIcon){ |
|
113 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
114 | + if ($isIcon) { |
|
115 | 115 | $this->content->addClass("icon"); |
116 | 116 | } |
117 | 117 | $this->content->setTagName("div"); |
118 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
118 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
119 | 119 | $label->setBasic(); |
120 | 120 | $this->addContent($label, $before); |
121 | 121 | return $label; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function fromArray($array) { |
129 | 129 | $array=parent::fromArray($array); |
130 | - foreach ( $array as $key => $value ) { |
|
130 | + foreach ($array as $key => $value) { |
|
131 | 131 | $this->setProperty($key, $value); |
132 | 132 | } |
133 | 133 | return $array; |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | return $this->addToProperty("class", "positive"); |
142 | 142 | } |
143 | 143 | |
144 | - public function setColor($color){ |
|
145 | - if(\is_array($this->content)){ |
|
146 | - foreach ($this->content as $content){ |
|
147 | - if($content instanceof HtmlButton) |
|
144 | + public function setColor($color) { |
|
145 | + if (\is_array($this->content)) { |
|
146 | + foreach ($this->content as $content) { |
|
147 | + if ($content instanceof HtmlButton) |
|
148 | 148 | $content->setColor($color); |
149 | 149 | } |
150 | 150 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return HtmlButton |
203 | 203 | */ |
204 | 204 | public static function social($identifier, $social, $value=NULL) { |
205 | - if ($value === NULL) |
|
205 | + if ($value===NULL) |
|
206 | 206 | $value=\ucfirst($social); |
207 | 207 | $return=new HtmlButton($identifier, $value); |
208 | 208 | $return->addIcon($social); |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * {@inheritDoc} |
240 | 240 | * @see HtmlSemDoubleElement::asLink() |
241 | 241 | */ |
242 | - public function asLink($href=NULL,$target=NULL) { |
|
243 | - parent::asLink($href,$target); |
|
242 | + public function asLink($href=NULL, $target=NULL) { |
|
243 | + parent::asLink($href, $target); |
|
244 | 244 | return $this; |
245 | 245 | } |
246 | 246 | |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * @param string $icon |
254 | 254 | * @return HtmlButtonGroups |
255 | 255 | */ |
256 | - public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
257 | - $result=new HtmlButtonGroups($identifier,[$value]); |
|
258 | - $dd=$result->addDropdown($items,$asCombo); |
|
259 | - if(isset($icon) && $dd instanceof HtmlDropdown) |
|
256 | + public static function dropdown($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
257 | + $result=new HtmlButtonGroups($identifier, [$value]); |
|
258 | + $dd=$result->addDropdown($items, $asCombo); |
|
259 | + if (isset($icon) && $dd instanceof HtmlDropdown) |
|
260 | 260 | $dd->setIcon($icon); |
261 | 261 | return $result; |
262 | 262 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
60 | - $this->setProperty("tabindex", "0"); |
|
61 | - else { |
|
59 | + if ($value === true) { |
|
60 | + $this->setProperty("tabindex", "0"); |
|
61 | + } else { |
|
62 | 62 | $this->removeProperty("tabindex"); |
63 | 63 | } |
64 | 64 | return $this; |
@@ -106,8 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | 108 | $this->tagName="div";$prefix=""; |
109 | - if($before) |
|
110 | - $prefix="left "; |
|
109 | + if($before) { |
|
110 | + $prefix="left "; |
|
111 | + } |
|
111 | 112 | $this->addToProperty("class", $prefix."labeled"); |
112 | 113 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
113 | 114 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
@@ -144,12 +145,13 @@ discard block |
||
144 | 145 | public function setColor($color){ |
145 | 146 | if(\is_array($this->content)){ |
146 | 147 | foreach ($this->content as $content){ |
147 | - if($content instanceof HtmlButton) |
|
148 | - $content->setColor($color); |
|
148 | + if($content instanceof HtmlButton) { |
|
149 | + $content->setColor($color); |
|
150 | + } |
|
149 | 151 | } |
152 | + } else { |
|
153 | + parent::setColor($color); |
|
150 | 154 | } |
151 | - else |
|
152 | - parent::setColor($color); |
|
153 | 155 | return $this; |
154 | 156 | } |
155 | 157 | |
@@ -202,8 +204,9 @@ discard block |
||
202 | 204 | * @return HtmlButton |
203 | 205 | */ |
204 | 206 | public static function social($identifier, $social, $value=NULL) { |
205 | - if ($value === NULL) |
|
206 | - $value=\ucfirst($social); |
|
207 | + if ($value === NULL) { |
|
208 | + $value=\ucfirst($social); |
|
209 | + } |
|
207 | 210 | $return=new HtmlButton($identifier, $value); |
208 | 211 | $return->addIcon($social); |
209 | 212 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -256,8 +259,9 @@ discard block |
||
256 | 259 | public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
257 | 260 | $result=new HtmlButtonGroups($identifier,[$value]); |
258 | 261 | $dd=$result->addDropdown($items,$asCombo); |
259 | - if(isset($icon) && $dd instanceof HtmlDropdown) |
|
260 | - $dd->setIcon($icon); |
|
262 | + if(isset($icon) && $dd instanceof HtmlDropdown) { |
|
263 | + $dd->setIcon($icon); |
|
264 | + } |
|
261 | 265 | return $result; |
262 | 266 | } |
263 | 267 | } |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | protected $_dropdown; |
19 | 19 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
20 | 20 | parent::__construct($identifier, "div", "ui buttons"); |
21 | - if ($asIcons === true) |
|
21 | + if ($asIcons===true) |
|
22 | 22 | $this->asIcons(); |
23 | 23 | $this->addElements($elements, $asIcons); |
24 | 24 | } |
25 | - protected function createItem($value){ |
|
25 | + protected function createItem($value) { |
|
26 | 26 | return new HtmlButton("", $value); |
27 | 27 | } |
28 | 28 | |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * @param boolean $asCombo |
32 | 32 | * @return HtmlDropdown|HtmlButton |
33 | 33 | */ |
34 | - public function addDropdown($items,$asCombo=false){ |
|
35 | - $dd= new HtmlDropdown("dd-".$this->identifier,null,$items); |
|
34 | + public function addDropdown($items, $asCombo=false) { |
|
35 | + $dd=new HtmlDropdown("dd-".$this->identifier, null, $items); |
|
36 | 36 | $dd->asButton(); |
37 | - if($asCombo){ |
|
37 | + if ($asCombo) { |
|
38 | 38 | $dd->setAction("combo"); |
39 | 39 | $dd->addToProperty("class", "combo"); |
40 | 40 | } |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function addElement($element, $asIcon=false) { |
52 | 52 | $item=$this->addItem($element); |
53 | - if($asIcon && $item instanceof HtmlButton) |
|
53 | + if ($asIcon && $item instanceof HtmlButton) |
|
54 | 54 | $item->asIcon($element); |
55 | 55 | return $item; |
56 | 56 | } |
57 | 57 | |
58 | 58 | public function addElements($elements, $asIcons=false) { |
59 | - foreach ( $elements as $element ) { |
|
59 | + foreach ($elements as $element) { |
|
60 | 60 | $this->addElement($element, $asIcons); |
61 | 61 | } |
62 | 62 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function insertOr($aferIndex=0, $or="or") { |
66 | 66 | $orElement=new HtmlSemDoubleElement("", "div", "or"); |
67 | 67 | $orElement->setProperty("data-text", $or); |
68 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
68 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | public function asIcons() { |
81 | - foreach ( $this->content as $item ) { |
|
82 | - if($item instanceof HtmlButton) |
|
81 | + foreach ($this->content as $item) { |
|
82 | + if ($item instanceof HtmlButton) |
|
83 | 83 | $item->asIcon($item->getContent()); |
84 | 84 | } |
85 | 85 | return $this->addToProperty("class", "icons"); |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param array $icons |
91 | 91 | * @return HtmlButtonGroups |
92 | 92 | */ |
93 | - public function addIcons($icons){ |
|
94 | - foreach ( $this->content as $index=>$item ) { |
|
95 | - if($item instanceof HtmlButton && isset($icons[$index])) |
|
93 | + public function addIcons($icons) { |
|
94 | + foreach ($this->content as $index=>$item) { |
|
95 | + if ($item instanceof HtmlButton && isset($icons[$index])) |
|
96 | 96 | $item->addIcon($icons[$index]); |
97 | 97 | } |
98 | 98 | return $this; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
133 | 133 | */ |
134 | 134 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
135 | - foreach ( $this->content as $element ) { |
|
135 | + foreach ($this->content as $element) { |
|
136 | 136 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
137 | 137 | } |
138 | 138 | return $this; |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | |
145 | 145 | public function addClasses($classes=array()) { |
146 | 146 | $i=0; |
147 | - if(!\is_array($classes)){ |
|
148 | - $classes=array_fill (0,$this->count(),$classes); |
|
147 | + if (!\is_array($classes)) { |
|
148 | + $classes=array_fill(0, $this->count(), $classes); |
|
149 | 149 | } |
150 | - foreach ( $this->content as $button ) { |
|
150 | + foreach ($this->content as $button) { |
|
151 | 151 | $button->addToProperty("class", $classes[$i++]); |
152 | 152 | } |
153 | 153 | return $this; |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | $this->addElement($function($object)); |
162 | 162 | } |
163 | 163 | |
164 | - public function run(JsUtils $js){ |
|
165 | - $result= parent::run($js); |
|
164 | + public function run(JsUtils $js) { |
|
165 | + $result=parent::run($js); |
|
166 | 166 | return $result->setItemSelector(".ui.button"); |
167 | 167 | } |
168 | 168 |
@@ -18,8 +18,9 @@ discard block |
||
18 | 18 | protected $_dropdown; |
19 | 19 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
20 | 20 | parent::__construct($identifier, "div", "ui buttons"); |
21 | - if ($asIcons === true) |
|
22 | - $this->asIcons(); |
|
21 | + if ($asIcons === true) { |
|
22 | + $this->asIcons(); |
|
23 | + } |
|
23 | 24 | $this->addElements($elements, $asIcons); |
24 | 25 | } |
25 | 26 | protected function createItem($value){ |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | */ |
51 | 52 | public function addElement($element, $asIcon=false) { |
52 | 53 | $item=$this->addItem($element); |
53 | - if($asIcon && $item instanceof HtmlButton) |
|
54 | - $item->asIcon($element); |
|
54 | + if($asIcon && $item instanceof HtmlButton) { |
|
55 | + $item->asIcon($element); |
|
56 | + } |
|
55 | 57 | return $item; |
56 | 58 | } |
57 | 59 | |
@@ -79,8 +81,9 @@ discard block |
||
79 | 81 | |
80 | 82 | public function asIcons() { |
81 | 83 | foreach ( $this->content as $item ) { |
82 | - if($item instanceof HtmlButton) |
|
83 | - $item->asIcon($item->getContent()); |
|
84 | + if($item instanceof HtmlButton) { |
|
85 | + $item->asIcon($item->getContent()); |
|
86 | + } |
|
84 | 87 | } |
85 | 88 | return $this->addToProperty("class", "icons"); |
86 | 89 | } |
@@ -92,8 +95,9 @@ discard block |
||
92 | 95 | */ |
93 | 96 | public function addIcons($icons){ |
94 | 97 | foreach ( $this->content as $index=>$item ) { |
95 | - if($item instanceof HtmlButton && isset($icons[$index])) |
|
96 | - $item->addIcon($icons[$index]); |
|
98 | + if($item instanceof HtmlButton && isset($icons[$index])) { |
|
99 | + $item->addIcon($icons[$index]); |
|
100 | + } |
|
97 | 101 | } |
98 | 102 | return $this; |
99 | 103 | } |