1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax; |
4
|
|
|
|
5
|
|
|
use Ajax\common\BaseGui; |
6
|
|
|
use Ajax\bootstrap\components\Modal; |
7
|
|
|
use Ajax\bootstrap\components\Tooltip; |
8
|
|
|
use Ajax\bootstrap\components\Dropdown; |
9
|
|
|
use Ajax\bootstrap\components\Tab; |
10
|
|
|
use Ajax\bootstrap\components\Collapse; |
11
|
|
|
use Ajax\bootstrap\components\Carousel; |
12
|
|
|
use Ajax\bootstrap\components\GenericComponent; |
13
|
|
|
use Ajax\bootstrap\html\HtmlButton; |
14
|
|
|
use Ajax\bootstrap\html\HtmlButtongroups; |
15
|
|
|
use Ajax\bootstrap\html\HtmlGlyphButton; |
16
|
|
|
use Ajax\bootstrap\html\HtmlDropdown; |
17
|
|
|
use Ajax\bootstrap\components\Splitbutton; |
18
|
|
|
use Ajax\bootstrap\html\HtmlButtontoolbar; |
19
|
|
|
use Ajax\bootstrap\html\HtmlNavbar; |
20
|
|
|
use Ajax\bootstrap\html\HtmlProgressbar; |
21
|
|
|
use Ajax\bootstrap\components\Popover; |
22
|
|
|
use Ajax\bootstrap\html\HtmlPanel; |
23
|
|
|
use Ajax\bootstrap\html\HtmlAlert; |
24
|
|
|
use Ajax\bootstrap\html\HtmlAccordion; |
25
|
|
|
use Ajax\bootstrap\html\HtmlCarousel; |
26
|
|
|
use Ajax\bootstrap\html\HtmlTabs; |
27
|
|
|
use Ajax\bootstrap\html\HtmlModal; |
28
|
|
|
use Ajax\bootstrap\html\HtmlSplitbutton; |
29
|
|
|
use Ajax\bootstrap\html\HtmlInputgroup; |
30
|
|
|
use Ajax\bootstrap\html\HtmlListgroup; |
31
|
|
|
use Ajax\bootstrap\html\HtmlBreadcrumbs; |
32
|
|
|
use Ajax\bootstrap\html\HtmlPagination; |
33
|
|
|
|
34
|
|
|
class Bootstrap extends BaseGui { |
|
|
|
|
35
|
|
|
|
36
|
|
|
public function __construct($autoCompile=true) { |
|
|
|
|
37
|
|
|
parent::__construct($autoCompile); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* |
42
|
|
|
* @param string $attachTo |
43
|
|
|
* @param string|array $params |
44
|
|
|
* @return $this |
45
|
|
|
*/ |
46
|
|
|
public function generic($attachTo=NULL, $params=NULL) { |
47
|
|
|
return $this->addComponent(new GenericComponent($this->js), $attachTo, $params); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* |
52
|
|
|
* @param string $attachTo |
53
|
|
|
* @param string|array $params |
54
|
|
|
* @return $this |
55
|
|
|
*/ |
56
|
|
|
public function modal($attachTo=NULL, $params=NULL) { |
57
|
|
|
return $this->addComponent(new Modal($this->js), $attachTo, $params); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* |
62
|
|
|
* @param string $attachTo |
63
|
|
|
* @param string|array $params |
64
|
|
|
* @return $this |
65
|
|
|
*/ |
66
|
|
|
public function tooltip($attachTo=NULL, $params=NULL) { |
67
|
|
|
return $this->addComponent(new Tooltip($this->js), $attachTo, $params); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* |
72
|
|
|
* @param string $attachTo |
73
|
|
|
* @param string|array $params |
74
|
|
|
* @return $this |
75
|
|
|
*/ |
76
|
|
|
public function popover($attachTo=NULL, $params=NULL) { |
77
|
|
|
return $this->addComponent(new Popover($this->js), $attachTo, $params); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* |
82
|
|
|
* @param string $attachTo |
83
|
|
|
* @param string|array $params |
84
|
|
|
* @return $this |
85
|
|
|
*/ |
86
|
|
|
public function dropdown($attachTo=NULL, $params=NULL) { |
87
|
|
|
return $this->addComponent(new Dropdown($this->js), $attachTo, $params); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* |
92
|
|
|
* @param string $attachTo |
93
|
|
|
* @param string|array $params |
94
|
|
|
* @return $this |
95
|
|
|
*/ |
96
|
|
|
public function splitbutton($attachTo=NULL, $params=NULL) { |
97
|
|
|
return $this->addComponent(new Splitbutton($this->js), $attachTo, $params); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* |
102
|
|
|
* @param string $attachTo |
103
|
|
|
* @param string|array $params |
104
|
|
|
* @return $this |
105
|
|
|
*/ |
106
|
|
|
public function tab($attachTo=NULL, $params=NULL) { |
107
|
|
|
return $this->addComponent(new Tab($this->js), $attachTo, $params); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* |
112
|
|
|
* @param string $attachTo |
113
|
|
|
* @param string|array $params |
114
|
|
|
* @return $this |
115
|
|
|
*/ |
116
|
|
|
public function collapse($attachTo=NULL, $params=NULL) { |
117
|
|
|
return $this->addComponent(new Collapse($this->js), $attachTo, $params); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* |
122
|
|
|
* @param string $attachTo |
123
|
|
|
* @param string|array $params |
124
|
|
|
* @return $this |
125
|
|
|
*/ |
126
|
|
|
public function carousel($attachTo=NULL, $params=NULL) { |
127
|
|
|
return $this->addComponent(new Carousel($this->js), $attachTo, $params); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Return a new Bootstrap Html Button |
132
|
|
|
* @param string $identifier |
133
|
|
|
* @param string $value |
134
|
|
|
* @param string $cssStyle |
135
|
|
|
* @param string $onClick |
136
|
|
|
* @return HtmlButton |
137
|
|
|
*/ |
138
|
|
|
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { |
139
|
|
|
return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Return a new Bootstrap Html Glyphbutton |
144
|
|
|
* @param string $identifier |
145
|
|
|
* @param mixed $glyphIcon |
146
|
|
|
* @param string $value |
147
|
|
|
* @param string $cssStyle |
148
|
|
|
* @param string $onClick |
149
|
|
|
* @return HtmlGlyphButton |
150
|
|
|
*/ |
151
|
|
|
public function htmlGlyphButton($identifier, $glyphIcon=0, $value="", $cssStyle=NULL, $onClick=NULL) { |
152
|
|
|
return $this->addHtmlComponent(new HtmlGlyphButton($identifier, $glyphIcon, $value, $cssStyle, $onClick)); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Return a new Bootstrap Html Buttongroups |
157
|
|
|
* @param string $identifier |
158
|
|
|
* @param array $values |
159
|
|
|
* @param string $cssStyle |
160
|
|
|
* @param string $size |
161
|
|
|
* @return HtmlButtongroups |
162
|
|
|
*/ |
163
|
|
|
public function htmlButtongroups($identifier, $values=array(), $cssStyle=NULL, $size=NULL) { |
164
|
|
|
return $this->addHtmlComponent(new HtmlButtongroups($identifier, $values, $cssStyle, $size)); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Return a new Bootstrap Html Dropdown |
169
|
|
|
* @param string $identifier |
170
|
|
|
* @param array $items |
171
|
|
|
* @param string $cssStyle |
172
|
|
|
* @param string $size |
173
|
|
|
* @return HtmlDropdown |
174
|
|
|
*/ |
175
|
|
|
public function htmlDropdown($identifier, $value="", $items=array(), $cssStyle=NULL, $size=NULL) { |
176
|
|
|
return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items, $cssStyle, $size)); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Return a new Bootstrap Html Dropdown |
181
|
|
|
* @param string $identifier |
182
|
|
|
* @param array $elements |
183
|
|
|
* @param string $cssStyle |
184
|
|
|
* @param string $size |
185
|
|
|
* @return HtmlButtontoolbar |
186
|
|
|
*/ |
187
|
|
|
public function htmlButtontoolbar($identifier, $elements=array(), $cssStyle=NULL, $size=NULL) { |
188
|
|
|
return $this->addHtmlComponent(new HtmlButtontoolbar($identifier, $elements, $cssStyle, $size)); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Return a new Bootstrap Html Navbar |
193
|
|
|
* @param string $identifier |
194
|
|
|
* @param string $brand |
195
|
|
|
* @param string $brandHref |
196
|
|
|
* @return HtmlNavbar |
197
|
|
|
*/ |
198
|
|
|
public function htmlNavbar($identifier, $brand="Brand", $brandHref="#") { |
199
|
|
|
return $this->addHtmlComponent(new HtmlNavbar($identifier, $brand, $brandHref)); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Return a new Bootstrap Html Progressbar |
204
|
|
|
* @param string $identifier |
205
|
|
|
* @param string $value |
206
|
|
|
* @param string $max |
207
|
|
|
* @param string $min |
208
|
|
|
* @return HtmlProgressbar |
209
|
|
|
*/ |
210
|
|
|
public function htmlProgressbar($identifier, $style="info", $value=0, $max=100, $min=0) { |
211
|
|
|
return $this->addHtmlComponent(new HtmlProgressbar($identifier, $style, $value, $max, $min)); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Return a new Bootstrap Html Panel |
216
|
|
|
* @param string $identifier the Html identifier of the element |
217
|
|
|
* @param mixed $content the panel content (string or HtmlComponent) |
218
|
|
|
* @param string $header the header |
219
|
|
|
* @param string $footer the footer |
220
|
|
|
* @return HtmlPanel |
221
|
|
|
*/ |
222
|
|
|
public function htmlPanel($identifier, $content=NULL, $header=NULL, $footer=NULL) { |
223
|
|
|
return $this->addHtmlComponent(new HtmlPanel($identifier, $content, $header, $footer)); |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Return a new Bootstrap Html Alert |
228
|
|
|
* @param string $identifier |
229
|
|
|
* @param string $message |
230
|
|
|
* @param string $cssStyle |
231
|
|
|
* @return HtmlAlert |
232
|
|
|
*/ |
233
|
|
|
public function htmlAlert($identifier, $message=NULL, $cssStyle="alert-warning") { |
234
|
|
|
return $this->addHtmlComponent(new HtmlAlert($identifier, $message, $cssStyle)); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* Return a new Bootstrap Accordion |
239
|
|
|
* @param string $identifier |
240
|
|
|
* @return HtmlAccordion |
241
|
|
|
*/ |
242
|
|
|
public function htmlAccordion($identifier) { |
243
|
|
|
return $this->addHtmlComponent(new HtmlAccordion($identifier)); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* Return a new Bootstrap Html Carousel |
248
|
|
|
* @param string $identifier |
249
|
|
|
* @param array $images [(src=>"",alt=>"",caption=>"",description=>""),...] |
250
|
|
|
* @return HtmlCarousel |
251
|
|
|
*/ |
252
|
|
|
public function htmlCarousel($identifier, $images=NULL) { |
253
|
|
|
return $this->addHtmlComponent(new HtmlCarousel($identifier, $images)); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Return a new Bootstrap Html tabs |
258
|
|
|
* @param string $identifier |
259
|
|
|
* @return HtmlTabs |
260
|
|
|
*/ |
261
|
|
|
public function htmlTabs($identifier) { |
262
|
|
|
return $this->addHtmlComponent(new HtmlTabs($identifier)); |
263
|
|
|
} |
264
|
|
|
/** |
265
|
|
|
* Return a new Bootstrap Html listGroup |
266
|
|
|
* @param string $identifier |
267
|
|
|
* @param array $items array of items to add |
268
|
|
|
* @param string $tagName container tagName |
269
|
|
|
* @return HtmlListgroup |
270
|
|
|
*/ |
271
|
|
|
public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
272
|
|
|
$listGroup=new HtmlListgroup($identifier,$tagName); |
273
|
|
|
$listGroup->addItems($items); |
274
|
|
|
return $this->addHtmlComponent($listGroup); |
275
|
|
|
} |
276
|
|
|
/** |
277
|
|
|
* Return a new Bootstrap Html modal dialog |
278
|
|
|
* @param string $identifier |
279
|
|
|
* @param string $title |
280
|
|
|
* @param string $content |
281
|
|
|
* @param array $buttonCaptions |
282
|
|
|
* @return HtmlModal |
283
|
|
|
*/ |
284
|
|
|
public function htmlModal($identifier, $title="", $content="", $buttonCaptions=array()) { |
285
|
|
|
return $this->addHtmlComponent(new HtmlModal($identifier, $title, $content, $buttonCaptions)); |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* Return a new Bootstrap Html SplitButton |
290
|
|
|
* @param string $identifier |
291
|
|
|
* @param string $value |
292
|
|
|
* @param array $items |
293
|
|
|
* @param string $cssStyle |
294
|
|
|
* @param string $onClick |
295
|
|
|
* @return HtmlSplitbutton |
296
|
|
|
*/ |
297
|
|
|
public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
298
|
|
|
return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Return a new Bootstrap Html InputGroup |
303
|
|
|
* @param string $identifier |
304
|
|
|
* @return HtmlInputgroup |
305
|
|
|
*/ |
306
|
|
|
public function htmlInputgroup($identifier){ |
307
|
|
|
return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* Return a new Bootstrap Html Breadcrumbs |
312
|
|
|
* @param string $identifier |
313
|
|
|
* @param array $elements |
314
|
|
|
* @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true |
315
|
|
|
* @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
316
|
|
|
* @return HtmlBreadcrumbs |
317
|
|
|
*/ |
318
|
|
|
public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$hrefFunction=NULL){ |
319
|
|
|
return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$hrefFunction)); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Return a new Bootstrap Html Pagination |
324
|
|
|
* @see http://getbootstrap.com/components/#pagination |
325
|
|
|
* @param string $identifier |
326
|
|
|
* @param int $from default : 1 |
327
|
|
|
* @param int $to default : 1 |
328
|
|
|
* @param int $active The active page |
329
|
|
|
* @return HtmlPagination |
330
|
|
|
*/ |
331
|
|
|
public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
332
|
|
|
return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
333
|
|
|
} |
334
|
|
|
} |