@@ -48,6 +48,9 @@ |
||
48 | 48 | $element->setStyle($value); |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param HtmlDropdown $bt |
|
53 | + */ |
|
51 | 54 | private function dropdownAsButton($bt) { |
52 | 55 | $this->addExistingDropDown($bt); |
53 | 56 | $bt->setTagName("button"); |
@@ -44,8 +44,9 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | public function setStyle($value) { |
47 | - foreach ( $this->elements as $element ) |
|
48 | - $element->setStyle($value); |
|
47 | + foreach ( $this->elements as $element ) { |
|
48 | + $element->setStyle($value); |
|
49 | + } |
|
49 | 50 | } |
50 | 51 | |
51 | 52 | private function dropdownAsButton($bt) { |
@@ -70,16 +71,18 @@ discard block |
||
70 | 71 | } elseif ($element instanceof HtmlButton) { |
71 | 72 | $this->elements[]=$element; |
72 | 73 | } elseif (is_array($element)) { |
73 | - if (array_key_exists("glyph", $element)) |
|
74 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
75 | - elseif (array_key_exists("btnCaption", $element)) { |
|
76 | - if (array_key_exists("split", $element)) |
|
77 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
78 | - else |
|
79 | - $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
74 | + if (array_key_exists("glyph", $element)) { |
|
75 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
76 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
77 | + if (array_key_exists("split", $element)) { |
|
78 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
79 | + } else { |
|
80 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
81 | + } |
|
80 | 82 | $this->dropdownAsButton($bt); |
81 | - } else |
|
82 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
83 | + } else { |
|
84 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
85 | + } |
|
83 | 86 | $bt->fromArray($element); |
84 | 87 | $this->elements[]=$bt; |
85 | 88 | $result=$bt; |
@@ -110,8 +113,9 @@ discard block |
||
110 | 113 | public function setAlignment($value) { |
111 | 114 | if (is_int($value)) { |
112 | 115 | $value=CssRef::alignment("btn-group")[$value]; |
113 | - } else |
|
114 | - $value="btn-group-".$value; |
|
116 | + } else { |
|
117 | + $value="btn-group-".$value; |
|
118 | + } |
|
115 | 119 | if (strstr($value, "justified")) { |
116 | 120 | foreach ( $this->elements as $element ) { |
117 | 121 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -126,9 +130,9 @@ discard block |
||
126 | 130 | * @return HtmlButton |
127 | 131 | */ |
128 | 132 | public function getElement($index) { |
129 | - if (is_int($index)) |
|
130 | - return $this->elements[$index]; |
|
131 | - else { |
|
133 | + if (is_int($index)) { |
|
134 | + return $this->elements[$index]; |
|
135 | + } else { |
|
132 | 136 | $elm=$this->getElementById($index, $this->elements); |
133 | 137 | return $elm; |
134 | 138 | } |
@@ -11,6 +11,11 @@ discard block |
||
11 | 11 | |
12 | 12 | class HtmlButtontoolbar extends HtmlButtongroups { |
13 | 13 | |
14 | + /** |
|
15 | + * @param string $identifier |
|
16 | + * @param string $cssStyle |
|
17 | + * @param string $size |
|
18 | + */ |
|
14 | 19 | public function __construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div") { |
15 | 20 | parent::__construct($identifier, $elements, $cssStyle, $size, $tagName); |
16 | 21 | $this->setClass("btn-toolbar"); |
@@ -56,7 +61,7 @@ discard block |
||
56 | 61 | |
57 | 62 | /** |
58 | 63 | * return the Buttongroups at position $index |
59 | - * @return \Ajax\bootstrap\html\HtmlButtongroups |
|
64 | + * @return HtmlButton |
|
60 | 65 | */ |
61 | 66 | public function getGroup($index) { |
62 | 67 | return parent::getElement($index); |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | private function getLastButtonGroup() { |
47 | 47 | $nb=sizeof($this->elements); |
48 | - if ($nb>0) |
|
49 | - $bg=$this->elements [$nb-1]; |
|
50 | - else { |
|
48 | + if ($nb>0) { |
|
49 | + $bg=$this->elements [$nb-1]; |
|
50 | + } else { |
|
51 | 51 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
52 | 52 | $this->elements []=$bg; |
53 | 53 | } |
@@ -65,8 +65,9 @@ discard block |
||
65 | 65 | public function getLastGroup() { |
66 | 66 | $bg=null; |
67 | 67 | $nb=sizeof($this->elements); |
68 | - if ($nb>0) |
|
69 | - $bg=$this->elements [$nb-1]; |
|
68 | + if ($nb>0) { |
|
69 | + $bg=$this->elements [$nb-1]; |
|
70 | + } |
|
70 | 71 | return $bg; |
71 | 72 | } |
72 | 73 |
@@ -23,6 +23,9 @@ discard block |
||
23 | 23 | protected $_base=""; |
24 | 24 | protected $_glyphs=array (); |
25 | 25 | |
26 | + /** |
|
27 | + * @param string $identifier |
|
28 | + */ |
|
26 | 29 | public function __construct($identifier, $images=NULL) { |
27 | 30 | parent::__construct($identifier); |
28 | 31 | $this->_template=include 'templates/tplCarousel.php'; |
@@ -61,7 +64,7 @@ discard block |
||
61 | 64 | * |
62 | 65 | * @param string $caption |
63 | 66 | * @param string $sens |
64 | - * @return HtmlCarouselControl|string |
|
67 | + * @return HtmlCarouselControl |
|
65 | 68 | */ |
66 | 69 | private function createControl($caption="next", $sens="left") { |
67 | 70 | $control=new HtmlCarouselControl($sens."-ctrl-".$this->identifier); |
@@ -75,27 +75,30 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | private function getGlyph($sens="left") { |
78 | - if (array_key_exists($sens, $this->_glyphs)) |
|
79 | - return $this->_glyphs [$sens]; |
|
78 | + if (array_key_exists($sens, $this->_glyphs)) { |
|
79 | + return $this->_glyphs [$sens]; |
|
80 | + } |
|
80 | 81 | return "glyphicon-chevron-".$sens; |
81 | 82 | } |
82 | 83 | |
83 | 84 | public function setRightGlyph($glyphicon) { |
84 | 85 | $glyphs=CssRef::glyphIcons(); |
85 | - if (array_search($glyphicon, $glyphs)!==false) |
|
86 | - $this->_glyphs ["right"]=$glyphicon; |
|
86 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
87 | + $this->_glyphs ["right"]=$glyphicon; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | public function setLeftGlyph($glyphicon) { |
90 | 92 | $glyphs=CssRef::glyphIcons(); |
91 | - if (array_search($glyphicon, $glyphs)!==false) |
|
92 | - $this->_glyphs ["left"]=$glyphicon; |
|
93 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
94 | + $this->_glyphs ["left"]=$glyphicon; |
|
95 | + } |
|
93 | 96 | } |
94 | 97 | |
95 | 98 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
96 | 99 | if(is_array($imageSrc)){ |
97 | 100 | $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
98 | - }else{ |
|
101 | + } else{ |
|
99 | 102 | $image=new HtmlCarouselItem("item-".$this->identifier); |
100 | 103 | $image->setImageSrc($this->_base.$imageSrc); |
101 | 104 | $image->setImageAlt($imageAlt); |
@@ -87,6 +87,9 @@ |
||
87 | 87 | return $result; |
88 | 88 | } |
89 | 89 | |
90 | + /** |
|
91 | + * @return string |
|
92 | + */ |
|
90 | 93 | private function getPrefix($element) { |
91 | 94 | $result="input_text"; |
92 | 95 | foreach ( $this->formElementsPrefix as $k => $v ) { |
@@ -99,8 +99,9 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | public function addGroup($identifier="") { |
102 | - if ($identifier==="") |
|
103 | - $identifier="form-".$this->identifier; |
|
102 | + if ($identifier==="") { |
|
103 | + $identifier="form-".$this->identifier; |
|
104 | + } |
|
104 | 105 | $group=new HtmlDoubleElement($identifier); |
105 | 106 | $group->setTagName("div"); |
106 | 107 | $group->setClass("form-group"); |
@@ -20,6 +20,9 @@ |
||
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + */ |
|
23 | 26 | public function __construct($identifier, $tagName="ul") { |
24 | 27 | parent::__construct($identifier, $tagName); |
25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
38 | - } else |
|
39 | - $this->tabs []=$tab; |
|
38 | + } else { |
|
39 | + $this->tabs []=$tab; |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | public function setActive($index){ |
@@ -116,9 +117,9 @@ discard block |
||
116 | 117 | public function createTabContents() { |
117 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
118 | 119 | foreach ( $this->tabs as $tab ) { |
119 | - if ($tab instanceof HtmlTabItem) |
|
120 | - $tabContent->addTabItem($tab->getHref()); |
|
121 | - elseif ($tab instanceof HtmlDropdown) { |
|
120 | + if ($tab instanceof HtmlTabItem) { |
|
121 | + $tabContent->addTabItem($tab->getHref()); |
|
122 | + } elseif ($tab instanceof HtmlDropdown) { |
|
122 | 123 | foreach ( $tab->getItems() as $dropdownItem ) { |
123 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
124 | 125 | } |
@@ -137,8 +138,9 @@ discard block |
||
137 | 138 | |
138 | 139 | public function setContentToTab($index, $text) { |
139 | 140 | $tabContentItem=$this->content->getTabItem($index); |
140 | - if (isset($tabContentItem)) |
|
141 | - $tabContentItem->setContent($text); |
|
141 | + if (isset($tabContentItem)) { |
|
142 | + $tabContentItem->setContent($text); |
|
143 | + } |
|
142 | 144 | } |
143 | 145 | |
144 | 146 | public function countTabs() { |
@@ -146,8 +148,9 @@ discard block |
||
146 | 148 | } |
147 | 149 | |
148 | 150 | public function getTabItem($index) { |
149 | - if ($index<sizeof($this->content->get)) |
|
150 | - return $this->content; |
|
151 | + if ($index<sizeof($this->content->get)) { |
|
152 | + return $this->content; |
|
153 | + } |
|
151 | 154 | } |
152 | 155 | |
153 | 156 | public function fadeEffect() { |
@@ -168,9 +171,11 @@ discard block |
||
168 | 171 | } |
169 | 172 | |
170 | 173 | public function setStacked($stacked=true){ |
171 | - if($stacked) |
|
172 | - $this->stacked="nav-stacked"; |
|
173 | - else $this->stacked=""; |
|
174 | + if($stacked) { |
|
175 | + $this->stacked="nav-stacked"; |
|
176 | + } else { |
|
177 | + $this->stacked=""; |
|
178 | + } |
|
174 | 179 | } |
175 | 180 | |
176 | 181 | /* (non-PHPdoc) |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function getTab($index) { |
38 | - if ($index>0&&$index<sizeof($this->tabs)) |
|
39 | - return $this->tabs [$index]; |
|
38 | + if ($index>0&&$index<sizeof($this->tabs)) { |
|
39 | + return $this->tabs [$index]; |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | public function show($index) { |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | */ |
53 | 54 | public function onShow($index, $jsCode) { |
54 | 55 | $tab=$this->getTab($index); |
55 | - if (isset($tab)) |
|
56 | - return $tab->onShow($jsCode); |
|
56 | + if (isset($tab)) { |
|
57 | + return $tab->onShow($jsCode); |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | |
59 | 61 | /** |
@@ -64,8 +66,9 @@ discard block |
||
64 | 66 | */ |
65 | 67 | public function onShown($index, $jsCode) { |
66 | 68 | $tab=$this->getTab($index); |
67 | - if (isset($tab)) |
|
68 | - return $tab->onShown($jsCode); |
|
69 | + if (isset($tab)) { |
|
70 | + return $tab->onShown($jsCode); |
|
71 | + } |
|
69 | 72 | } |
70 | 73 | |
71 | 74 | /** |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | */ |
77 | 80 | public function onHide($index, $jsCode) { |
78 | 81 | $tab=$this->getTab($index); |
79 | - if (isset($tab)) |
|
80 | - return $tab->onShow($jsCode); |
|
82 | + if (isset($tab)) { |
|
83 | + return $tab->onShow($jsCode); |
|
84 | + } |
|
81 | 85 | } |
82 | 86 | |
83 | 87 | /** |
@@ -88,7 +92,8 @@ discard block |
||
88 | 92 | */ |
89 | 93 | public function onHidden($index, $jsCode) { |
90 | 94 | $tab=$this->getTab($index); |
91 | - if (isset($tab)) |
|
92 | - return $tab->onShow($jsCode); |
|
95 | + if (isset($tab)) { |
|
96 | + return $tab->onShow($jsCode); |
|
97 | + } |
|
93 | 98 | } |
94 | 99 | } |
95 | 100 | \ No newline at end of file |
@@ -77,7 +77,8 @@ |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function getPanel($index) { |
80 | - if ($index<sizeof($this->content)) |
|
81 | - return $this->content [$index]; |
|
80 | + if ($index<sizeof($this->content)) { |
|
81 | + return $this->content [$index]; |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | } |
84 | 85 | \ No newline at end of file |
@@ -24,17 +24,19 @@ discard block |
||
24 | 24 | |
25 | 25 | public function attachTo($identifier) { |
26 | 26 | $this->element->setProperty("aria-controls", $identifier); |
27 | - if ($this->element->getTagName()==="a") |
|
28 | - $this->element->setProperty("href", "#".$identifier); |
|
29 | - else |
|
30 | - $this->element->setProperty("data-target", "#".$identifier); |
|
27 | + if ($this->element->getTagName()==="a") { |
|
28 | + $this->element->setProperty("href", "#".$identifier); |
|
29 | + } else { |
|
30 | + $this->element->setProperty("data-target", "#".$identifier); |
|
31 | + } |
|
31 | 32 | } |
32 | 33 | |
33 | 34 | public function getAttachedZone() { |
34 | 35 | $id=$this->element->getProperty("aria-controls"); |
35 | - if (!isset($id)) |
|
36 | - if ($this->element->getTagName()==="a") |
|
36 | + if (!isset($id)) { |
|
37 | + if ($this->element->getTagName()==="a") |
|
37 | 38 | $id=$this->element->getProperty("href"); |
39 | + } |
|
38 | 40 | if (!isset($id)||$id==="#") { |
39 | 41 | $id="collapse-".$this->element->getIdentifier(); |
40 | 42 | $this->attachTo($id); |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | } |
50 | 52 | |
51 | 53 | public function createCollapsedZone($content="", $attachTo=NULL) { |
52 | - if (isset($attachTo)) |
|
53 | - $this->attachTo($attachTo); |
|
54 | + if (isset($attachTo)) { |
|
55 | + $this->attachTo($attachTo); |
|
56 | + } |
|
54 | 57 | $collapsedZone=new HtmlDoubleElement($this->getAttachedZone()); |
55 | 58 | $collapsedZone->setProperty("class", "collapse"); |
56 | 59 | $collapsedZone->setContent($content); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function addItem($caption, $href="#") { |
90 | 90 | if($caption instanceof HtmlDropdownItem){ |
91 | 91 | $item=$caption; |
92 | - }else{ |
|
92 | + } else{ |
|
93 | 93 | $iid=$this->getItemsCount()+1; |
94 | 94 | $item=new HtmlDropdownItem($this->identifier."-dropdown-item-".$iid); |
95 | 95 | $item->setCaption($caption)->setHref($href); |
@@ -129,10 +129,11 @@ discard block |
||
129 | 129 | * @see BaseHtml::fromArray() |
130 | 130 | */ |
131 | 131 | public function fromArray($array) { |
132 | - if (array_keys($array)!==range(0, count($array)-1)) |
|
133 | - return parent::fromArray($array); |
|
134 | - else |
|
135 | - return $this->addItems($array); |
|
132 | + if (array_keys($array)!==range(0, count($array)-1)) { |
|
133 | + return parent::fromArray($array); |
|
134 | + } else { |
|
135 | + return $this->addItems($array); |
|
136 | + } |
|
136 | 137 | } |
137 | 138 | |
138 | 139 | public function setItems($items) { |
@@ -185,8 +186,9 @@ discard block |
||
185 | 186 | * @see \Ajax\bootstrap\html\BaseHtml::setTagName() |
186 | 187 | */ |
187 | 188 | public function setTagName($tagName) { |
188 | - if ($tagName=="button") |
|
189 | - $this->class="btn dropdown-toggle"; |
|
189 | + if ($tagName=="button") { |
|
190 | + $this->class="btn dropdown-toggle"; |
|
191 | + } |
|
190 | 192 | return parent::setTagName($tagName); |
191 | 193 | } |
192 | 194 | |
@@ -204,8 +206,9 @@ discard block |
||
204 | 206 | } |
205 | 207 | |
206 | 208 | public function setAlignment($alignment) { |
207 | - if (is_int($alignment)) |
|
208 | - $alignment="dropdown-menu-".CssRef::alignment()[$alignment]; |
|
209 | + if (is_int($alignment)) { |
|
210 | + $alignment="dropdown-menu-".CssRef::alignment()[$alignment]; |
|
211 | + } |
|
209 | 212 | return $this->addToMemberCtrl($this->class, $alignment, CssRef::alignment()); |
210 | 213 | } |
211 | 214 |
@@ -22,6 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * |
24 | 24 | * @param string $identifier the id |
25 | + * @param string $cssStyle |
|
25 | 26 | */ |
26 | 27 | public function __construct($identifier, $value="", $items=array(), $cssStyle=null, $onClick=null) { |
27 | 28 | parent::__construct($identifier, "", $cssStyle, $onClick); |
@@ -45,7 +46,7 @@ discard block |
||
45 | 46 | /** |
46 | 47 | * define the button style |
47 | 48 | * avaible values : "btn-default","btn-primary","btn-success","btn-info","btn-warning","btn-danger" |
48 | - * @param string|int $cssStyle |
|
49 | + * @param string $cssStyle |
|
49 | 50 | * @return \Ajax\bootstrap\html\HtmlDropdown default : "btn-default" |
50 | 51 | */ |
51 | 52 | public function setStyle($cssStyle) { |
@@ -149,10 +150,16 @@ discard block |
||
149 | 150 | return $this->items [$index]; |
150 | 151 | } |
151 | 152 | |
153 | + /** |
|
154 | + * @param string $value |
|
155 | + */ |
|
152 | 156 | public function setBtnClass($value) { |
153 | 157 | $this->class=$value; |
154 | 158 | } |
155 | 159 | |
160 | + /** |
|
161 | + * @param string $value |
|
162 | + */ |
|
156 | 163 | public function setMClass($value) { |
157 | 164 | $this->mClass=$value; |
158 | 165 | } |
@@ -183,6 +190,7 @@ discard block |
||
183 | 190 | /** |
184 | 191 | * Sets the tagName's dropdown |
185 | 192 | * @see \Ajax\bootstrap\html\BaseHtml::setTagName() |
193 | + * @param string $tagName |
|
186 | 194 | */ |
187 | 195 | public function setTagName($tagName) { |
188 | 196 | if ($tagName=="button") |
@@ -194,6 +202,9 @@ discard block |
||
194 | 202 | return $this->compile(); |
195 | 203 | } |
196 | 204 | |
205 | + /** |
|
206 | + * @param string $btnCaption |
|
207 | + */ |
|
197 | 208 | public function setBtnCaption($btnCaption) { |
198 | 209 | $this->btnCaption=$btnCaption; |
199 | 210 | return $this; |