1
|
|
|
<?php |
2
|
|
|
namespace Ajax\semantic\traits; |
3
|
|
|
|
4
|
|
|
use Ajax\semantic\html\elements\HtmlButtonGroups; |
5
|
|
|
use Ajax\semantic\html\elements\HtmlButton; |
6
|
|
|
use Ajax\semantic\html\elements\HtmlContainer; |
7
|
|
|
use Ajax\semantic\html\elements\HtmlDivider; |
8
|
|
|
use Ajax\semantic\html\elements\HtmlHeader; |
9
|
|
|
use Ajax\semantic\html\elements\HtmlIcon; |
10
|
|
|
use Ajax\semantic\html\elements\HtmlIconGroups; |
11
|
|
|
use Ajax\semantic\html\elements\HtmlInput; |
12
|
|
|
use Ajax\semantic\html\elements\HtmlLabel; |
13
|
|
|
use Ajax\semantic\html\elements\HtmlList; |
14
|
|
|
use Ajax\semantic\html\elements\HtmlSegment; |
15
|
|
|
use Ajax\semantic\html\elements\HtmlSegmentGroups; |
16
|
|
|
use Ajax\semantic\html\elements\HtmlReveal; |
17
|
|
|
use Ajax\semantic\html\base\constants\RevealType; |
18
|
|
|
use Ajax\semantic\html\base\constants\Direction; |
19
|
|
|
use Ajax\semantic\html\elements\HtmlStep; |
20
|
|
|
use Ajax\semantic\html\elements\HtmlFlag; |
21
|
|
|
use Ajax\semantic\html\elements\HtmlImage; |
22
|
|
|
use Ajax\semantic\html\base\constants\State; |
23
|
|
|
use Ajax\semantic\html\elements\HtmlLabelGroups; |
24
|
|
|
use Ajax\common\html\BaseHtml; |
25
|
|
|
use Ajax\semantic\html\base\HtmlSemDoubleElement; |
26
|
|
|
use Ajax\semantic\html\elements\HtmlEmoji; |
27
|
|
|
use Ajax\semantic\html\elements\HtmlRail; |
28
|
|
|
|
29
|
|
|
trait SemanticHtmlElementsTrait { |
30
|
|
|
|
31
|
|
|
abstract public function addHtmlComponent(BaseHtml $htmlComponent); |
32
|
|
|
|
33
|
|
|
public function addState($state, $elements) { |
34
|
|
|
State::add($state, $elements); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Return a new Semantic Html Button |
39
|
|
|
* |
40
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/31 |
41
|
|
|
* @see http://semantic-ui.com/elements/button.html |
42
|
|
|
* @param string $identifier |
43
|
|
|
* @param string $value |
44
|
|
|
* @param string $cssStyle |
45
|
|
|
* @param string $onClick |
46
|
|
|
* @return HtmlButton |
47
|
|
|
*/ |
48
|
|
|
public function htmlButton($identifier, $value = null, $cssStyle = null, $onClick = null) { |
49
|
|
|
return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Returns a group of Semantic buttons |
54
|
|
|
* |
55
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/50 |
56
|
|
|
* @see http://semantic-ui.com/elements/button.html#buttons |
57
|
|
|
* @param string $identifier |
58
|
|
|
* @param array $elements |
59
|
|
|
* @param boolean $asIcons |
60
|
|
|
* @return HtmlButtonGroups |
61
|
|
|
*/ |
62
|
|
|
public function htmlButtonGroups($identifier, $elements = array(), $asIcons = false) { |
63
|
|
|
return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Returns a new Semantic container |
68
|
|
|
* |
69
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/34 |
70
|
|
|
* @see http://semantic-ui.com/elements/container.html |
71
|
|
|
* @param string $identifier |
72
|
|
|
* @param string $content |
73
|
|
|
* @return HtmlContainer |
74
|
|
|
*/ |
75
|
|
|
public function htmlContainer($identifier, $content = "") { |
76
|
|
|
return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Returns a new Semantic divider |
81
|
|
|
* |
82
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/42 |
83
|
|
|
* @see http://semantic-ui.com/elements/divider.html |
84
|
|
|
* @param string $identifier |
85
|
|
|
* @param string $content |
86
|
|
|
* @return HtmlDivider |
87
|
|
|
*/ |
88
|
|
|
public function htmlDivider($identifier, $content = "", $tagName = "div") { |
89
|
|
|
return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Returns a new Semantic header |
94
|
|
|
* |
95
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/43 |
96
|
|
|
* @see http://semantic-ui.com/elements/header.html |
97
|
|
|
* @param string $identifier |
98
|
|
|
* @param number $niveau |
99
|
|
|
* @param mixed $content |
100
|
|
|
* @param string $type |
101
|
|
|
* @return HtmlHeader |
102
|
|
|
*/ |
103
|
|
|
public function htmlHeader($identifier, $niveau = 1, $content = NULL, $type = "page") { |
104
|
|
|
return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Returns a new Semantic icon |
109
|
|
|
* |
110
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/44 |
111
|
|
|
* @see http://semantic-ui.com/elements/icon.html |
112
|
|
|
* @param string $identifier |
113
|
|
|
* @param string $icon |
114
|
|
|
* @return HtmlIcon |
115
|
|
|
*/ |
116
|
|
|
public function htmlIcon($identifier, $icon) { |
117
|
|
|
return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Returns a new Semantic image |
122
|
|
|
* |
123
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/55 |
124
|
|
|
* @see http://semantic-ui.com/elements/image.html |
125
|
|
|
* @param string $identifier |
126
|
|
|
* @param string $src |
127
|
|
|
* @param string $alt |
128
|
|
|
* @param string $size |
129
|
|
|
* @return HtmlImage |
130
|
|
|
*/ |
131
|
|
|
public function htmlImage($identifier, $src = "", $alt = "", $size = NULL) { |
132
|
|
|
return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size)); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Returns a new Semantic group of images |
137
|
|
|
* |
138
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/0 |
139
|
|
|
* @see http://semantic-ui.com/elements/image.html#size |
140
|
|
|
* @param string $identifier |
141
|
|
|
* @param array $icons |
142
|
|
|
* @param string $size |
143
|
|
|
* @return HtmlIconGroups |
144
|
|
|
*/ |
145
|
|
|
public function htmlIconGroups($identifier, $icons = array(), $size = "") { |
146
|
|
|
return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size)); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Returns a new Semantic html input |
151
|
|
|
* |
152
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/45 |
153
|
|
|
* @see http://semantic-ui.com/elements/input.html |
154
|
|
|
* @param string $identifier |
155
|
|
|
* @param string $type |
156
|
|
|
* @param string $value |
157
|
|
|
* @param string $placeholder |
158
|
|
|
* @return HtmlInput |
159
|
|
|
*/ |
160
|
|
|
public function htmlInput($identifier, $type = "text", $value = "", $placeholder = "") { |
161
|
|
|
return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Returns a new Semantic label |
166
|
|
|
* |
167
|
|
|
* @see http://phpmv-ui.kobject.net/index/direct/main/46 |
168
|
|
|
* @see http://semantic-ui.com/elements/label.html |
169
|
|
|
* @param string $identifier |
170
|
|
|
* @param string $content |
171
|
|
|
* @param string $tagName |
172
|
|
|
* @return HtmlLabel |
173
|
|
|
*/ |
174
|
|
|
public function htmlLabel($identifier, $content = "", $icon = NULL, $tagName = "div") { |
175
|
|
|
return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName)); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* |
180
|
|
|
* @param string $identifier |
181
|
|
|
* @param array $labels |
182
|
|
|
* @param array $attributes |
183
|
|
|
* @return HtmlLabelGroups |
184
|
|
|
*/ |
185
|
|
|
public function htmlLabelGroups($identifier, $labels = array(), $attributes = array()) { |
186
|
|
|
return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes)); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Returns a new Semantic list. |
191
|
|
|
* |
192
|
|
|
* @param string $identifier |
193
|
|
|
* @param array $items |
194
|
|
|
* @return HtmlList |
195
|
|
|
*/ |
196
|
|
|
public function htmlList($identifier, $items = array()) { |
197
|
|
|
return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Adds a new segment, used to create a grouping of related content. |
202
|
|
|
* |
203
|
|
|
* @param string $identifier |
204
|
|
|
* @param string $content |
205
|
|
|
* @return HtmlSegment |
206
|
|
|
*/ |
207
|
|
|
public function htmlSegment($identifier, $content = "") { |
208
|
|
|
return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Adds a group of segments |
213
|
|
|
* |
214
|
|
|
* @param string $identifier |
215
|
|
|
* @param array $items |
216
|
|
|
* the segments |
217
|
|
|
* @return HtmlSegmentGroups |
218
|
|
|
*/ |
219
|
|
|
public function htmlSegmentGroups($identifier, $items = array()) { |
220
|
|
|
return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* Returns a new Semantic Reveal. |
225
|
|
|
* |
226
|
|
|
* @param string $identifier |
227
|
|
|
* @param string|HtmlSemDoubleElement $visibleContent |
228
|
|
|
* @param string|HtmlSemDoubleElement $hiddenContent |
229
|
|
|
* @param RevealType|string $type |
230
|
|
|
* @param Direction|string $attributeType |
231
|
|
|
* @return HtmlReveal |
232
|
|
|
*/ |
233
|
|
|
public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type = RevealType::FADE, $attributeType = NULL) { |
234
|
|
|
return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType)); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* Returns a new Semantic Step. |
239
|
|
|
* |
240
|
|
|
* @param string $identifier |
241
|
|
|
* @param array $steps |
242
|
|
|
* @return HtmlStep |
243
|
|
|
*/ |
244
|
|
|
public function htmlStep($identifier, $steps = array()) { |
245
|
|
|
return $this->addHtmlComponent(new HtmlStep($identifier, $steps)); |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* |
250
|
|
|
* Returns a new Semantic Flag. |
251
|
|
|
* |
252
|
|
|
* @param string $identifier |
253
|
|
|
* @param string $flag |
254
|
|
|
* @return HtmlFlag |
255
|
|
|
*/ |
256
|
|
|
public function htmlFlag($identifier, $flag) { |
257
|
|
|
return $this->addHtmlComponent(new HtmlFlag($identifier, $flag)); |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Returns a new Semantic Emoji. |
262
|
|
|
* |
263
|
|
|
* @param string $identifier |
264
|
|
|
* @param string $emoji |
265
|
|
|
* @return HtmlEmoji |
266
|
|
|
*/ |
267
|
|
|
public function htmlEmoji($identifier, $emoji) { |
268
|
|
|
return $this->addHtmlComponent(new HtmlEmoji($identifier, $emoji)); |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* Returns a new Semantic Rail. |
273
|
|
|
* |
274
|
|
|
* @param string $identifier |
275
|
|
|
* @param mixed $content |
276
|
|
|
* @return HtmlRail |
277
|
|
|
*/ |
278
|
|
|
public function htmlRail($identifier, $content = null) { |
279
|
|
|
return $this->addHtmlComponent(new HtmlRail($identifier, $content)); |
280
|
|
|
} |
281
|
|
|
} |
282
|
|
|
|