@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setClass($classNames) { |
16 | - if(is_array($classNames)){ |
|
16 | + if (is_array($classNames)) { |
|
17 | 17 | $classNames=implode(" ", $classNames); |
18 | 18 | } |
19 | 19 | $this->setProperty("class", $classNames); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function fromArray($array) { |
42 | 42 | $array=parent::fromArray($array); |
43 | - foreach ( $array as $key => $value ) { |
|
43 | + foreach ($array as $key => $value) { |
|
44 | 44 | $this->setProperty($key, $value); |
45 | 45 | } |
46 | 46 | return $array; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\bootstrap\html\html5; |
3 | 3 | /** |
4 | - * HTML Select |
|
5 | - * @author jc |
|
6 | - * @version 1.002 |
|
7 | - */ |
|
4 | + * HTML Select |
|
5 | + * @author jc |
|
6 | + * @version 1.002 |
|
7 | + */ |
|
8 | 8 | use Ajax\bootstrap\html\base\HtmlDoubleElement; |
9 | 9 | |
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
11 | 11 | protected $value; |
12 | 12 | protected $selected; |
13 | - public function __construct($identifier,$caption,$value="") { |
|
13 | + public function __construct($identifier, $caption, $value="") { |
|
14 | 14 | parent::__construct($identifier, "option"); |
15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->selected=""; |
19 | 19 | } |
20 | 20 | |
21 | - public function select(){ |
|
21 | + public function select() { |
|
22 | 22 | $this->selected="selected"; |
23 | 23 | return $this; |
24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | public function setValue($value) { |
30 | - $this->value = $value; |
|
30 | + $this->value=$value; |
|
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | private $default; |
17 | 17 | private $options; |
18 | 18 | |
19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
20 | 20 | parent::__construct($identifier, "select"); |
21 | 21 | $this->setProperty("name", $identifier); |
22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | $this->options=array(); |
26 | 26 | } |
27 | 27 | |
28 | - public function addOption($element,$value="",$selected=false){ |
|
29 | - if($element instanceof HtmlOption){ |
|
28 | + public function addOption($element, $value="", $selected=false) { |
|
29 | + if ($element instanceof HtmlOption) { |
|
30 | 30 | $option=$element; |
31 | - }else{ |
|
32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
31 | + }else { |
|
32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
33 | 33 | } |
34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
35 | 35 | $option->select(); |
36 | 36 | } |
37 | 37 | $this->options[]=$option; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setValue($value) { |
41 | - foreach ( $this->options as $option ) { |
|
42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
41 | + foreach ($this->options as $option) { |
|
42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
43 | 43 | $option->setProperty("selected", ""); |
44 | 44 | } |
45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
54 | 54 | $this->content=array(); |
55 | - if(isset($this->default)){ |
|
55 | + if (isset($this->default)) { |
|
56 | 56 | $default=new HtmlOption("", $this->default); |
57 | 57 | $this->content[]=$default; |
58 | 58 | } |
59 | - foreach ($this->options as $option){ |
|
59 | + foreach ($this->options as $option) { |
|
60 | 60 | $this->content[]=$option; |
61 | 61 | } |
62 | 62 | return parent::compile($js, $view); |
63 | 63 | } |
64 | 64 | |
65 | - public function fromArray($array){ |
|
66 | - if(JArray::isAssociative($array)){ |
|
67 | - foreach ($array as $k=>$v){ |
|
65 | + public function fromArray($array) { |
|
66 | + if (JArray::isAssociative($array)) { |
|
67 | + foreach ($array as $k=>$v) { |
|
68 | 68 | $this->addOption($v, $k); |
69 | 69 | } |
70 | - }else{ |
|
71 | - foreach ($array as $v){ |
|
70 | + }else { |
|
71 | + foreach ($array as $v) { |
|
72 | 72 | $this->addOption($v, $v); |
73 | 73 | } |
74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->addOption($function($object)); |
102 | 102 | } |
103 | 103 | |
104 | - public function setSize($size){ |
|
104 | + public function setSize($size) { |
|
105 | 105 | return $this->setProperty("size", $size); |
106 | 106 | } |
107 | 107 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function addOption($element,$value="",$selected=false){ |
29 | 29 | if($element instanceof HtmlOption){ |
30 | 30 | $option=$element; |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
33 | 33 | } |
34 | 34 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($array as $k=>$v){ |
68 | 68 | $this->addOption($v, $k); |
69 | 69 | } |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | foreach ($array as $v){ |
72 | 72 | $this->addOption($v, $v); |
73 | 73 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Set the button value |
36 | 36 | * @param string $value |
37 | - * @return \Ajax\semantic\html\HtmlButton |
|
37 | + * @return HtmlButton |
|
38 | 38 | */ |
39 | 39 | public function setValue($value) { |
40 | 40 | $this->content=$value; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | /** |
45 | 45 | * define the button style |
46 | - * @param string|int $cssStyle |
|
47 | - * @return \Ajax\semantic\html\HtmlButton default : "" |
|
46 | + * @param string $cssStyle |
|
47 | + * @return HtmlButton default : "" |
|
48 | 48 | */ |
49 | 49 | public function setStyle($cssStyle) { |
50 | 50 | return $this->addToProperty("class",$cssStyle); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @param string|HtmlIcon $icon |
|
90 | + * @param string $icon |
|
91 | 91 | * @return \Ajax\semantic\html\elements\HtmlButton |
92 | 92 | */ |
93 | 93 | public function asIcon($icon){ |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param string $onClick JS Code for click event |
23 | 23 | */ |
24 | 24 | public function __construct($identifier, $value="", $cssStyle=null, $onClick=null) { |
25 | - parent::__construct($identifier, "button","ui button"); |
|
25 | + parent::__construct($identifier, "button", "ui button"); |
|
26 | 26 | $this->content=$value; |
27 | 27 | if (isset($cssStyle)) { |
28 | 28 | $this->setStyle($cssStyle); |
@@ -48,25 +48,25 @@ discard block |
||
48 | 48 | * @return \Ajax\semantic\html\HtmlButton default : "" |
49 | 49 | */ |
50 | 50 | public function setStyle($cssStyle) { |
51 | - return $this->addToProperty("class",$cssStyle); |
|
51 | + return $this->addToProperty("class", $cssStyle); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function setFocusable($value=true){ |
|
55 | - if($value===true) |
|
54 | + public function setFocusable($value=true) { |
|
55 | + if ($value===true) |
|
56 | 56 | $this->setProperty("tabindex", "0"); |
57 | - else{ |
|
57 | + else { |
|
58 | 58 | $this->removeProperty("tabindex"); |
59 | 59 | } |
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setAnimated($content,$animation=""){ |
|
63 | + public function setAnimated($content, $animation="") { |
|
64 | 64 | $this->setTagName("div"); |
65 | 65 | $this->addToProperty("class", "animated ".$animation); |
66 | - $visible=new HtmlSemDoubleElement("visible-".$this->identifier,"div"); |
|
66 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
67 | 67 | $visible->setClass("visible content"); |
68 | 68 | $visible->setContent($this->content); |
69 | - $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier,"div"); |
|
69 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
70 | 70 | $hidden->setClass("hidden content"); |
71 | 71 | $hidden->setContent($content); |
72 | 72 | $this->content=$visible.$hidden; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | * @param string|HtmlIcon $icon |
77 | 77 | * @return \Ajax\semantic\html\elements\HtmlButton |
78 | 78 | */ |
79 | - public function asIcon($icon){ |
|
79 | + public function asIcon($icon) { |
|
80 | 80 | $iconO=$icon; |
81 | - if(\is_string($icon)){ |
|
81 | + if (\is_string($icon)) { |
|
82 | 82 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
83 | 83 | } |
84 | 84 | $this->addToProperty("class", "icon"); |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | * @param string $before |
93 | 93 | * @return \Ajax\semantic\html\elements\HtmlLabel |
94 | 94 | */ |
95 | - public function addLabel($caption,$before=false){ |
|
95 | + public function addLabel($caption, $before=false) { |
|
96 | 96 | $this->tagName="div"; |
97 | 97 | $this->addToProperty("class", "labeled"); |
98 | - $this->content=new HtmlButton("button-".$this->identifier,$this->content); |
|
98 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
99 | 99 | $this->content->setTagName("div"); |
100 | - $label=new HtmlLabel("label-".$this->identifier,$caption,"a"); |
|
100 | + $label=new HtmlLabel("label-".$this->identifier, $caption, "a"); |
|
101 | 101 | $label->setBasic(); |
102 | - $this->addContent($label,$before); |
|
102 | + $this->addContent($label, $before); |
|
103 | 103 | return $label; |
104 | 104 | } |
105 | 105 | /* |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function fromArray($array) { |
110 | 110 | $array=parent::fromArray($array); |
111 | - foreach ( $array as $key => $value ) { |
|
111 | + foreach ($array as $key => $value) { |
|
112 | 112 | $this->setProperty($key, $value); |
113 | 113 | } |
114 | 114 | return $array; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * show it is currently the active user selection |
119 | 119 | * @return \Ajax\semantic\html\elements\HtmlButton |
120 | 120 | */ |
121 | - public function setActive(){ |
|
121 | + public function setActive() { |
|
122 | 122 | return $this->addToProperty("class", "active"); |
123 | 123 | } |
124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * hint towards a positive consequence |
127 | 127 | * @return \Ajax\semantic\html\elements\HtmlButton |
128 | 128 | */ |
129 | - public function setPositive(){ |
|
129 | + public function setPositive() { |
|
130 | 130 | return $this->addToProperty("class", "positive"); |
131 | 131 | } |
132 | 132 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * hint towards a negative consequence |
135 | 135 | * @return \Ajax\semantic\html\elements\HtmlButton |
136 | 136 | */ |
137 | - public function setNegative(){ |
|
137 | + public function setNegative() { |
|
138 | 138 | return $this->addToProperty("class", "negative"); |
139 | 139 | } |
140 | 140 | |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * formatted to toggle on/off |
143 | 143 | * @return \Ajax\semantic\html\elements\HtmlButton |
144 | 144 | */ |
145 | - public function setToggle(){ |
|
145 | + public function setToggle() { |
|
146 | 146 | return $this->addToProperty("class", "toggle"); |
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | 150 | * @return \Ajax\semantic\html\elements\HtmlButton |
151 | 151 | */ |
152 | - public function setCircular(){ |
|
152 | + public function setCircular() { |
|
153 | 153 | return $this->addToProperty("class", "circular"); |
154 | 154 | } |
155 | 155 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * button is less pronounced |
158 | 158 | * @return \Ajax\semantic\html\elements\HtmlButton |
159 | 159 | */ |
160 | - public function setBasic(){ |
|
160 | + public function setBasic() { |
|
161 | 161 | return $this->addToProperty("class", "basic"); |
162 | 162 | } |
163 | 163 | |
164 | - public function setEmphasis($value){ |
|
164 | + public function setEmphasis($value) { |
|
165 | 165 | return $this->addToPropertyCtrl("class", $value, Emphasis::getConstants()); |
166 | 166 | } |
167 | 167 | } |
168 | 168 | \ No newline at end of file |
@@ -52,9 +52,9 @@ |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function setFocusable($value=true){ |
55 | - if($value===true) |
|
56 | - $this->setProperty("tabindex", "0"); |
|
57 | - else{ |
|
55 | + if($value===true) { |
|
56 | + $this->setProperty("tabindex", "0"); |
|
57 | + } else{ |
|
58 | 58 | $this->removeProperty("tabindex"); |
59 | 59 | } |
60 | 60 | return $this; |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class HtmlImg extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$src="",$alt="") { |
|
10 | + public function __construct($identifier, $src="", $alt="") { |
|
11 | 11 | parent::__construct($identifier, "img"); |
12 | 12 | $this->setSrc($src); |
13 | 13 | $this->setAlt($alt); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $attributes; |
18 | 18 | protected $color; |
19 | 19 | |
20 | - public function __construct($identifier,$icon) { |
|
20 | + public function __construct($identifier, $icon) { |
|
21 | 21 | parent::__construct($identifier, "i"); |
22 | 22 | $this->icon=$icon; |
23 | 23 | $this->_template='<i class="%icon% icon %size% %attributes% %color%"></i>'; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
43 | 43 | */ |
44 | 44 | public function setSize($size) { |
45 | - $this->setMemberCtrl($this->size, $size,Size::getConstants()); |
|
45 | + $this->setMemberCtrl($this->size, $size, Size::getConstants()); |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
49 | - public function setDisabled(){ |
|
49 | + public function setDisabled() { |
|
50 | 50 | return $this->addToMember($this->attributes, "disabled"); |
51 | 51 | } |
52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * Icon used as a simple loader |
55 | 55 | * @return \Ajax\semantic\html\HtmlIcon |
56 | 56 | */ |
57 | - public function asLoader(){ |
|
57 | + public function asLoader() { |
|
58 | 58 | return $this->addToMember($this->attributes, "loading"); |
59 | 59 | } |
60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * An icon can be fitted, without any space to the left or right of it. |
63 | 63 | * @return \Ajax\semantic\html\HtmlIcon |
64 | 64 | */ |
65 | - public function setFitted(){ |
|
65 | + public function setFitted() { |
|
66 | 66 | return $this->addToMember($this->attributes, "fitted"); |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $sens horizontally or vertically |
71 | 71 | * @return \Ajax\semantic\html\HtmlIcon |
72 | 72 | */ |
73 | - public function setFlipped($sens="horizontally"){ |
|
73 | + public function setFlipped($sens="horizontally") { |
|
74 | 74 | return $this->addToMember($this->attributes, "flipped ".$sens); |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $sens clockwise or counterclockwise |
79 | 79 | * @return \Ajax\semantic\html\HtmlIcon |
80 | 80 | */ |
81 | - public function setRotated($sens="clockwise"){ |
|
81 | + public function setRotated($sens="clockwise") { |
|
82 | 82 | return $this->addToMember($this->attributes, "rotated ".$sens); |
83 | 83 | } |
84 | 84 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * icon formatted as a link |
87 | 87 | * @return \Ajax\semantic\html\HtmlIcon |
88 | 88 | */ |
89 | - public function asLink(){ |
|
89 | + public function asLink() { |
|
90 | 90 | return $this->addToMember($this->attributes, "link"); |
91 | 91 | } |
92 | 92 | |
93 | - public function setCircular($inverted=false){ |
|
93 | + public function setCircular($inverted=false) { |
|
94 | 94 | $invertedStr=""; |
95 | - if($inverted!==false) |
|
95 | + if ($inverted!==false) |
|
96 | 96 | $invertedStr=" inverted"; |
97 | 97 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
98 | 98 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * @return \Ajax\semantic\html\HtmlIcon |
102 | 102 | */ |
103 | - public function setInverted(){ |
|
103 | + public function setInverted() { |
|
104 | 104 | return $this->addToMember($this->attributes, "inverted"); |
105 | 105 | } |
106 | 106 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * @param string $inverted |
109 | 109 | * @return \Ajax\semantic\html\HtmlIcon |
110 | 110 | */ |
111 | - public function setBordered($inverted=false){ |
|
111 | + public function setBordered($inverted=false) { |
|
112 | 112 | $invertedStr=""; |
113 | - if($inverted!==false) |
|
113 | + if ($inverted!==false) |
|
114 | 114 | $invertedStr=" inverted"; |
115 | 115 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
116 | 116 | } |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * @param string $color |
120 | 120 | * @return \Ajax\semantic\html\HtmlIcon |
121 | 121 | */ |
122 | - public function setColor($color){ |
|
122 | + public function setColor($color) { |
|
123 | 123 | return $this->setMemberCtrl($this->color, $color, Color::getConstants()); |
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @return \Ajax\semantic\html\HtmlIcon |
128 | 128 | */ |
129 | - public function toCorner(){ |
|
129 | + public function toCorner() { |
|
130 | 130 | return $this->addToMember($this->attributes, "corner"); |
131 | 131 | } |
132 | 132 | } |
133 | 133 | \ No newline at end of file |
@@ -92,8 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | public function setCircular($inverted=false){ |
94 | 94 | $invertedStr=""; |
95 | - if($inverted!==false) |
|
96 | - $invertedStr=" inverted"; |
|
95 | + if($inverted!==false) { |
|
96 | + $invertedStr=" inverted"; |
|
97 | + } |
|
97 | 98 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
98 | 99 | } |
99 | 100 | |
@@ -110,8 +111,9 @@ discard block |
||
110 | 111 | */ |
111 | 112 | public function setBordered($inverted=false){ |
112 | 113 | $invertedStr=""; |
113 | - if($inverted!==false) |
|
114 | - $invertedStr=" inverted"; |
|
114 | + if($inverted!==false) { |
|
115 | + $invertedStr=" inverted"; |
|
116 | + } |
|
115 | 117 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
116 | 118 | } |
117 | 119 |
@@ -22,8 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function setAlignement($value="justified"){ |
25 | - if($value!=="justified") |
|
26 | - $value.=" aligned"; |
|
25 | + if($value!=="justified") { |
|
26 | + $value.=" aligned"; |
|
27 | + } |
|
27 | 28 | return $this->addToProperty("class", $value); |
28 | 29 | } |
29 | 30 |
@@ -12,17 +12,17 @@ |
||
12 | 12 | class HtmlContainer extends HtmlSemDoubleElement { |
13 | 13 | |
14 | 14 | public function __construct($identifier, $content="") { |
15 | - parent::__construct($identifier, "div","ui container"); |
|
15 | + parent::__construct($identifier, "div", "ui container"); |
|
16 | 16 | $this->content=$content; |
17 | 17 | } |
18 | 18 | |
19 | - public function setAlignement($value="justified"){ |
|
20 | - if($value!=="justified") |
|
19 | + public function setAlignement($value="justified") { |
|
20 | + if ($value!=="justified") |
|
21 | 21 | $value.=" aligned"; |
22 | 22 | return $this->addToProperty("class", $value); |
23 | 23 | } |
24 | 24 | |
25 | - public function setTextContainer(){ |
|
25 | + public function setTextContainer() { |
|
26 | 26 | return $this->addToProperty("class", "text"); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | parent::__construct($identifier, "div"); |
16 | 16 | $this->setProperty("class", "ui buttons"); |
17 | 17 | $this->content=array(); |
18 | - if($asIcons===true) |
|
19 | - $this->asIcons(); |
|
18 | + if($asIcons===true) { |
|
19 | + $this->asIcons(); |
|
20 | + } |
|
20 | 21 | $this->addElements($elements,$asIcons); |
21 | 22 | } |
22 | 23 | public function addElement($element,$asIcon=false){ |
@@ -25,8 +26,9 @@ discard block |
||
25 | 26 | if($asIcon){ |
26 | 27 | $elementO=new HtmlButton("button-".\sizeof($this->content)); |
27 | 28 | $elementO->asIcon($element); |
28 | - }else |
|
29 | - $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
29 | + } else { |
|
30 | + $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
31 | + } |
|
30 | 32 | } |
31 | 33 | $this->addContent($elementO); |
32 | 34 | } |
@@ -72,9 +74,9 @@ discard block |
||
72 | 74 | * @return HtmlButton |
73 | 75 | */ |
74 | 76 | public function getElement($index) { |
75 | - if (is_int($index)) |
|
76 | - return $this->content[$index]; |
|
77 | - else { |
|
77 | + if (is_int($index)) { |
|
78 | + return $this->content[$index]; |
|
79 | + } else { |
|
78 | 80 | $elm=$this->getElementById($index, $this->content); |
79 | 81 | return $elm; |
80 | 82 | } |
@@ -11,35 +11,35 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class HtmlButtonGroups extends HtmlSemDoubleElement { |
13 | 13 | |
14 | - public function __construct($identifier, $elements=array(),$asIcons=false) { |
|
15 | - parent::__construct($identifier, "div","ui buttons"); |
|
14 | + public function __construct($identifier, $elements=array(), $asIcons=false) { |
|
15 | + parent::__construct($identifier, "div", "ui buttons"); |
|
16 | 16 | $this->content=array(); |
17 | - if($asIcons===true) |
|
17 | + if ($asIcons===true) |
|
18 | 18 | $this->asIcons(); |
19 | - $this->addElements($elements,$asIcons); |
|
19 | + $this->addElements($elements, $asIcons); |
|
20 | 20 | } |
21 | - public function addElement($element,$asIcon=false){ |
|
21 | + public function addElement($element, $asIcon=false) { |
|
22 | 22 | $elementO=$element; |
23 | - if(\is_string($element)){ |
|
24 | - if($asIcon){ |
|
23 | + if (\is_string($element)) { |
|
24 | + if ($asIcon) { |
|
25 | 25 | $elementO=new HtmlButton("button-".\sizeof($this->content)); |
26 | 26 | $elementO->asIcon($element); |
27 | 27 | }else |
28 | - $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
28 | + $elementO=new HtmlButton("button-".\sizeof($this->content), $element); |
|
29 | 29 | } |
30 | 30 | $this->addContent($elementO); |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - public function addElements($elements,$asIcons=false) { |
|
35 | - foreach ( $elements as $element ) { |
|
36 | - $this->addElement($element,$asIcons); |
|
34 | + public function addElements($elements, $asIcons=false) { |
|
35 | + foreach ($elements as $element) { |
|
36 | + $this->addElement($element, $asIcons); |
|
37 | 37 | } |
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | - public function insertOr($aferIndex=0,$or="OR"){ |
|
42 | - $orElement=new HtmlSemDoubleElement("or-".$this->identifier,"div","or"); |
|
41 | + public function insertOr($aferIndex=0, $or="OR") { |
|
42 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
43 | 43 | $orElement->setProperty("data-text", $or); |
44 | 44 | array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
45 | 45 | return $this; |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | $this->addElements($array); |
53 | 53 | } |
54 | 54 | |
55 | - public function asIcons(){ |
|
55 | + public function asIcons() { |
|
56 | 56 | return $this->addToProperty("class", "icons"); |
57 | 57 | } |
58 | 58 | |
59 | - public function setVertical(){ |
|
59 | + public function setVertical() { |
|
60 | 60 | return $this->addToProperty("class", "vertical"); |
61 | 61 | } |
62 | 62 | |
63 | - public function setLabeled(){ |
|
63 | + public function setLabeled() { |
|
64 | 64 | return $this->addToProperty("class", "labeled icon"); |
65 | 65 | } |
66 | 66 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
89 | 89 | */ |
90 | 90 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
91 | - foreach ( $this->content as $element ) { |
|
91 | + foreach ($this->content as $element) { |
|
92 | 92 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
93 | 93 | } |
94 | 94 | return $this; |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use Ajax\common\JsCode; |
7 | 7 | |
8 | 8 | class SimpleBsComponent extends SimpleComponent { |
9 | - protected $events=array (); |
|
10 | - protected $jsCodes=array (); |
|
9 | + protected $events=array(); |
|
10 | + protected $jsCodes=array(); |
|
11 | 11 | |
12 | 12 | public function addEvent($event, $jsCode) { |
13 | 13 | $this->events [$event]=$jsCode; |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | public function getScript() { |
17 | 17 | parent::getScript(); |
18 | - foreach ( $this->jsCodes as $jsCode ) { |
|
19 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
18 | + foreach ($this->jsCodes as $jsCode) { |
|
19 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
20 | 20 | "identifier" => $this->attachTo |
21 | 21 | )); |
22 | 22 | } |