Completed
Push — master ( db82f0...0ba4b1 )
by Jean-Christophe
03:22
created

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

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $placeholder is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
213
		return $this->addHtmlComponent(new HtmlInput($identifier,$value="",$type="text",$placeholder=""));
214
	}
215
}