1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax\bootstrap\html\base; |
4
|
|
|
|
5
|
|
|
use Ajax\service\JString; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Default HTML values for Twitter Bootstrap HTML components |
9
|
|
|
* @author jc |
10
|
|
|
* @version 1.001 |
11
|
|
|
*/ |
12
|
|
|
class CssRef { |
13
|
|
|
const CSS_DEFAULT="-default", CSS_PRIMARY="-primary", CSS_SUCCESS="-success", CSS_INFO="-info", CSS_WARNING="-warning", CSS_DANGER="-danger", CSS_LINK="-link"; |
14
|
|
|
|
15
|
|
|
public static function buttonStyles() { |
16
|
|
|
return array ( |
17
|
|
|
"btn-default", |
18
|
|
|
"btn-primary", |
19
|
|
|
"btn-success", |
20
|
|
|
"btn-info", |
21
|
|
|
"btn-warning", |
22
|
|
|
"btn-danger", |
23
|
|
|
"btn-link" |
24
|
|
|
); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public static function Styles($prefix="btn") { |
28
|
|
|
return array ( |
29
|
|
|
$prefix."-default", |
30
|
|
|
$prefix."-primary", |
31
|
|
|
$prefix."-success", |
32
|
|
|
$prefix."-info", |
33
|
|
|
$prefix."-warning", |
34
|
|
|
$prefix."-danger" |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public static function sizes($prefix="btn") { |
39
|
|
|
return array ( |
40
|
|
|
$prefix."-lg", |
41
|
|
|
"", |
42
|
|
|
$prefix."-sm", |
43
|
|
|
$prefix."-xs" |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public static function position() { |
48
|
|
|
return array ( |
49
|
|
|
"top", |
50
|
|
|
"left", |
51
|
|
|
"right", |
52
|
|
|
"bottom", |
53
|
|
|
"auto" |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public static function alignment($prefix="") { |
58
|
|
|
return array ( |
59
|
|
|
$prefix."", |
60
|
|
|
$prefix."left", |
61
|
|
|
$prefix."right", |
62
|
|
|
$prefix."vertical", |
63
|
|
|
$prefix."justified" |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public static function navbarZoneClasses() { |
68
|
|
|
return array ( |
69
|
|
|
"navbar-nav", |
70
|
|
|
"navbar-left", |
71
|
|
|
"navbar-right", |
72
|
|
|
"navbar-form" |
73
|
|
|
); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public static function glyphIcons() { |
77
|
|
|
return array ( |
78
|
|
|
"glyphicon-asterisk", |
79
|
|
|
"glyphicon-plus", |
80
|
|
|
"glyphicon-euro", |
81
|
|
|
"glyphicon-eur", |
82
|
|
|
"glyphicon-minus", |
83
|
|
|
"glyphicon-cloud", |
84
|
|
|
"glyphicon-envelope", |
85
|
|
|
"glyphicon-pencil", |
86
|
|
|
"glyphicon-glass", |
87
|
|
|
"glyphicon-music", |
88
|
|
|
"glyphicon-search", |
89
|
|
|
"glyphicon-heart", |
90
|
|
|
"glyphicon-star", |
91
|
|
|
"glyphicon-star-empty", |
92
|
|
|
"glyphicon-user", |
93
|
|
|
"glyphicon-film", |
94
|
|
|
"glyphicon-th-large", |
95
|
|
|
"glyphicon-th", |
96
|
|
|
"glyphicon-th-list", |
97
|
|
|
"glyphicon-ok", |
98
|
|
|
"glyphicon-remove", |
99
|
|
|
"glyphicon-zoom-in", |
100
|
|
|
"glyphicon-zoom-out", |
101
|
|
|
"glyphicon-off", |
102
|
|
|
"glyphicon-signal", |
103
|
|
|
"glyphicon-cog", |
104
|
|
|
"glyphicon-trash", |
105
|
|
|
"glyphicon-home", |
106
|
|
|
"glyphicon-file", |
107
|
|
|
"glyphicon-time", |
108
|
|
|
"glyphicon-road", |
109
|
|
|
"glyphicon-download-alt", |
110
|
|
|
"glyphicon-download", |
111
|
|
|
"glyphicon-upload", |
112
|
|
|
"glyphicon-inbox", |
113
|
|
|
"glyphicon-play-circle", |
114
|
|
|
"glyphicon-repeat", |
115
|
|
|
"glyphicon-refresh", |
116
|
|
|
"glyphicon-list-alt", |
117
|
|
|
"glyphicon-lock", |
118
|
|
|
"glyphicon-flag", |
119
|
|
|
"glyphicon-headphones", |
120
|
|
|
"glyphicon-volume-off", |
121
|
|
|
"glyphicon-volume-down", |
122
|
|
|
"glyphicon-volume-up", |
123
|
|
|
"glyphicon-qrcode", |
124
|
|
|
"glyphicon-barcode", |
125
|
|
|
"glyphicon-tag", |
126
|
|
|
"glyphicon-tags", |
127
|
|
|
"glyphicon-book", |
128
|
|
|
"glyphicon-bookmark", |
129
|
|
|
"glyphicon-print", |
130
|
|
|
"glyphicon-camera", |
131
|
|
|
"glyphicon-font", |
132
|
|
|
"glyphicon-bold", |
133
|
|
|
"glyphicon-italic", |
134
|
|
|
"glyphicon-text-height", |
135
|
|
|
"glyphicon-text-width", |
136
|
|
|
"glyphicon-align-left", |
137
|
|
|
"glyphicon-align-center", |
138
|
|
|
"glyphicon-align-right", |
139
|
|
|
"glyphicon-align-justify", |
140
|
|
|
"glyphicon-list", |
141
|
|
|
"glyphicon-indent-left", |
142
|
|
|
"glyphicon-indent-right", |
143
|
|
|
"glyphicon-facetime-video", |
144
|
|
|
"glyphicon-picture", |
145
|
|
|
"glyphicon-map-marker", |
146
|
|
|
"glyphicon-adjust", |
147
|
|
|
"glyphicon-tint", |
148
|
|
|
"glyphicon-edit", |
149
|
|
|
"glyphicon-share", |
150
|
|
|
"glyphicon-check", |
151
|
|
|
"glyphicon-move", |
152
|
|
|
"glyphicon-step-backward", |
153
|
|
|
"glyphicon-fast-backward", |
154
|
|
|
"glyphicon-backward", |
155
|
|
|
"glyphicon-play", |
156
|
|
|
"glyphicon-pause", |
157
|
|
|
"glyphicon-stop", |
158
|
|
|
"glyphicon-forward", |
159
|
|
|
"glyphicon-fast-forward", |
160
|
|
|
"glyphicon-step-forward", |
161
|
|
|
"glyphicon-eject", |
162
|
|
|
"glyphicon-chevron-left", |
163
|
|
|
"glyphicon-chevron-right", |
164
|
|
|
"glyphicon-plus-sign", |
165
|
|
|
"glyphicon-minus-sign", |
166
|
|
|
"glyphicon-remove-sign", |
167
|
|
|
"glyphicon-ok-sign", |
168
|
|
|
"glyphicon-question-sign", |
169
|
|
|
"glyphicon-info-sign", |
170
|
|
|
"glyphicon-screenshot", |
171
|
|
|
"glyphicon-remove-circle", |
172
|
|
|
"glyphicon-ok-circle", |
173
|
|
|
"glyphicon-ban-circle", |
174
|
|
|
"glyphicon-arrow-left", |
175
|
|
|
"glyphicon-arrow-right", |
176
|
|
|
"glyphicon-arrow-up", |
177
|
|
|
"glyphicon-arrow-down", |
178
|
|
|
"glyphicon-share-alt", |
179
|
|
|
"glyphicon-resize-full", |
180
|
|
|
"glyphicon-resize-small", |
181
|
|
|
"glyphicon-exclamation-sign", |
182
|
|
|
"glyphicon-gift", |
183
|
|
|
"glyphicon-leaf", |
184
|
|
|
"glyphicon-fire", |
185
|
|
|
"glyphicon-eye-open", |
186
|
|
|
"glyphicon-eye-close", |
187
|
|
|
"glyphicon-warning-sign", |
188
|
|
|
"glyphicon-plane", |
189
|
|
|
"glyphicon-calendar", |
190
|
|
|
"glyphicon-random", |
191
|
|
|
"glyphicon-comment", |
192
|
|
|
"glyphicon-magnet", |
193
|
|
|
"glyphicon-chevron-up", |
194
|
|
|
"glyphicon-chevron-down", |
195
|
|
|
"glyphicon-retweet", |
196
|
|
|
"glyphicon-shopping-cart", |
197
|
|
|
"glyphicon-folder-close", |
198
|
|
|
"glyphicon-folder-open", |
199
|
|
|
"glyphicon-resize-vertical", |
200
|
|
|
"glyphicon-resize-horizontal", |
201
|
|
|
"glyphicon-hdd", |
202
|
|
|
"glyphicon-bullhorn", |
203
|
|
|
"glyphicon-bell", |
204
|
|
|
"glyphicon-certificate", |
205
|
|
|
"glyphicon-thumbs-up", |
206
|
|
|
"glyphicon-thumbs-down", |
207
|
|
|
"glyphicon-hand-right", |
208
|
|
|
"glyphicon-hand-left", |
209
|
|
|
"glyphicon-hand-up", |
210
|
|
|
"glyphicon-hand-down", |
211
|
|
|
"glyphicon-circle-arrow-right", |
212
|
|
|
"glyphicon-circle-arrow-left", |
213
|
|
|
"glyphicon-circle-arrow-up", |
214
|
|
|
"glyphicon-circle-arrow-down", |
215
|
|
|
"glyphicon-globe", |
216
|
|
|
"glyphicon-wrench", |
217
|
|
|
"glyphicon-tasks", |
218
|
|
|
"glyphicon-filter", |
219
|
|
|
"glyphicon-briefcase", |
220
|
|
|
"glyphicon-fullscreen", |
221
|
|
|
"glyphicon-dashboard", |
222
|
|
|
"glyphicon-paperclip", |
223
|
|
|
"glyphicon-heart-empty", |
224
|
|
|
"glyphicon-link", |
225
|
|
|
"glyphicon-phone", |
226
|
|
|
"glyphicon-pushpin", |
227
|
|
|
"glyphicon-usd", |
228
|
|
|
"glyphicon-gbp", |
229
|
|
|
"glyphicon-sort", |
230
|
|
|
"glyphicon-sort-by-alphabet", |
231
|
|
|
"glyphicon-sort-by-alphabet-alt", |
232
|
|
|
"glyphicon-sort-by-order", |
233
|
|
|
"glyphicon-sort-by-order-alt", |
234
|
|
|
"glyphicon-sort-by-attributes", |
235
|
|
|
"glyphicon-sort-by-attributes-alt", |
236
|
|
|
"glyphicon-unchecked", |
237
|
|
|
"glyphicon-expand", |
238
|
|
|
"glyphicon-collapse-down", |
239
|
|
|
"glyphicon-collapse-up", |
240
|
|
|
"glyphicon-log-in", |
241
|
|
|
"glyphicon-flash", |
242
|
|
|
"glyphicon-log-out", |
243
|
|
|
"glyphicon-new-window", |
244
|
|
|
"glyphicon-record", |
245
|
|
|
"glyphicon-save", |
246
|
|
|
"glyphicon-open", |
247
|
|
|
"glyphicon-saved", |
248
|
|
|
"glyphicon-import", |
249
|
|
|
"glyphicon-export", |
250
|
|
|
"glyphicon-send", |
251
|
|
|
"glyphicon-floppy-disk", |
252
|
|
|
"glyphicon-floppy-saved", |
253
|
|
|
"glyphicon-floppy-remove", |
254
|
|
|
"glyphicon-floppy-save", |
255
|
|
|
"glyphicon-floppy-open", |
256
|
|
|
"glyphicon-credit-card", |
257
|
|
|
"glyphicon-transfer", |
258
|
|
|
"glyphicon-cutlery", |
259
|
|
|
"glyphicon-header", |
260
|
|
|
"glyphicon-compressed", |
261
|
|
|
"glyphicon-earphone", |
262
|
|
|
"glyphicon-phone-alt", |
263
|
|
|
"glyphicon-tower", |
264
|
|
|
"glyphicon-stats", |
265
|
|
|
"glyphicon-sd-video", |
266
|
|
|
"glyphicon-hd-video", |
267
|
|
|
"glyphicon-subtitles", |
268
|
|
|
"glyphicon-sound-stereo", |
269
|
|
|
"glyphicon-sound-dolby", |
270
|
|
|
"glyphicon-sound-5-1", |
271
|
|
|
"glyphicon-sound-6-1", |
272
|
|
|
"glyphicon-sound-7-1", |
273
|
|
|
"glyphicon-copyright-mark", |
274
|
|
|
"glyphicon-registration-mark", |
275
|
|
|
"glyphicon-cloud-download", |
276
|
|
|
"glyphicon-cloud-upload", |
277
|
|
|
"glyphicon-tree-conifer", |
278
|
|
|
"glyphicon-tree-deciduous", |
279
|
|
|
"glyphicon-cd", |
280
|
|
|
"glyphicon-save-file", |
281
|
|
|
"glyphicon-open-file", |
282
|
|
|
"glyphicon-level-up", |
283
|
|
|
"glyphicon-copy", |
284
|
|
|
"glyphicon-paste", |
285
|
|
|
"glyphicon-alert", |
286
|
|
|
"glyphicon-equalizer", |
287
|
|
|
"glyphicon-king", |
288
|
|
|
"glyphicon-queen", |
289
|
|
|
"glyphicon-pawn", |
290
|
|
|
"glyphicon-bishop", |
291
|
|
|
"glyphicon-knight", |
292
|
|
|
"glyphicon-baby-formula", |
293
|
|
|
"glyphicon-tent", |
294
|
|
|
"glyphicon-blackboard", |
295
|
|
|
"glyphicon-bed", |
296
|
|
|
"glyphicon-apple", |
297
|
|
|
"glyphicon-erase", |
298
|
|
|
"glyphicon-hourglass", |
299
|
|
|
"glyphicon-lamp", |
300
|
|
|
"glyphicon-duplicate", |
301
|
|
|
"glyphicon-piggy-bank", |
302
|
|
|
"glyphicon-scissors", |
303
|
|
|
"glyphicon-bitcoin", |
304
|
|
|
"glyphicon-yen", |
305
|
|
|
"glyphicon-ruble", |
306
|
|
|
"glyphicon-scale", |
307
|
|
|
"glyphicon-ice-lolly", |
308
|
|
|
"glyphicon-ice-lolly-tasted", |
309
|
|
|
"glyphicon-education", |
310
|
|
|
"glyphicon-option-horizontal", |
311
|
|
|
"glyphicon-option-vertical", |
312
|
|
|
"glyphicon-menu-hamburger", |
313
|
|
|
"glyphicon-modal-window", |
314
|
|
|
"glyphicon-oil", |
315
|
|
|
"glyphicon-grain", |
316
|
|
|
"glyphicon-sunglasses", |
317
|
|
|
"glyphicon-text-size", |
318
|
|
|
"glyphicon-text-color", |
319
|
|
|
"glyphicon-text-background", |
320
|
|
|
"glyphicon-object-align-top", |
321
|
|
|
"glyphicon-object-align-bottom", |
322
|
|
|
"glyphicon-object-align-horizontal", |
323
|
|
|
"glyphicon-object-align-left", |
324
|
|
|
"glyphicon-object-align-vertical", |
325
|
|
|
"glyphicon-object-align-right", |
326
|
|
|
"glyphicon-triangle-right", |
327
|
|
|
"glyphicon-triangle-left", |
328
|
|
|
"glyphicon-triangle-bottom", |
329
|
|
|
"glyphicon-triangle-top", |
330
|
|
|
"glyphicon-console", |
331
|
|
|
"glyphicon-superscript", |
332
|
|
|
"glyphicon-subscript", |
333
|
|
|
"glyphicon-menu-left", |
334
|
|
|
"glyphicon-menu-right", |
335
|
|
|
"glyphicon-menu-down", |
336
|
|
|
"glyphicon-menu-up" |
337
|
|
|
); |
338
|
|
|
} |
339
|
|
|
|
340
|
|
|
/** |
341
|
|
|
* return a valid style |
342
|
|
|
* avaible values : "default","primary","success","info","warning","danger" |
343
|
|
|
* @param string|int $cssStyle |
344
|
|
|
* @return string |
345
|
|
|
*/ |
346
|
|
|
public static function getStyle($cssStyle, $prefix) { |
347
|
|
|
if (is_int($cssStyle)) { |
348
|
|
|
$styles=CssRef::Styles($prefix); |
349
|
|
|
if ($cssStyle<sizeof($styles)&&$cssStyle>=0) { |
350
|
|
|
return CssRef::styles($prefix)[$cssStyle]; |
351
|
|
|
} else { |
352
|
|
|
throw new \Exception("La valeur passée a propriété `Style` ne fait pas partie des valeurs possibles : index '".$cssStyle."' inexistant"); |
353
|
|
|
} |
354
|
|
|
} |
355
|
|
|
if (JString::startsWith($cssStyle, "-")===true) { |
356
|
|
|
$cssStyle=substr($cssStyle, 1); |
357
|
|
|
} |
358
|
|
|
if (JString::startsWith($cssStyle, $prefix)===false) { |
359
|
|
|
$cssStyle=$prefix."-".$cssStyle; |
360
|
|
|
} |
361
|
|
|
return $cssStyle; |
362
|
|
|
} |
363
|
|
|
} |
364
|
|
|
|