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