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