13
13
* @license LICENSE
14
14
*/
15
15
16
+ require_once __DIR__ . "/../controllers/admin/Sms77AdminController.php " ;
17
+ require_once __DIR__ . "./Constants.php " ;
18
+
16
19
class Form extends HelperForm
17
20
{
18
- public function __construct ($ name )
19
- {
21
+ public function __construct ($ name ) {
20
22
parent ::__construct ();
21
23
$ defaultLang = (int )Configuration::get ('PS_LANG_DEFAULT ' );
22
24
$ this ->allow_employee_form_lang = $ defaultLang ;
23
- $ this ->currentIndex = AdminController ::$ currentIndex . "&configure= $ name " ;
25
+ $ this ->currentIndex = Sms77AdminController ::$ currentIndex . "&configure= $ name " ;
24
26
$ this ->default_form_language = $ defaultLang ;
25
27
26
- $ setFieldsValue = function ($ k , $ v ) {
28
+ $ setFieldsValue = function ($ k , $ v ) {
27
29
$ name = "config[ $ k] " ;
28
30
29
31
if (is_array ($ v )) {
@@ -33,15 +35,11 @@ public function __construct($name)
33
35
$ this ->fields_value [$ name ] = $ v ;
34
36
};
35
37
36
- foreach (Configuration::getMultiple (Constants::persistedKeys ( )) as $ k => $ v ) {
38
+ foreach (Configuration::getMultiple (array_keys ( Constants::CONFIGURATION )) as $ k => $ v ) {
37
39
$ setFieldsValue ($ k , $ v );
38
40
}
39
41
40
- foreach (Constants::NON_PERSISTED_KEYS as $ k ) {
41
- $ setFieldsValue ($ k , Constants::CONFIGURATION [$ k ]);
42
- }
43
-
44
- $ toName = function ($ key ) {
42
+ $ toName = function ($ key ) {
45
43
return "config[ $ key] " ;
46
44
};
47
45
@@ -130,35 +128,6 @@ public function __construct($name)
130
128
];
131
129
}, Constants::SIGNATURE_POSITIONS ),
132
130
],
133
- [
134
- 'label ' => $ this ->l ('Countries ' ),
135
- 'multiple ' => true ,
136
- 'name ' => $ toName (Constants::BULK_COUNTRIES ),
137
- 'options ' => [
138
- 'query ' => Country::getCountries ($ this ->context ->language ->id ),
139
- 'id ' => 'id_country ' ,
140
- 'name ' => 'name '
141
- ],
142
- 'tab ' => 'bulk ' ,
143
- 'type ' => 'select ' ,
144
- ],
145
- [
146
- 'label ' => $ this ->l ('Groups ' ),
147
- 'multiple ' => true ,
148
- 'name ' => $ toName (Constants::BULK_GROUPS ),
149
- 'options ' => [
150
- 'query ' => Group::getGroups ($ this ->context ->language ->id ),
151
- 'id ' => 'id_group ' ,
152
- 'name ' => 'name '
153
- ],
154
- 'tab ' => 'bulk ' ,
155
- 'type ' => 'select ' ,
156
- ],
157
- $ this ->makeTextarea (
158
- 'BULK ' ,
159
- 'Send out any message to all of your customers. ' ,
160
- 'bulk '
161
- ),
162
131
],
163
132
'submit ' => [
164
133
'title ' => $ this ->l ('Save ' ),
@@ -179,19 +148,18 @@ public function __construct($name)
179
148
'save ' =>
180
149
[
181
150
'desc ' => $ this ->l ('Save ' ),
182
- 'href ' => AdminController ::$ currentIndex . "&configure= $ name&save $ name&token= "
151
+ 'href ' => Sms77AdminController ::$ currentIndex . "&configure= $ name&save $ name&token= "
183
152
. Tools::getAdminTokenLite ('AdminModules ' ),
184
153
],
185
154
'back ' => [
186
- 'href ' => AdminController ::$ currentIndex . '&token= ' . Tools::getAdminTokenLite ('AdminModules ' ),
155
+ 'href ' => Sms77AdminController ::$ currentIndex . '&token= ' . Tools::getAdminTokenLite ('AdminModules ' ),
187
156
'desc ' => $ this ->l ('Back to list ' ),
188
157
],
189
158
];
190
159
$ this ->toolbar_scroll = true ;
191
160
}
192
161
193
- private function makeTextarea ($ action , $ trans , $ tab = 'settings ' )
194
- {
162
+ private function makeTextarea ($ action , $ trans , $ tab = 'settings ' ) {
195
163
$ trans = $ this ->l ($ trans );
196
164
197
165
return [
@@ -204,8 +172,7 @@ private function makeTextarea($action, $trans, $tab = 'settings')
204
172
];
205
173
}
206
174
207
- private function makeSwitch ($ action , $ label , $ desc , $ values , $ isBool )
208
- {
175
+ private function makeSwitch ($ action , $ label , $ desc , $ values , $ isBool ) {
209
176
$ descHit = $ this ->l ($ desc );
210
177
211
178
return [
@@ -220,18 +187,17 @@ private function makeSwitch($action, $label, $desc, $values, $isBool)
220
187
];
221
188
}
222
189
223
- private function makeBool ($ action , $ label , $ desc )
224
- {
190
+ private function makeBool ($ action , $ label , $ desc ) {
225
191
$ sAction = Tools::strtolower ($ action );
226
192
227
193
return $ this ->makeSwitch ("MSG_ON_ $ action " , $ label , $ desc , [
228
194
[
229
195
'id ' => 'on_ ' . $ sAction . '_on ' ,
230
- 'value ' => 1
196
+ 'value ' => 1 ,
231
197
],
232
198
[
233
199
'id ' => 'on_ ' . $ sAction . '_off ' ,
234
- 'value ' => 0
200
+ 'value ' => 0 ,
235
201
],
236
202
], true );
237
203
}
0 commit comments