1
|
|
|
<?php |
2
|
|
|
namespace Ajax\semantic\traits; |
3
|
|
|
|
4
|
|
|
use Ajax\service\JArray; |
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\collections\form\HtmlFormCheckbox; |
18
|
|
|
use Ajax\semantic\html\base\constants\CheckboxType; |
19
|
|
|
use Ajax\semantic\html\elements\HtmlReveal; |
20
|
|
|
use Ajax\semantic\html\base\constants\RevealType; |
21
|
|
|
use Ajax\semantic\html\base\constants\Direction; |
22
|
|
|
use Ajax\semantic\html\elements\HtmlStep; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
trait SemanticHtmlElementsTrait { |
26
|
|
|
|
27
|
|
|
public abstract function addHtmlComponent($htmlComponent); |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Return a new Semantic Html Button |
31
|
|
|
* @param string $identifier |
32
|
|
|
* @param string $value |
33
|
|
|
* @param string $cssStyle |
34
|
|
|
* @param string $onClick |
35
|
|
|
* @return HtmlButton |
36
|
|
|
*/ |
37
|
|
|
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { |
38
|
|
|
return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $identifier |
43
|
|
|
* @param array $elements |
44
|
|
|
* @param boolean $asIcons |
45
|
|
|
* @return HtmlButtonGroups |
46
|
|
|
*/ |
47
|
|
|
public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
48
|
|
|
return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Creates an html container |
53
|
|
|
* @param string $identifier |
54
|
|
|
* @param string $content |
55
|
|
|
* @return HtmlContainer |
56
|
|
|
*/ |
57
|
|
|
public function htmlContainer($identifier,$content=""){ |
58
|
|
|
return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param string $identifier |
63
|
|
|
* @param string $content |
64
|
|
|
* @return HtmlDivider |
65
|
|
|
*/ |
66
|
|
|
public function htmlDivider($identifier,$content="",$tagName="div"){ |
67
|
|
|
return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $identifier |
72
|
|
|
* @param number $niveau |
73
|
|
|
* @param mixed $content |
74
|
|
|
* @param string $type |
75
|
|
|
* @return HtmlHeader |
76
|
|
|
*/ |
77
|
|
|
public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
78
|
|
|
return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param string $identifier |
83
|
|
|
* @param string $icon |
84
|
|
|
* @return HtmlIcon |
85
|
|
|
*/ |
86
|
|
|
public function htmlIcon($identifier,$icon){ |
87
|
|
|
return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param string $identifier |
92
|
|
|
* @param string $size |
93
|
|
|
* @param array $icons |
94
|
|
|
* @return HtmlIconGroups |
95
|
|
|
*/ |
96
|
|
|
public function htmlIconGroups($identifier,$size="",$icons=array()){ |
97
|
|
|
$group=new HtmlIconGroups($identifier,$size); |
98
|
|
|
if(JArray::isAssociative($icons)){ |
99
|
|
|
foreach ($icons as $icon=>$size){ |
100
|
|
|
$group->add($icon,$size); |
101
|
|
|
} |
102
|
|
|
}else{ |
103
|
|
|
foreach ($icons as $icon){ |
104
|
|
|
$group->add($icon); |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
return $this->addHtmlComponent($group); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* |
112
|
|
|
* @param string $identifier |
113
|
|
|
* @param string $type |
114
|
|
|
* @param string $value |
115
|
|
|
* @param string $placeholder |
116
|
|
|
* @return HtmlInput |
117
|
|
|
*/ |
118
|
|
|
public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
119
|
|
|
return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param string $identifier |
124
|
|
|
* @param string $content |
125
|
|
|
* @param string $tagName |
126
|
|
|
* @return HtmlLabel |
127
|
|
|
*/ |
128
|
|
|
public function htmlLabel($identifier,$content="",$tagName="div"){ |
129
|
|
|
return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* |
134
|
|
|
* @param string $identifier |
135
|
|
|
* @param array $items |
136
|
|
|
* @return HtmlList |
137
|
|
|
*/ |
138
|
|
|
public function htmlList($identifier,$items=array()){ |
139
|
|
|
return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Adds a new segment, used to create a grouping of related content |
144
|
|
|
* @param string $identifier |
145
|
|
|
* @param string $content |
146
|
|
|
* @return HtmlSegment |
147
|
|
|
*/ |
148
|
|
|
public function htmlSegment($identifier, $content=""){ |
149
|
|
|
return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Adds a group of segments |
154
|
|
|
* @param string $identifier |
155
|
|
|
* @param array $items the segments |
156
|
|
|
* @return HtmlSegmentGroups |
157
|
|
|
*/ |
158
|
|
|
public function htmlSegmentGroups($identifier, $items=array()){ |
159
|
|
|
return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param string $identifier |
164
|
|
|
* @param string $label |
165
|
|
|
* @param mixed $value |
166
|
|
|
* @param CheckboxType $type |
167
|
|
|
*/ |
168
|
|
|
public function htmlCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
169
|
|
|
return $this->addHtmlComponent(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param string $identifier |
174
|
|
|
* @param string|HtmlSemDoubleElement $visibleContent |
175
|
|
|
* @param string|HtmlSemDoubleElement $hiddenContent |
176
|
|
|
* @param RevealType|string $type |
177
|
|
|
* @param Direction|string $attributeType |
178
|
|
|
*/ |
179
|
|
|
public function htmlReveal($identifier, $visibleContent,$hiddenContent,$type=RevealType::FADE,$attributeType=NULL){ |
180
|
|
|
return $this->addHtmlComponent(new HtmlReveal($identifier,$visibleContent,$hiddenContent,$type,$attributeType)); |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
public function htmlStep($identifier, $steps=array()){ |
184
|
|
|
return $this->addHtmlComponent(new HtmlStep($identifier,$steps)); |
185
|
|
|
} |
186
|
|
|
} |