|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Wgevents; |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
You may not change or alter any portion of this comment or credits |
|
7
|
|
|
of supporting developers from this source code or any supporting source code |
|
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
9
|
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
|
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* wgEvents module for xoops |
|
17
|
|
|
* |
|
18
|
|
|
* @copyright 2021 XOOPS Project (https://xoops.org) |
|
19
|
|
|
* @license GPL 2.0 or later |
|
20
|
|
|
* @package wgevents |
|
21
|
|
|
* @since 1.0.0 |
|
22
|
|
|
* @min_xoops 2.5.11 Beta1 |
|
23
|
|
|
* @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
use XoopsModules\Wgevents; |
|
27
|
|
|
use XoopsModules\Wgevents\Forms\FormelementsHandler; |
|
28
|
|
|
|
|
29
|
|
|
\defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Class Object Registration |
|
33
|
|
|
*/ |
|
34
|
|
|
class Registration extends \XoopsObject |
|
35
|
|
|
{ |
|
36
|
|
|
/** |
|
37
|
|
|
* @var int |
|
38
|
|
|
*/ |
|
39
|
|
|
private $start = 0; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var int |
|
43
|
|
|
*/ |
|
44
|
|
|
private $limit = 0; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var string |
|
48
|
|
|
*/ |
|
49
|
|
|
private $redir = 'list'; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var string |
|
53
|
|
|
*/ |
|
54
|
|
|
private $verifkeyEdit = ''; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Constructor |
|
58
|
|
|
* |
|
59
|
|
|
*/ |
|
60
|
|
|
public function __construct() |
|
61
|
|
|
{ |
|
62
|
|
|
$this->initVar('id', \XOBJ_DTYPE_INT); |
|
63
|
|
|
$this->initVar('evid', \XOBJ_DTYPE_INT); |
|
64
|
|
|
$this->initVar('salutation', \XOBJ_DTYPE_INT); |
|
65
|
|
|
$this->initVar('firstname', \XOBJ_DTYPE_TXTBOX); |
|
66
|
|
|
$this->initVar('lastname', \XOBJ_DTYPE_TXTBOX); |
|
67
|
|
|
$this->initVar('email', \XOBJ_DTYPE_TXTBOX); |
|
68
|
|
|
$this->initVar('email_send', \XOBJ_DTYPE_INT); |
|
69
|
|
|
$this->initVar('gdpr', \XOBJ_DTYPE_INT); |
|
70
|
|
|
$this->initVar('ip', \XOBJ_DTYPE_TXTBOX); |
|
71
|
|
|
$this->initVar('verifkey', \XOBJ_DTYPE_TXTBOX); |
|
72
|
|
|
$this->initVar('status', \XOBJ_DTYPE_INT); |
|
73
|
|
|
$this->initVar('financial', \XOBJ_DTYPE_INT); |
|
74
|
|
|
$this->initVar('paidamount', \XOBJ_DTYPE_FLOAT); |
|
75
|
|
|
$this->initVar('listwait', \XOBJ_DTYPE_INT); |
|
76
|
|
|
$this->initVar('datecreated', \XOBJ_DTYPE_INT); |
|
77
|
|
|
$this->initVar('submitter', \XOBJ_DTYPE_INT); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @static function &getInstance |
|
82
|
|
|
* |
|
83
|
|
|
*/ |
|
84
|
|
|
public static function getInstance() |
|
85
|
|
|
{ |
|
86
|
|
|
static $instance = false; |
|
87
|
|
|
if (!$instance) { |
|
88
|
|
|
$instance = new self(); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* The new inserted $Id |
|
94
|
|
|
* @return inserted id |
|
|
|
|
|
|
95
|
|
|
*/ |
|
96
|
|
|
public function getNewInsertedId() |
|
97
|
|
|
{ |
|
98
|
|
|
return $GLOBALS['xoopsDB']->getInsertId(); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @public function getForm |
|
103
|
|
|
* @param bool $action |
|
104
|
|
|
* @param bool $test |
|
105
|
|
|
* @return \XoopsThemeForm |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getForm($action = false, $test = false) |
|
108
|
|
|
{ |
|
109
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
|
110
|
|
|
|
|
111
|
|
|
$eventHandler = $helper->getHandler('Event'); |
|
112
|
|
|
$questionHandler = $helper->getHandler('Question'); |
|
113
|
|
|
$answerHandler = $helper->getHandler('Answer'); |
|
114
|
|
|
$permissionsHandler = $helper->getHandler('Permission'); |
|
115
|
|
|
|
|
116
|
|
|
if (!$action) { |
|
117
|
|
|
$action = $_SERVER['REQUEST_URI']; |
|
118
|
|
|
} |
|
119
|
|
|
$isAdmin = false; |
|
120
|
|
|
if (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) { |
|
121
|
|
|
$isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
122
|
|
|
} |
|
123
|
|
|
$answersExist = true; |
|
124
|
|
|
// Title |
|
125
|
|
|
if ($this->isNew()) { |
|
126
|
|
|
$title = $test ? \_MA_WGEVENTS_QUESTIONS_PREVIEW : \_MA_WGEVENTS_REGISTRATION_ADD; |
|
127
|
|
|
$answersExist = false; |
|
128
|
|
|
} else { |
|
129
|
|
|
$title =\_MA_WGEVENTS_REGISTRATION_EDIT; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
$regEvid = $this->getVar('evid'); |
|
133
|
|
|
$eventObj = $eventHandler->get($regEvid); |
|
134
|
|
|
$permRegistrationsApprove = $permissionsHandler->getPermRegistrationsApprove($eventObj->getVar('submitter'), $eventObj->getVar('status')); |
|
135
|
|
|
$eventFee = (float)$eventObj->getVar('fee'); |
|
136
|
|
|
$eventRegisterMax = (int)$eventObj->getVar('register_max'); |
|
137
|
|
|
$eventRegisterForceverif = (bool)$eventObj->getVar('register_forceverif'); |
|
138
|
|
|
|
|
139
|
|
|
// Get Theme Form |
|
140
|
|
|
\xoops_load('XoopsFormLoader'); |
|
141
|
|
|
$form = new \XoopsThemeForm($title, 'formRegistration', $action, 'post', true); |
|
142
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
|
143
|
|
|
// Form Table events |
|
144
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_REGISTRATION_EVID, $eventObj->getVar('name'))); |
|
|
|
|
|
|
145
|
|
|
$form->addElement(new \XoopsFormHidden('evid', $this->getVar('evid'))); |
|
|
|
|
|
|
146
|
|
|
// Form select regSalutation |
|
147
|
|
|
$regSalutationSelect = new \XoopsFormSelect(\_MA_WGEVENTS_REGISTRATION_SALUTATION, 'salutation', $this->getVar('salutation')); |
|
148
|
|
|
$regSalutationSelect->addOption(Constants::SALUTATION_NONE, ' '); |
|
149
|
|
|
$regSalutationSelect->addOption(Constants::SALUTATION_MEN, \_MA_WGEVENTS_REGISTRATION_SALUTATION_MEN); |
|
150
|
|
|
$regSalutationSelect->addOption(Constants::SALUTATION_WOMEN, \_MA_WGEVENTS_REGISTRATION_SALUTATION_WOMEN); |
|
151
|
|
|
$form->addElement($regSalutationSelect); |
|
152
|
|
|
// Form select regFirstname |
|
153
|
|
|
$regFirstname = new Forms\FormText(\_MA_WGEVENTS_REGISTRATION_FIRSTNAME, 'firstname', 50, 255, $this->getVar('firstname')); |
|
|
|
|
|
|
154
|
|
|
$regFirstname->setPlaceholder(\_MA_WGEVENTS_REGISTRATION_FIRSTNAME_PLACEHOLDER); |
|
155
|
|
|
$form->addElement($regFirstname); |
|
156
|
|
|
// Form select regLastname |
|
157
|
|
|
$regLastname = new Forms\FormText(\_MA_WGEVENTS_REGISTRATION_LASTNAME, 'lastname', 50, 255, $this->getVar('lastname')); |
|
158
|
|
|
$regLastname->setPlaceholder(\_MA_WGEVENTS_REGISTRATION_LASTNAME_PLACEHOLDER); |
|
159
|
|
|
$form->addElement($regLastname, true); |
|
160
|
|
|
// Form select regEmail |
|
161
|
|
|
$regEmailTray = new Forms\FormElementTray(\_MA_WGEVENTS_REGISTRATION_EMAIL, '<br>'); |
|
162
|
|
|
$regEmail = new Forms\FormText('', 'email', 50, 255, $this->getVar('email')); |
|
163
|
|
|
$regEmail->setPlaceholder(\_MA_WGEVENTS_REGISTRATION_EMAIL_PLACEHOLDER); |
|
164
|
|
|
if ($eventRegisterForceverif) { |
|
165
|
|
|
$regEmail->setDescription(_MA_WGEVENTS_EVENT_REGISTER_FORCEVERIF_INFO); |
|
166
|
|
|
} |
|
167
|
|
|
$regEmail->setExtra("onfocusout='emailValidation(\"email\", \"" . \sprintf(\_MA_WGEVENTS_INVALID_EMAIL, \_MA_WGEVENTS_REGISTRATION_EMAIL) . "\")'"); |
|
168
|
|
|
$regEmailTray->addElement($regEmail, $eventRegisterForceverif); |
|
169
|
|
|
// Form select regEmailSend |
|
170
|
|
|
$regEmailSend = $this->isNew() ? 1 : $this->getVar('email_send'); |
|
171
|
|
|
$regEmailRadio = new \XoopsFormRadioYN(\_MA_WGEVENTS_REGISTRATION_EMAIL_CONFIRM, 'email_send', $regEmailSend); |
|
|
|
|
|
|
172
|
|
|
$regEmailTray->addElement($regEmailRadio); |
|
173
|
|
|
$form->addElement($regEmailTray); |
|
174
|
|
|
// get all questions |
|
175
|
|
|
$crQuestion = new \CriteriaCompo(); |
|
176
|
|
|
$crQuestion->add(new \Criteria('evid', $regEvid)); |
|
177
|
|
|
$crQuestion->setSort('weight ASC, id'); |
|
178
|
|
|
$crQuestion->setOrder('DESC'); |
|
179
|
|
|
$questionsCount = $questionHandler->getCount($crQuestion); |
|
180
|
|
|
if ($questionsCount > 0) { |
|
181
|
|
|
$questionsAll = $questionHandler->getAll($crQuestion); |
|
182
|
|
|
foreach (\array_keys($questionsAll) as $queId) { |
|
183
|
|
|
$formelementsHandler = new FormelementsHandler(); |
|
184
|
|
|
$formelementsHandler->name = 'ans_id_' . $queId; |
|
185
|
|
|
$queType = (int)$questionsAll[$queId]->getVar('type'); |
|
186
|
|
|
$addValue = (string)$questionsAll[$queId]->getVar('values'); |
|
187
|
|
|
$formelementsHandler->type = $queType; |
|
188
|
|
|
$formelementsHandler->caption = $questionsAll[$queId]->getVar('caption'); |
|
189
|
|
|
if ($answersExist) { |
|
190
|
|
|
$value = ''; |
|
191
|
|
|
// get answers for this questions |
|
192
|
|
|
$crAnswer = new \CriteriaCompo(); |
|
193
|
|
|
$crAnswer->add(new \Criteria('regid', $this->getVar('id'))); |
|
194
|
|
|
$crAnswer->add(new \Criteria('queid', $queId)); |
|
195
|
|
|
$answersCount = $answerHandler->getCount($crAnswer); |
|
196
|
|
|
if ($answersCount > 0) { |
|
197
|
|
|
$answersAll = $answerHandler->getAll($crAnswer); |
|
198
|
|
|
foreach (\array_keys($answersAll) as $ansId) { |
|
199
|
|
|
switch ($queType) { |
|
200
|
|
|
case Constants::FIELD_DATE: |
|
201
|
|
|
$answerDateObj = \DateTime::createFromFormat(\_SHORTDATESTRING, $answersAll[$ansId]->getVar('text')); |
|
202
|
|
|
$value = $answerDateObj->getTimestamp(); |
|
203
|
|
|
break; |
|
204
|
|
|
case Constants::FIELD_COMBOBOX: |
|
205
|
|
|
case Constants::FIELD_CHECKBOX: |
|
206
|
|
|
$ansText = $answersAll[$ansId]->getVar('text', 'n'); |
|
207
|
|
|
$value = \unserialize($ansText, ['allowed_classes' => false]); |
|
208
|
|
|
break; |
|
209
|
|
|
case Constants::FIELD_SELECTBOX: |
|
210
|
|
|
$ansText = $answersAll[$ansId]->getVar('text', 'n'); |
|
211
|
|
|
$value = (string)\unserialize($ansText, ['allowed_classes' => false]); |
|
212
|
|
|
break; |
|
213
|
|
|
case 0: |
|
214
|
|
|
default: |
|
215
|
|
|
$value = $answersAll[$ansId]->getVar('text'); |
|
216
|
|
|
break; |
|
217
|
|
|
} |
|
218
|
|
|
} |
|
219
|
|
|
} |
|
220
|
|
|
$formelementsHandler->value = $value; |
|
221
|
|
|
//} else { |
|
222
|
|
|
//TODO |
|
223
|
|
|
} |
|
224
|
|
|
if (Constants::FIELD_RADIO == $queType || |
|
225
|
|
|
//Constants::FIELD_SELECTBOX == $queType || |
|
226
|
|
|
Constants::FIELD_CHECKBOX == $queType || |
|
227
|
|
|
Constants::FIELD_COMBOBOX == $queType) { |
|
228
|
|
|
$formelementsHandler->optionsArr = \unserialize($addValue, ['allowed_classes' => false]); |
|
229
|
|
|
} |
|
230
|
|
|
/**/ |
|
231
|
|
|
$required = (bool)$questionsAll[$queId]->getVar('required'); |
|
232
|
|
|
if ($isAdmin) { |
|
233
|
|
|
$required = false; |
|
234
|
|
|
} |
|
235
|
|
|
if (Constants::FIELD_SELECTBOX == $queType) { |
|
236
|
|
|
//required selectboxes get a blank link in order to force user to input |
|
237
|
|
|
$optionsSB = []; |
|
238
|
|
|
if ($required) { |
|
239
|
|
|
$optionsSB[''] = ' '; |
|
240
|
|
|
} |
|
241
|
|
|
foreach (\unserialize($addValue, ['allowed_classes' => false]) as $optSB) { |
|
242
|
|
|
$optionsSB[] = $optSB; |
|
243
|
|
|
} |
|
244
|
|
|
$formelementsHandler->optionsArr = $optionsSB; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
if (Constants::FIELD_LABEL == $queType) { |
|
248
|
|
|
$desc = \preg_replace('/\r\n|\r|\n/', '<br>', $questionsAll[$queId]->getVar('desc', 'e')); |
|
249
|
|
|
$formelementsHandler->value = $desc; |
|
250
|
|
|
} |
|
251
|
|
|
$formelementsHandler->placeholder = $questionsAll[$queId]->getVar('placeholder'); |
|
252
|
|
|
$formelementsHandler->desc = $questionsAll[$queId]->getVar('desc'); |
|
253
|
|
|
$form->addElement($formelementsHandler->render(), $required); |
|
254
|
|
|
$form->addElement(new \XoopsFormHidden('type[' . $questionsAll[$queId]->getVar('id') . ']', $questionsAll[$queId]->getVar('type'))); |
|
255
|
|
|
$form->addElement(new \XoopsFormHidden('ans_id[' . $questionsAll[$queId]->getVar('id') . ']', $questionsAll[$queId]->getVar('id'))); |
|
256
|
|
|
} |
|
257
|
|
|
unset($questions); |
|
|
|
|
|
|
258
|
|
|
} |
|
259
|
|
|
// Form checkbox regGdpr |
|
260
|
|
|
$valueGdpr = $permRegistrationsApprove ? 1 : ''; |
|
261
|
|
|
$regGdpr = new \XoopsFormCheckBox(\_MA_WGEVENTS_REGISTRATION_GDPR, 'gdpr', $valueGdpr); |
|
262
|
|
|
$regGdpr->addOption(1, \_MA_WGEVENTS_REGISTRATION_GDPR_VALUE); |
|
263
|
|
|
$form->addElement($regGdpr, true); |
|
264
|
|
|
// Form Text Date Select regFinancial |
|
265
|
|
|
// Form Text Date Select regPaidamount |
|
266
|
|
|
$regFinancial = $this->isNew() ? Constants::FINANCIAL_UNPAID : $this->getVar('financial'); |
|
267
|
|
|
$default0 = '0' . $helper->getConfig('sep_comma') . '00'; |
|
268
|
|
|
$regPaidamount = $this->isNew() ? $default0 : Utility::FloatToString($this->getVar('paidamount')); |
|
269
|
|
|
if ($eventFee > 0 && $permRegistrationsApprove && !$test) { |
|
270
|
|
|
$regFinancialRadio = new \XoopsFormRadio(\_MA_WGEVENTS_REGISTRATION_FINANCIAL, 'financial', $regFinancial); |
|
|
|
|
|
|
271
|
|
|
$regFinancialRadio->addOption(Constants::FINANCIAL_UNPAID, \_MA_WGEVENTS_REGISTRATION_FINANCIAL_UNPAID); |
|
272
|
|
|
$regFinancialRadio->addOption(Constants::FINANCIAL_PAID, \_MA_WGEVENTS_REGISTRATION_FINANCIAL_PAID); |
|
273
|
|
|
$form->addElement($regFinancialRadio, true); |
|
274
|
|
|
$form->addElement(new \XoopsFormText(\_MA_WGEVENTS_REGISTRATION_PAIDAMOUNT, 'paidamount', 20, 150, $regPaidamount)); |
|
275
|
|
|
} else { |
|
276
|
|
|
if (!$this->isNew() && $eventFee > 0 && $test) { |
|
277
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_REGISTRATION_FINANCIAL, Utility::getFinancialText($regFinancial))); |
|
278
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_REGISTRATION_PAIDAMOUNT, $regPaidamount)); |
|
279
|
|
|
} |
|
280
|
|
|
$form->addElement(new \XoopsFormHidden('financial', $regFinancial)); |
|
281
|
|
|
$form->addElement(new \XoopsFormHidden('paidamount', $regPaidamount)); |
|
282
|
|
|
} |
|
283
|
|
|
// Form Radio Yes/No regListwait |
|
284
|
|
|
$regListwait = $this->isNew() ? 0 : (int)$this->getVar('listwait'); |
|
285
|
|
|
if ($eventRegisterMax > 0 && $permRegistrationsApprove && !$test) { |
|
286
|
|
|
$form->addElement(new \XoopsFormRadioYN(\_MA_WGEVENTS_REGISTRATION_LISTWAIT, 'listwait', $regListwait)); |
|
287
|
|
|
} else { |
|
288
|
|
|
if ($eventRegisterMax > 0 && $regListwait > 0 && $test) { |
|
289
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_REGISTRATION_LISTWAIT, \_YES)); |
|
290
|
|
|
} |
|
291
|
|
|
$form->addElement(new \XoopsFormHidden('listwait', $regListwait)); |
|
292
|
|
|
} |
|
293
|
|
|
// Form Text IP resIp |
|
294
|
|
|
$regIp = $_SERVER['REMOTE_ADDR']; |
|
295
|
|
|
// Form Text Select resStatus |
|
296
|
|
|
if ($this->isNew()) { |
|
297
|
|
|
$regStatus = Constants::STATUS_SUBMITTED; |
|
298
|
|
|
if ($permissionsHandler->getPermRegistrationsVerif()) { |
|
299
|
|
|
$regStatus = Constants::STATUS_VERIFIED; |
|
300
|
|
|
} |
|
301
|
|
|
if ($permRegistrationsApprove) { |
|
302
|
|
|
$regStatus = Constants::STATUS_APPROVED; |
|
303
|
|
|
} |
|
304
|
|
|
} else { |
|
305
|
|
|
$regStatus = $this->getVar('status'); |
|
306
|
|
|
} |
|
307
|
|
|
// Form Text resVerifcode |
|
308
|
|
|
$resVerifkey = $this->getVar('verifkey'); |
|
309
|
|
|
// Form Text Date Select regDatecreated |
|
310
|
|
|
$regDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated'); |
|
311
|
|
|
// Form Select User resSubmitter |
|
312
|
|
|
$regSubmitter = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
|
313
|
|
|
if ($permRegistrationsApprove && !$test) { |
|
314
|
|
|
$regStatusSelect = new \XoopsFormSelect(\_MA_WGEVENTS_STATUS, 'status', $regStatus); |
|
315
|
|
|
$regStatusSelect->addOption(Constants::STATUS_NONE, \_MA_WGEVENTS_STATUS_NONE); |
|
316
|
|
|
$regStatusSelect->addOption(Constants::STATUS_OFFLINE, \_MA_WGEVENTS_STATUS_OFFLINE); |
|
317
|
|
|
$regStatusSelect->addOption(Constants::STATUS_SUBMITTED, \_MA_WGEVENTS_STATUS_SUBMITTED); |
|
318
|
|
|
$regStatusSelect->addOption(Constants::STATUS_VERIFIED, \_MA_WGEVENTS_STATUS_VERIFIED); |
|
319
|
|
|
$regStatusSelect->addOption(Constants::STATUS_APPROVED, \_MA_WGEVENTS_STATUS_APPROVED); |
|
320
|
|
|
$form->addElement($regStatusSelect, true); |
|
321
|
|
|
} else { |
|
322
|
|
|
if (!$this->isNew() && !$test) { |
|
323
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_STATUS, Utility::getStatusText($regStatus))); |
|
324
|
|
|
} |
|
325
|
|
|
$form->addElement(new \XoopsFormHidden('status', $regStatus)); |
|
326
|
|
|
} |
|
327
|
|
|
if ($isAdmin) { |
|
328
|
|
|
$form->addElement(new \XoopsFormText(\_MA_WGEVENTS_REGISTRATION_IP, 'ip', 20, 150, $this->getVar('ip'))); |
|
|
|
|
|
|
329
|
|
|
$form->addElement(new \XoopsFormText(\_MA_WGEVENTS_REGISTRATION_VERIFKEY, 'verifkey', 20, 150, $resVerifkey)); |
|
330
|
|
|
// Form Text Date Select queDatecreated |
|
331
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $regDatecreated)); |
|
|
|
|
|
|
332
|
|
|
$form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $regSubmitter)); |
|
333
|
|
|
} else { |
|
334
|
|
|
$form->addElement(new \XoopsFormHidden('ip', $regIp)); |
|
335
|
|
|
$form->addElement(new \XoopsFormHidden('verifkey', $resVerifkey)); |
|
336
|
|
|
$form->addElement(new \XoopsFormHidden('datecreated_int', \time())); |
|
337
|
|
|
$form->addElement(new \XoopsFormHidden('submitter', $regSubmitter)); |
|
338
|
|
|
if (!$this->isNew() && !$test) { |
|
339
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_DATECREATED, \formatTimestamp($regDatecreated, 's'))); |
|
340
|
|
|
$form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_SUBMITTER, \XoopsUser::getUnameFromId($regSubmitter))); |
|
341
|
|
|
} |
|
342
|
|
|
} |
|
343
|
|
|
// To Save |
|
344
|
|
|
$form->addElement(new \XoopsFormHidden('id', $this->getVar('id'))); |
|
345
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'save')); |
|
346
|
|
|
$form->addElement(new \XoopsFormHidden('start', $this->start)); |
|
347
|
|
|
$form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
|
348
|
|
|
$form->addElement(new \XoopsFormHidden('redir', $this->redir)); |
|
349
|
|
|
$form->addElement(new \XoopsFormHidden('verifkeyEdit', $this->verifkeyEdit)); |
|
350
|
|
|
// button tray |
|
351
|
|
|
$buttonTray = new \XoopsFormElementTray(''); |
|
352
|
|
|
$buttonBack = new Forms\FormButton('', 'cancel', \_CANCEL, 'button'); |
|
353
|
|
|
$buttonBack->setExtra('onclick="history.go(-1);return true;"'); |
|
354
|
|
|
$buttonBack->setClass('btn-danger'); |
|
355
|
|
|
$buttonTray->addElement($buttonBack); |
|
356
|
|
|
if (!$test) { |
|
357
|
|
|
$buttonReset = new Forms\FormButton('', 'reset', \_RESET, 'reset'); |
|
358
|
|
|
$buttonReset->setClass('btn-warning'); |
|
359
|
|
|
$buttonTray->addElement($buttonReset); |
|
360
|
|
|
$buttonSubmit = new Forms\FormButton('', '_submit', \_MA_WGEVENTS_SAVE, 'submit'); |
|
361
|
|
|
$buttonSubmit->setClass('btn-primary'); |
|
362
|
|
|
$buttonTray->addElement($buttonSubmit); |
|
363
|
|
|
} |
|
364
|
|
|
$form->addElement($buttonTray); |
|
365
|
|
|
return $form; |
|
366
|
|
|
} |
|
367
|
|
|
|
|
368
|
|
|
/** |
|
369
|
|
|
* Get Values |
|
370
|
|
|
* @param null $keys |
|
|
|
|
|
|
371
|
|
|
* @param null $format |
|
|
|
|
|
|
372
|
|
|
* @param null $maxDepth |
|
|
|
|
|
|
373
|
|
|
* @return array |
|
374
|
|
|
*/ |
|
375
|
|
|
public function getValuesRegistrations($keys = null, $format = null, $maxDepth = null) |
|
376
|
|
|
{ |
|
377
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
|
378
|
|
|
$ret = $this->getValues($keys, $format, $maxDepth); |
|
379
|
|
|
$eventHandler = $helper->getHandler('Event'); |
|
380
|
|
|
$eventObj = $eventHandler->get($this->getVar('evid')); |
|
381
|
|
|
$ret['eventname'] = $eventObj->getVar('name'); |
|
382
|
|
|
$ret['salutation_text'] = Utility::getSalutationText($this->getVar('salutation')); |
|
383
|
|
|
$ret['status_text'] = Utility::getStatusText($this->getVar('status')); |
|
384
|
|
|
$ret['financial_text'] = Utility::getFinancialText($this->getVar('financial')); |
|
385
|
|
|
$ret['paidamount_text'] = Utility::FloatToString($this->getVar('paidamount')); |
|
386
|
|
|
$ret['listwait_text'] = (int)$this->getVar('listwait') > 0 ? \_YES : \_NO; |
|
387
|
|
|
$ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 'm'); |
|
388
|
|
|
$ret['submitter_text'] = \XoopsUser::getUnameFromId($this->getVar('submitter')); |
|
389
|
|
|
return $ret; |
|
390
|
|
|
} |
|
391
|
|
|
|
|
392
|
|
|
/** |
|
393
|
|
|
* Set start |
|
394
|
|
|
* @param $start |
|
395
|
|
|
* @return void |
|
396
|
|
|
*/ |
|
397
|
|
|
public function setStart($start) |
|
398
|
|
|
{ |
|
399
|
|
|
$this->start = $start; |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
/** |
|
403
|
|
|
* Set start |
|
404
|
|
|
* @param $limit |
|
405
|
|
|
* @return void |
|
406
|
|
|
*/ |
|
407
|
|
|
public function setLimit($limit) |
|
408
|
|
|
{ |
|
409
|
|
|
$this->limit = $limit; |
|
410
|
|
|
} |
|
411
|
|
|
|
|
412
|
|
|
/** |
|
413
|
|
|
* Set redir |
|
414
|
|
|
* @param $redir |
|
415
|
|
|
* @return void |
|
416
|
|
|
*/ |
|
417
|
|
|
public function setRedir($redir) |
|
418
|
|
|
{ |
|
419
|
|
|
$this->redir = $redir; |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* Set verifkeyEdit |
|
424
|
|
|
* @param $verifkey |
|
425
|
|
|
* @return void |
|
426
|
|
|
*/ |
|
427
|
|
|
public function setVerifkeyEdit($verifkey) |
|
428
|
|
|
{ |
|
429
|
|
|
$this->verifkeyEdit = $verifkey; |
|
430
|
|
|
} |
|
431
|
|
|
|
|
432
|
|
|
/** |
|
433
|
|
|
* Returns an array representation of the object |
|
434
|
|
|
* |
|
435
|
|
|
* @return array |
|
436
|
|
|
*/ |
|
437
|
|
|
/* |
|
438
|
|
|
public function toArray() |
|
439
|
|
|
{ |
|
440
|
|
|
$ret = []; |
|
441
|
|
|
$vars = $this->getVars(); |
|
442
|
|
|
foreach (\array_keys($vars) as $var) { |
|
443
|
|
|
$ret[$var] = $this->getVar($var); |
|
444
|
|
|
} |
|
445
|
|
|
return $ret; |
|
446
|
|
|
} |
|
447
|
|
|
*/ |
|
448
|
|
|
} |
|
449
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths