1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax\semantic\traits; |
4
|
|
|
|
5
|
|
|
use Ajax\semantic\html\base\constants\CheckboxType; |
6
|
|
|
use Ajax\semantic\html\modules\HtmlRating; |
7
|
|
|
use Ajax\semantic\html\modules\HtmlProgress; |
8
|
|
|
use Ajax\semantic\html\modules\HtmlSearch; |
9
|
|
|
use Ajax\semantic\html\modules\HtmlDimmer; |
10
|
|
|
use Ajax\semantic\html\modules\HtmlModal; |
11
|
|
|
use Ajax\semantic\html\modules\checkbox\HtmlCheckbox; |
12
|
|
|
use Ajax\semantic\html\modules\HtmlTab; |
13
|
|
|
use Ajax\semantic\html\modules\HtmlShape; |
14
|
|
|
use Ajax\semantic\html\modules\HtmlPopup; |
15
|
|
|
use Ajax\semantic\html\modules\HtmlDropdown; |
16
|
|
|
use Ajax\common\html\BaseHtml; |
17
|
|
|
use Ajax\semantic\html\modules\HtmlAccordion; |
18
|
|
|
use Ajax\semantic\html\collections\menus\HtmlAccordionMenu; |
19
|
|
|
use Ajax\semantic\html\modules\HtmlSticky; |
20
|
|
|
use Ajax\semantic\html\collections\form\HtmlFormFields; |
21
|
|
|
use Ajax\semantic\html\modules\HtmlSlider; |
22
|
|
|
|
23
|
|
|
trait SemanticHtmlModulesTrait { |
24
|
|
|
|
25
|
|
|
abstract public function addHtmlComponent(BaseHtml $htmlComponent); |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Module checkbox |
29
|
|
|
* @param string $identifier |
30
|
|
|
* @param string $label |
31
|
|
|
* @param mixed $value |
32
|
|
|
* @param CheckboxType $type |
33
|
|
|
* @return HtmlCheckbox |
34
|
|
|
*/ |
35
|
|
|
public function htmlCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
36
|
|
|
return $this->addHtmlComponent(new HtmlCheckbox($identifier, $label, $value, $type)); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param string $identifier |
41
|
|
|
* @param array $items |
42
|
|
|
* @param string $label |
43
|
|
|
* @param mixed $value |
44
|
|
|
* @param string $type |
45
|
|
|
* @return HtmlFormFields |
46
|
|
|
*/ |
47
|
|
|
public function htmlRadios($identifier, $items=[], $label=NULL,$value=NULL, $type=NULL) { |
48
|
|
|
return $this->addHtmlComponent(HtmlFormFields::radios($identifier,$items,$label,$value,$type)); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* |
53
|
|
|
* @param string $identifier |
54
|
|
|
* @param int $value |
55
|
|
|
* @param int $max |
56
|
|
|
* @param string $icon |
57
|
|
|
* @return HtmlRating |
58
|
|
|
*/ |
59
|
|
|
public function htmlRating($identifier, $value, $max, $icon="") { |
60
|
|
|
return $this->addHtmlComponent(new HtmlRating($identifier, $value, $max, $icon)); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* |
65
|
|
|
* @param string $identifier |
66
|
|
|
* @param int $value |
67
|
|
|
* @param string $label |
68
|
|
|
* @return HtmlProgress |
69
|
|
|
*/ |
70
|
|
|
public function htmlProgress($identifier, $value=0, $label=NULL) { |
71
|
|
|
return $this->addHtmlComponent(new HtmlProgress($identifier, $value, $label)); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* |
76
|
|
|
* @param string $identifier |
77
|
|
|
* @param string $placeholder |
78
|
|
|
* @return HtmlSearch |
79
|
|
|
*/ |
80
|
|
|
public function htmlSearch($identifier, $placeholder=NULL, $icon=NULL) { |
81
|
|
|
return $this->addHtmlComponent(new HtmlSearch($identifier, $placeholder, $icon)); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* |
86
|
|
|
* @param string $identifier |
87
|
|
|
* @param mixed $content |
88
|
|
|
* @return HtmlDimmer |
89
|
|
|
*/ |
90
|
|
|
public function htmlDimmer($identifier, $content=NULL) { |
91
|
|
|
return $this->addHtmlComponent(new HtmlDimmer($identifier, $content)); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Returns a new semantic modal dialog |
97
|
|
|
* @param string $identifier |
98
|
|
|
* @param string $header |
99
|
|
|
* @param string $content |
100
|
|
|
* @param array $actions |
101
|
|
|
* @return HtmlModal |
102
|
|
|
*/ |
103
|
|
|
public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
104
|
|
|
return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Returns a new Semantic Tab |
109
|
|
|
* @see http://semantic-ui.com/modules/tab.html |
110
|
|
|
* @param array $tabs |
111
|
|
|
* @return HtmlTab |
112
|
|
|
*/ |
113
|
|
|
public function htmlTab($identifier, $tabs=array()) { |
114
|
|
|
return $this->addHtmlComponent(new HtmlTab($identifier, $tabs)); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Returns a new Semantic Shape |
119
|
|
|
* @see http://semantic-ui.com/modules/shape.html |
120
|
|
|
* @param array $slides |
121
|
|
|
* @return HtmlShape |
122
|
|
|
*/ |
123
|
|
|
public function htmlShape($identifier, $slides=array()) { |
124
|
|
|
return $this->addHtmlComponent(new HtmlShape($identifier, $slides)); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* |
129
|
|
|
* @param string $identifier |
130
|
|
|
* @param string $value |
131
|
|
|
* @param array $items |
132
|
|
|
* @param boolean $associative |
133
|
|
|
* @return HtmlDropdown |
134
|
|
|
*/ |
135
|
|
|
public function htmlDropdown($identifier, $value="", $items=array(),$associative=true) { |
136
|
|
|
return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items,$associative)); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* |
141
|
|
|
* @param string $identifier |
142
|
|
|
* @param mixed $content |
143
|
|
|
* @return HtmlPopup |
144
|
|
|
*/ |
145
|
|
|
public function htmlPopup(BaseHtml $container, $identifier, $content) { |
146
|
|
|
return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content)); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Returns a new Semantic Accordion |
151
|
|
|
* @param string $identifier |
152
|
|
|
* @return HtmlAccordion |
153
|
|
|
*/ |
154
|
|
|
public function htmlAccordion($identifier) { |
155
|
|
|
return $this->addHtmlComponent(new HtmlAccordion($identifier)); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Return a new Semantic Menu Accordion |
160
|
|
|
* @param string $identifier |
161
|
|
|
* @return HtmlAccordionMenu |
162
|
|
|
*/ |
163
|
|
|
public function htmlAccordionMenu($identifier, $items=array()) { |
164
|
|
|
return $this->addHtmlComponent(new HtmlAccordionMenu($identifier, $items)); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Returns a new Semantic Sticky |
170
|
|
|
* @param string $identifier |
171
|
|
|
* @param array $content |
172
|
|
|
* @return HtmlSticky |
173
|
|
|
*/ |
174
|
|
|
public function htmlSticky($identifier, $content=array()) { |
175
|
|
|
return $this->addHtmlComponent(new HtmlSticky($identifier, $content)); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Returns a new Semantic Slider |
180
|
|
|
* @param string $identifier |
181
|
|
|
* @return HtmlSlider |
182
|
|
|
*/ |
183
|
|
|
public function htmlSlider($identifier) { |
184
|
|
|
return $this->addHtmlComponent(new HtmlSlider($identifier)); |
185
|
|
|
} |
186
|
|
|
} |
187
|
|
|
|