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