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\common\html\HtmlDoubleElement; |
22
|
|
|
use Ajax\semantic\html\modules\HtmlPopup; |
23
|
|
|
use Ajax\common\html\BaseHtml; |
24
|
|
|
|
25
|
|
|
class Semantic extends BaseGui { |
26
|
|
|
|
27
|
|
|
public function __construct($autoCompile=true) { |
28
|
|
|
parent::__construct($autoCompile=true); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* |
33
|
|
|
* @param string $attachTo |
34
|
|
|
* @param string|array $params |
35
|
|
|
* @return $this |
36
|
|
|
*/ |
37
|
|
|
public function popup($attachTo=NULL, $params=NULL) { |
38
|
|
|
return $this->addComponent(new Popup($this->js), $attachTo, $params); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function dropdown($attachTo=NULL, $params=NULL) { |
42
|
|
|
return $this->addComponent(new Dropdown($this->js), $attachTo, $params); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Return a new Semantic Html Button |
47
|
|
|
* @param string $identifier |
48
|
|
|
* @param string $value |
49
|
|
|
* @param string $cssStyle |
50
|
|
|
* @param string $onClick |
51
|
|
|
* @return HtmlButton |
52
|
|
|
*/ |
53
|
|
|
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { |
54
|
|
|
return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param string $identifier |
59
|
|
|
* @param string $icon |
60
|
|
|
*/ |
61
|
|
|
public function htmlIcon($identifier,$icon){ |
62
|
|
|
return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $identifier |
67
|
|
|
* @param string $size |
68
|
|
|
* @param array $icons |
69
|
|
|
*/ |
70
|
|
|
public function htmlIconGroups($identifier,$size="",$icons=array()){ |
71
|
|
|
$group=new HtmlIconGroups($identifier,$size); |
72
|
|
|
if(JArray::isAssociative($icons)){ |
73
|
|
|
foreach ($icons as $icon=>$size){ |
74
|
|
|
$group->add($icon,$size); |
75
|
|
|
} |
76
|
|
|
}else{ |
77
|
|
|
foreach ($icons as $icon){ |
78
|
|
|
$group->add($icon); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
return $this->addHtmlComponent($group); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param string $identifier |
86
|
|
|
* @param array $elements |
87
|
|
|
* @param boolean $asIcons |
88
|
|
|
*/ |
89
|
|
|
public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
90
|
|
|
return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Creates an html container |
95
|
|
|
* @param string $identifier |
96
|
|
|
* @param string $content |
97
|
|
|
*/ |
98
|
|
|
public function htmlContainer($identifier,$content=""){ |
99
|
|
|
return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param string $identifier |
104
|
|
|
* @param string $content |
105
|
|
|
*/ |
106
|
|
|
public function htmlDivider($identifier,$content="",$tagName="div"){ |
107
|
|
|
return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param string $identifier |
112
|
|
|
* @param string $content |
113
|
|
|
* @param string $tagName |
114
|
|
|
*/ |
115
|
|
|
public function htmlLabel($identifier,$content="",$tagName="div"){ |
116
|
|
|
return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @param string $identifier |
121
|
|
|
* @param array $items |
122
|
|
|
*/ |
123
|
|
|
public function htmlMenu($identifier,$items=array()){ |
124
|
|
|
return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @param string $identifier |
129
|
|
|
* @param string $value |
130
|
|
|
* @param array $items |
131
|
|
|
*/ |
132
|
|
|
public function htmlDropdown($identifier, $value="", $items=array()){ |
133
|
|
|
return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Adds a new message |
138
|
|
|
* @param string $identifier |
139
|
|
|
* @param string $content |
140
|
|
|
*/ |
141
|
|
|
public function htmlMessage($identifier, $content=""){ |
142
|
|
|
return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Adds a new segment, used to create a grouping of related content |
147
|
|
|
* @param string $identifier |
148
|
|
|
* @param string $content |
149
|
|
|
*/ |
150
|
|
|
public function htmlSegment($identifier, $content=""){ |
151
|
|
|
return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Adds a group of segments |
156
|
|
|
* @param string $identifier |
157
|
|
|
* @param array $items the segments |
158
|
|
|
*/ |
159
|
|
|
public function htmlSegmentGroups($identifier, $items=array()){ |
160
|
|
|
return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $identifier |
165
|
|
|
* @param mixed $content |
166
|
|
|
*/ |
167
|
|
|
public function htmlPopup(BaseHtml $container,$identifier,$content){ |
168
|
|
|
return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
169
|
|
|
} |
170
|
|
|
} |