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