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
|
|
|
use Ajax\semantic\html\collections\HtmlBreadcrumb; |
31
|
|
|
use Ajax\semantic\html\modules\HtmlAccordion; |
32
|
|
|
use Ajax\semantic\components\Accordion; |
33
|
|
|
|
34
|
|
|
class Semantic extends BaseGui { |
35
|
|
|
|
36
|
|
|
public function __construct($autoCompile=true) { |
37
|
|
|
parent::__construct($autoCompile=true); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* |
42
|
|
|
* @param string $attachTo |
43
|
|
|
* @param string|array $params |
44
|
|
|
* @return $this |
45
|
|
|
*/ |
46
|
|
|
public function generic($attachTo=NULL, $params=NULL) { |
47
|
|
|
return $this->addComponent(new GenericComponent($this->js), $attachTo, $params); |
48
|
|
|
} |
49
|
|
|
/** |
50
|
|
|
* |
51
|
|
|
* @param string $attachTo |
52
|
|
|
* @param string|array $params |
53
|
|
|
* @return $this |
54
|
|
|
*/ |
55
|
|
|
public function popup($attachTo=NULL, $params=NULL) { |
56
|
|
|
return $this->addComponent(new Popup($this->js), $attachTo, $params); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function dropdown($attachTo=NULL, $params=NULL) { |
60
|
|
|
return $this->addComponent(new Dropdown($this->js), $attachTo, $params); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function accordion($attachTo=NULL, $params=NULL) { |
64
|
|
|
return $this->addComponent(new Accordion($this->js), $attachTo, $params); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Return a new Semantic Html Button |
69
|
|
|
* @param string $identifier |
70
|
|
|
* @param string $value |
71
|
|
|
* @param string $cssStyle |
72
|
|
|
* @param string $onClick |
73
|
|
|
* @return HtmlButton |
74
|
|
|
*/ |
75
|
|
|
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { |
76
|
|
|
return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param string $identifier |
81
|
|
|
* @param string $icon |
82
|
|
|
*/ |
83
|
|
|
public function htmlIcon($identifier,$icon){ |
84
|
|
|
return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param string $identifier |
89
|
|
|
* @param string $size |
90
|
|
|
* @param array $icons |
91
|
|
|
*/ |
92
|
|
|
public function htmlIconGroups($identifier,$size="",$icons=array()){ |
93
|
|
|
$group=new HtmlIconGroups($identifier,$size); |
94
|
|
|
if(JArray::isAssociative($icons)){ |
95
|
|
|
foreach ($icons as $icon=>$size){ |
96
|
|
|
$group->add($icon,$size); |
97
|
|
|
} |
98
|
|
|
}else{ |
99
|
|
|
foreach ($icons as $icon){ |
100
|
|
|
$group->add($icon); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
return $this->addHtmlComponent($group); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param string $identifier |
108
|
|
|
* @param array $elements |
109
|
|
|
* @param boolean $asIcons |
110
|
|
|
*/ |
111
|
|
|
public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
112
|
|
|
return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Creates an html container |
117
|
|
|
* @param string $identifier |
118
|
|
|
* @param string $content |
119
|
|
|
*/ |
120
|
|
|
public function htmlContainer($identifier,$content=""){ |
121
|
|
|
return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param string $identifier |
126
|
|
|
* @param string $content |
127
|
|
|
*/ |
128
|
|
|
public function htmlDivider($identifier,$content="",$tagName="div"){ |
129
|
|
|
return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param string $identifier |
134
|
|
|
* @param string $content |
135
|
|
|
* @param string $tagName |
136
|
|
|
*/ |
137
|
|
|
public function htmlLabel($identifier,$content="",$tagName="div"){ |
138
|
|
|
return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param string $identifier |
143
|
|
|
* @param array $items |
144
|
|
|
* @return Ajax\semantic\html\collections\HtmlMenu |
145
|
|
|
*/ |
146
|
|
|
public function htmlMenu($identifier,$items=array()){ |
147
|
|
|
return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/**Adds an icon menu |
151
|
|
|
* @param string $identifier |
152
|
|
|
* @param array $items icons |
153
|
|
|
*/ |
154
|
|
|
public function htmlIconMenu($identifier,$items=array()){ |
155
|
|
|
return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items)); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/**Adds an labeled icon menu |
159
|
|
|
* @param string $identifier |
160
|
|
|
* @param array $items icons |
161
|
|
|
*/ |
162
|
|
|
public function htmlLabeledIconMenu($identifier,$items=array()){ |
163
|
|
|
return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items)); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param string $identifier |
168
|
|
|
* @param string $value |
169
|
|
|
* @param array $items |
170
|
|
|
*/ |
171
|
|
|
public function htmlDropdown($identifier, $value="", $items=array()){ |
172
|
|
|
return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Adds a new message |
177
|
|
|
* @param string $identifier |
178
|
|
|
* @param string $content |
179
|
|
|
*/ |
180
|
|
|
public function htmlMessage($identifier, $content=""){ |
181
|
|
|
return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Adds a new segment, used to create a grouping of related content |
186
|
|
|
* @param string $identifier |
187
|
|
|
* @param string $content |
188
|
|
|
*/ |
189
|
|
|
public function htmlSegment($identifier, $content=""){ |
190
|
|
|
return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* Adds a group of segments |
195
|
|
|
* @param string $identifier |
196
|
|
|
* @param array $items the segments |
197
|
|
|
*/ |
198
|
|
|
public function htmlSegmentGroups($identifier, $items=array()){ |
199
|
|
|
return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param string $identifier |
204
|
|
|
* @param mixed $content |
205
|
|
|
*/ |
206
|
|
|
public function htmlPopup(BaseHtml $container,$identifier,$content){ |
207
|
|
|
return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @param string $identifier |
212
|
|
|
* @param int $numRows |
213
|
|
|
* @param int $numCols |
214
|
|
|
* @param boolean $createCols |
215
|
|
|
* @param boolean $implicitRows |
216
|
|
|
*/ |
217
|
|
|
public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
218
|
|
|
return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows)); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @param string $identifier |
223
|
|
|
* @param number $niveau |
224
|
|
|
* @param mixed $content |
225
|
|
|
* @param string $type |
226
|
|
|
*/ |
227
|
|
|
public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
228
|
|
|
return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
232
|
|
|
return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
public function htmlList($identifier,$items=array()){ |
236
|
|
|
return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* Return a new Seamntic Html Breadcrumb |
241
|
|
|
* @param string $identifier |
242
|
|
|
* @param array $elements |
|
|
|
|
243
|
|
|
* @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true |
244
|
|
|
* @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
245
|
|
|
* @return HtmlBreadcrumb |
246
|
|
|
*/ |
247
|
|
|
public function htmlBreadcrumb( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
248
|
|
|
return $this->addHtmlComponent(new HtmlBreadcrumb($identifier,$items,$autoActive,$startIndex,$hrefFunction)); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* Return a new Seamntic Accordion |
253
|
|
|
* @param string $identifier |
254
|
|
|
* @return HtmlAccordion |
255
|
|
|
*/ |
256
|
|
|
public function htmlAccordion($identifier) { |
257
|
|
|
return $this->addHtmlComponent(new HtmlAccordion($identifier)); |
258
|
|
|
} |
259
|
|
|
} |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.