Completed
Push — master ( 06f62d...424d4e )
by Jean-Christophe
03:13
created

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