Completed
Push — master ( 9de830...b49918 )
by Jean-Christophe
03:44
created

Semantic::htmlAccordionMenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
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\menus\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\menus\HtmlIconMenu;
25
use Ajax\semantic\html\collections\menus\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
use Ajax\semantic\html\collections\menus\HtmlAccordionMenu;
34
use Ajax\semantic\html\collections\form\HtmlForm;
35
36
class Semantic extends BaseGui {
37
38
	public function __construct($autoCompile=true) {
39
		parent::__construct($autoCompile=true);
40
	}
41
42
	/**
43
	 *
44
	 * @param string $attachTo
45
	 * @param string|array $params
46
	 * @return $this
47
	 */
48
	public function generic($attachTo=NULL, $params=NULL) {
49
		return $this->addComponent(new GenericComponent($this->js), $attachTo, $params);
50
	}
51
	/**
52
	 *
53
	 * @param string $attachTo
54
	 * @param string|array $params
55
	 * @return $this
56
	 */
57
	public function popup($attachTo=NULL, $params=NULL) {
58
		return $this->addComponent(new Popup($this->js), $attachTo, $params);
59
	}
60
61
	public function dropdown($attachTo=NULL, $params=NULL) {
62
		return $this->addComponent(new Dropdown($this->js), $attachTo, $params);
63
	}
64
65
	public function accordion($attachTo=NULL, $params=NULL) {
66
		return $this->addComponent(new Accordion($this->js), $attachTo, $params);
67
	}
68
69
	/**
70
	 * Return a new Semantic Html Button
71
	 * @param string $identifier
72
	 * @param string $value
73
	 * @param string $cssStyle
74
	 * @param string $onClick
75
	 * @return HtmlButton
76
	 */
77
	public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) {
78
		return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick));
79
	}
80
81
	/**
82
	 * @param string $identifier
83
	 * @param string $icon
84
	 */
85
	public function htmlIcon($identifier,$icon){
86
		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
87
	}
88
89
	/**
90
	 * @param string $identifier
91
	 * @param string $size
92
	 * @param array $icons
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
	 * @param string $identifier
110
	 * @param array $elements
111
	 * @param boolean $asIcons
112
	 */
113
	public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){
114
		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons));
115
	}
116
117
	/**
118
	 * Creates an html container
119
	 * @param string $identifier
120
	 * @param string $content
121
	 */
122
	public function htmlContainer($identifier,$content=""){
123
		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
124
	}
125
126
	/**
127
	 * @param string $identifier
128
	 * @param string $content
129
	 */
130
	public function htmlDivider($identifier,$content="",$tagName="div"){
131
		return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName));
132
	}
133
134
	/**
135
	 * @param string $identifier
136
	 * @param string $content
137
	 * @param string $tagName
138
	 */
139
	public function htmlLabel($identifier,$content="",$tagName="div"){
140
		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName));
141
	}
142
143
	/**
144
	 * @param string $identifier
145
	 * @param array $items
146
	 * @return Ajax\semantic\html\collections\HtmlMenu
147
	 */
148
	public function htmlMenu($identifier,$items=array()){
149
		return $this->addHtmlComponent(new HtmlMenu($identifier,$items));
150
	}
151
152
	/**Adds an icon menu
153
	 * @param string $identifier
154
	 * @param array $items icons
155
	 */
156
	public function htmlIconMenu($identifier,$items=array()){
157
		return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items));
158
	}
159
160
	/**Adds an labeled icon menu
161
	 * @param string $identifier
162
	 * @param array $items icons
163
	 */
164
	public function htmlLabeledIconMenu($identifier,$items=array()){
165
		return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items));
166
	}
167
168
	/**
169
	 * @param string $identifier
170
	 * @param string $value
171
	 * @param array $items
172
	 */
173
	public function htmlDropdown($identifier, $value="", $items=array()){
174
		return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items));
175
	}
176
177
	/**
178
	 * Adds a new message
179
	 * @param string $identifier
180
	 * @param string $content
181
	 */
182
	public function htmlMessage($identifier, $content=""){
183
		return $this->addHtmlComponent(new HtmlMessage($identifier,$content));
184
	}
185
186
	/**
187
	 * Adds a new segment, used to create a grouping of related content
188
	 * @param string $identifier
189
	 * @param string $content
190
	 */
191
	public function htmlSegment($identifier, $content=""){
192
		return $this->addHtmlComponent(new HtmlSegment($identifier,$content));
193
	}
194
195
	/**
196
	 * Adds a group of segments
197
	 * @param string $identifier
198
	 * @param array $items the segments
199
	 */
200
	public function htmlSegmentGroups($identifier, $items=array()){
201
		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items));
202
	}
203
204
	/**
205
	 * @param string $identifier
206
	 * @param mixed $content
207
	 */
208
	public function htmlPopup(BaseHtml $container,$identifier,$content){
209
		return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content));
210
	}
211
212
	/**
213
	 * @param string $identifier
214
	 * @param int $numRows
215
	 * @param int $numCols
216
	 * @param boolean $createCols
217
	 * @param boolean $implicitRows
218
	 */
219
	public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){
220
		return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows));
221
	}
222
223
	/**
224
	 * @param string $identifier
225
	 * @param number $niveau
226
	 * @param mixed $content
227
	 * @param string $type
228
	 */
229
	public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){
230
		return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type));
231
	}
232
233
	public function htmlInput($identifier,$type="text",$value="",$placeholder=""){
234
		return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder));
235
	}
236
237
	public function htmlList($identifier,$items=array()){
238
		return $this->addHtmlComponent(new HtmlList($identifier,$items));
239
	}
240
241
	/**
242
	 * Return a new Semantic Html Breadcrumb
243
	 * @param string $identifier
244
	 * @param array $elements
0 ignored issues
show
Bug introduced by
There is no parameter named $elements. Was it maybe removed?

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 method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
245
	 * @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true
246
	 * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()}
247
	 * @return HtmlBreadcrumb
248
	 */
249
	public function htmlBreadcrumb( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){
250
		return $this->addHtmlComponent(new HtmlBreadcrumb($identifier,$items,$autoActive,$startIndex,$hrefFunction));
251
	}
252
253
	/**
254
	 * Return a new Semantic Accordion
255
	 * @param string $identifier
256
	 * @return HtmlAccordion
257
	 */
258
	public function htmlAccordion($identifier) {
259
		return $this->addHtmlComponent(new HtmlAccordion($identifier));
260
	}
261
262
	/**
263
	 * Return a new Semantic Menu Accordion
264
	 * @param string $identifier
265
	 * @return HtmlAccordion
266
	 */
267
	public function htmlAccordionMenu($identifier,$items=array()) {
268
		return $this->addHtmlComponent(new HtmlAccordionMenu($identifier,$items));
269
	}
270
271
	/**
272
	 * Return a new Semantic Form
273
	 * @param string $identifier
274
	 * @param array $elements
275
	 */
276
	public function htmlForm($identifier,$elements=array()) {
277
		return $this->addHtmlComponent(new HtmlForm($identifier,$elements));
278
	}
279
}