1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax; |
4
|
|
|
|
5
|
|
|
use Ajax\common\BaseGui; |
6
|
|
|
use Ajax\semantic\html\elements\HtmlButton; |
7
|
|
|
use Ajax\semantic\html\elements\HtmlIcon; |
8
|
|
|
use Ajax\service\JArray; |
9
|
|
|
use Ajax\semantic\html\elements\HtmlIconGroups; |
10
|
|
|
use Ajax\semantic\html\elements\HtmlButtonGroups; |
11
|
|
|
use Ajax\semantic\html\elements\HtmlContainer; |
12
|
|
|
use Ajax\semantic\html\elements\HtmlDivider; |
13
|
|
|
use Ajax\semantic\html\elements\HtmlLabel; |
14
|
|
|
use Ajax\semantic\html\collections\HtmlMenu; |
15
|
|
|
use Ajax\semantic\components\Popup; |
16
|
|
|
use Ajax\semantic\html\modules\HtmlDropdown; |
17
|
|
|
use Ajax\semantic\components\Dropdown; |
18
|
|
|
use Ajax\semantic\html\collections\HtmlMessage; |
19
|
|
|
use Ajax\semantic\html\elements\HtmlSegment; |
20
|
|
|
use Ajax\semantic\html\elements\HtmlSegmentGroups; |
21
|
|
|
use Ajax\semantic\html\modules\HtmlPopup; |
22
|
|
|
use Ajax\common\html\BaseHtml; |
23
|
|
|
use Ajax\semantic\html\collections\HtmlGrid; |
24
|
|
|
use Ajax\semantic\html\collections\HtmlIconMenu; |
25
|
|
|
use Ajax\semantic\html\collections\HtmlLabeledIconMenu; |
26
|
|
|
use Ajax\semantic\html\elements\HtmlHeader; |
27
|
|
|
use Ajax\semantic\html\elements\HtmlInput; |
28
|
|
|
use Ajax\semantic\html\elements\HtmlList; |
29
|
|
|
use Ajax\common\components\GenericComponent; |
30
|
|
|
|
31
|
|
|
class Semantic extends BaseGui { |
32
|
|
|
|
33
|
|
|
public function __construct($autoCompile=true) { |
34
|
|
|
parent::__construct($autoCompile=true); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* |
39
|
|
|
* @param string $attachTo |
40
|
|
|
* @param string|array $params |
41
|
|
|
* @return $this |
42
|
|
|
*/ |
43
|
|
|
public function generic($attachTo=NULL, $params=NULL) { |
44
|
|
|
return $this->addComponent(new GenericComponent($this->js), $attachTo, $params); |
45
|
|
|
} |
46
|
|
|
/** |
47
|
|
|
* |
48
|
|
|
* @param string $attachTo |
49
|
|
|
* @param string|array $params |
50
|
|
|
* @return $this |
51
|
|
|
*/ |
52
|
|
|
public function popup($attachTo=NULL, $params=NULL) { |
53
|
|
|
return $this->addComponent(new Popup($this->js), $attachTo, $params); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function dropdown($attachTo=NULL, $params=NULL) { |
57
|
|
|
return $this->addComponent(new Dropdown($this->js), $attachTo, $params); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Return a new Semantic Html Button |
62
|
|
|
* @param string $identifier |
63
|
|
|
* @param string $value |
64
|
|
|
* @param string $cssStyle |
65
|
|
|
* @param string $onClick |
66
|
|
|
* @return HtmlButton |
67
|
|
|
*/ |
68
|
|
|
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { |
69
|
|
|
return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param string $identifier |
74
|
|
|
* @param string $icon |
75
|
|
|
*/ |
76
|
|
|
public function htmlIcon($identifier,$icon){ |
77
|
|
|
return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param string $identifier |
82
|
|
|
* @param string $size |
83
|
|
|
* @param array $icons |
84
|
|
|
*/ |
85
|
|
|
public function htmlIconGroups($identifier,$size="",$icons=array()){ |
86
|
|
|
$group=new HtmlIconGroups($identifier,$size); |
87
|
|
|
if(JArray::isAssociative($icons)){ |
88
|
|
|
foreach ($icons as $icon=>$size){ |
89
|
|
|
$group->add($icon,$size); |
90
|
|
|
} |
91
|
|
|
}else{ |
92
|
|
|
foreach ($icons as $icon){ |
93
|
|
|
$group->add($icon); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
return $this->addHtmlComponent($group); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param string $identifier |
101
|
|
|
* @param array $elements |
102
|
|
|
* @param boolean $asIcons |
103
|
|
|
*/ |
104
|
|
|
public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
105
|
|
|
return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Creates an html container |
110
|
|
|
* @param string $identifier |
111
|
|
|
* @param string $content |
112
|
|
|
*/ |
113
|
|
|
public function htmlContainer($identifier,$content=""){ |
114
|
|
|
return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string $identifier |
119
|
|
|
* @param string $content |
120
|
|
|
*/ |
121
|
|
|
public function htmlDivider($identifier,$content="",$tagName="div"){ |
122
|
|
|
return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param string $identifier |
127
|
|
|
* @param string $content |
128
|
|
|
* @param string $tagName |
129
|
|
|
*/ |
130
|
|
|
public function htmlLabel($identifier,$content="",$tagName="div"){ |
131
|
|
|
return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param string $identifier |
136
|
|
|
* @param array $items |
137
|
|
|
*/ |
138
|
|
|
public function htmlMenu($identifier,$items=array()){ |
139
|
|
|
return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/**Adds an icon menu |
143
|
|
|
* @param string $identifier |
144
|
|
|
* @param array $items icons |
145
|
|
|
*/ |
146
|
|
|
public function htmlIconMenu($identifier,$items=array()){ |
147
|
|
|
return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items)); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/**Adds an labeled icon menu |
151
|
|
|
* @param string $identifier |
152
|
|
|
* @param array $items icons |
153
|
|
|
*/ |
154
|
|
|
public function htmlLabeledIconMenu($identifier,$items=array()){ |
155
|
|
|
return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items)); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param string $identifier |
160
|
|
|
* @param string $value |
161
|
|
|
* @param array $items |
162
|
|
|
*/ |
163
|
|
|
public function htmlDropdown($identifier, $value="", $items=array()){ |
164
|
|
|
return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Adds a new message |
169
|
|
|
* @param string $identifier |
170
|
|
|
* @param string $content |
171
|
|
|
*/ |
172
|
|
|
public function htmlMessage($identifier, $content=""){ |
173
|
|
|
return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Adds a new segment, used to create a grouping of related content |
178
|
|
|
* @param string $identifier |
179
|
|
|
* @param string $content |
180
|
|
|
*/ |
181
|
|
|
public function htmlSegment($identifier, $content=""){ |
182
|
|
|
return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Adds a group of segments |
187
|
|
|
* @param string $identifier |
188
|
|
|
* @param array $items the segments |
189
|
|
|
*/ |
190
|
|
|
public function htmlSegmentGroups($identifier, $items=array()){ |
191
|
|
|
return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @param string $identifier |
196
|
|
|
* @param mixed $content |
197
|
|
|
*/ |
198
|
|
|
public function htmlPopup(BaseHtml $container,$identifier,$content){ |
199
|
|
|
return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param string $identifier |
204
|
|
|
* @param int $numRows |
205
|
|
|
* @param int $numCols |
206
|
|
|
* @param boolean $createCols |
207
|
|
|
* @param boolean $implicitRows |
208
|
|
|
*/ |
209
|
|
|
public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
210
|
|
|
return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows)); |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @param string $identifier |
215
|
|
|
* @param number $niveau |
216
|
|
|
* @param mixed $content |
217
|
|
|
* @param string $type |
218
|
|
|
*/ |
219
|
|
|
public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
220
|
|
|
return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
224
|
|
|
return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
public function htmlList($identifier,$items=array()){ |
228
|
|
|
return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
229
|
|
|
} |
230
|
|
|
} |