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