1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace XoopsModules\Wgevents; |
5
|
|
|
|
6
|
|
|
/* |
7
|
|
|
You may not change or alter any portion of this comment or credits |
8
|
|
|
of supporting developers from this source code or any supporting source code |
9
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
10
|
|
|
|
11
|
|
|
This program is distributed in the hope that it will be useful, |
12
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* wgEvents module for xoops |
18
|
|
|
* |
19
|
|
|
* @copyright 2021 XOOPS Project (https://xoops.org) |
20
|
|
|
* @license GPL 2.0 or later |
21
|
|
|
* @package wgevents |
22
|
|
|
* @since 1.0.0 |
23
|
|
|
* @min_xoops 2.5.11 Beta1 |
24
|
|
|
* @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
use XoopsModules\Wgevents; |
28
|
|
|
use XoopsModules\Wgevents\Utility; |
29
|
|
|
|
30
|
|
|
\defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Class Object Category |
34
|
|
|
*/ |
35
|
|
|
class Category extends \XoopsObject |
36
|
|
|
{ |
37
|
|
|
/** |
38
|
|
|
* @var int |
39
|
|
|
*/ |
40
|
|
|
public $start = 0; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var int |
44
|
|
|
*/ |
45
|
|
|
public $limit = 0; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Constructor |
49
|
|
|
* |
50
|
|
|
*/ |
51
|
|
|
public function __construct() |
52
|
|
|
{ |
53
|
|
|
$this->initVar('id', \XOBJ_DTYPE_INT); |
54
|
|
|
$this->initVar('pid', \XOBJ_DTYPE_INT); |
55
|
|
|
$this->initVar('name', \XOBJ_DTYPE_TXTBOX); |
56
|
|
|
$this->initVar('desc', \XOBJ_DTYPE_OTHER); |
57
|
|
|
$this->initVar('logo', \XOBJ_DTYPE_TXTBOX); |
58
|
|
|
$this->initVar('image', \XOBJ_DTYPE_TXTBOX); |
59
|
|
|
$this->initVar('color', \XOBJ_DTYPE_TXTBOX); |
60
|
|
|
$this->initVar('bordercolor', \XOBJ_DTYPE_TXTBOX); |
61
|
|
|
$this->initVar('bgcolor', \XOBJ_DTYPE_TXTBOX); |
62
|
|
|
$this->initVar('othercss', \XOBJ_DTYPE_TXTBOX); |
63
|
|
|
$this->initVar('type', \XOBJ_DTYPE_INT); |
64
|
|
|
$this->initVar('status', \XOBJ_DTYPE_INT); |
65
|
|
|
$this->initVar('weight', \XOBJ_DTYPE_INT); |
66
|
|
|
$this->initVar('identifier', \XOBJ_DTYPE_TXTBOX); |
67
|
|
|
$this->initVar('datecreated', \XOBJ_DTYPE_INT); |
68
|
|
|
$this->initVar('submitter', \XOBJ_DTYPE_INT); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @static function &getInstance |
73
|
|
|
* |
74
|
|
|
*/ |
75
|
|
|
public static function getInstance() |
76
|
|
|
{ |
77
|
|
|
static $instance = false; |
78
|
|
|
if (!$instance) { |
79
|
|
|
$instance = new self(); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* The new inserted $Id |
85
|
|
|
* @return inserted id |
|
|
|
|
86
|
|
|
*/ |
87
|
|
|
public function getNewInsertedIdCategories() |
88
|
|
|
{ |
89
|
|
|
return $GLOBALS['xoopsDB']->getInsertId(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @public function getForm |
94
|
|
|
* @param bool $action |
95
|
|
|
* @return \XoopsThemeForm |
96
|
|
|
*/ |
97
|
|
|
public function getForm($action = false) |
98
|
|
|
{ |
99
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
100
|
|
|
if (!$action) { |
101
|
|
|
$action = $_SERVER['REQUEST_URI']; |
102
|
|
|
} |
103
|
|
|
$isAdmin = (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
104
|
|
|
// Title |
105
|
|
|
$title = $this->isNew() ? \_AM_WGEVENTS_CATEGORY_ADD : \_AM_WGEVENTS_CATEGORY_EDIT; |
106
|
|
|
// Get Theme Form |
107
|
|
|
\xoops_load('XoopsFormLoader'); |
108
|
|
|
$form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
109
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
110
|
|
|
// Form Table categories |
111
|
|
|
$categoryHandler = $helper->getHandler('Category'); |
112
|
|
|
$catPidSelect = new \XoopsFormSelect(\_AM_WGEVENTS_CATEGORY_PID, 'pid', $this->getVar('pid')); |
113
|
|
|
$catPidSelect->addOption(''); |
114
|
|
|
$catPidSelect->addOptionArray($categoryHandler->getList()); |
115
|
|
|
$form->addElement($catPidSelect); |
116
|
|
|
// Form Text catName |
117
|
|
|
$form->addElement(new \XoopsFormText(\_AM_WGEVENTS_CATEGORY_NAME, 'name', 50, 255, $this->getVar('name')), true); |
|
|
|
|
118
|
|
|
// Form Editor DhtmlTextArea catDesc |
119
|
|
|
$editorConfigs = []; |
120
|
|
|
if ($isAdmin) { |
121
|
|
|
$editor = $helper->getConfig('editor_admin'); |
122
|
|
|
} else { |
123
|
|
|
$editor = $helper->getConfig('editor_user'); |
124
|
|
|
} |
125
|
|
|
$editorConfigs['name'] = 'desc'; |
126
|
|
|
$editorConfigs['value'] = $this->getVar('desc', 'e'); |
127
|
|
|
$editorConfigs['rows'] = 5; |
128
|
|
|
$editorConfigs['cols'] = 40; |
129
|
|
|
$editorConfigs['width'] = '100%'; |
130
|
|
|
$editorConfigs['height'] = '400px'; |
131
|
|
|
$editorConfigs['editor'] = $editor; |
132
|
|
|
$form->addElement(new \XoopsFormEditor(\_AM_WGEVENTS_CATEGORY_DESC, 'desc', $editorConfigs)); |
133
|
|
|
// Form Image catLogo |
134
|
|
|
// Form Image catLogo: Select Uploaded Image |
135
|
|
|
$getCatLogo = $this->getVar('logo'); |
136
|
|
|
$catLogo = $getCatLogo ?: 'blank.gif'; |
137
|
|
|
$logoDirectory = '/uploads/wgevents/categories/logos'; |
138
|
|
|
$logoTray = new \XoopsFormElementTray(\_AM_WGEVENTS_CATEGORY_LOGO, '<br>'); |
139
|
|
|
$logoSelect = new \XoopsFormSelect(\sprintf(\_AM_WGEVENTS_CATEGORY_LOGO_UPLOADS, ".$logoDirectory/"), 'logo', $catLogo, 5); |
140
|
|
|
$logoArray = \XoopsLists::getImgListAsArray( \XOOPS_ROOT_PATH . $logoDirectory ); |
141
|
|
|
foreach ($logoArray as $logo1) { |
142
|
|
|
$logoSelect->addOption($logo1, $logo1); |
143
|
|
|
} |
144
|
|
|
$logoSelect->setExtra("onchange='showImgSelected(\"imglabel_cat_logo\", \"logo\", \"" . $logoDirectory . '", "", "' . \XOOPS_URL . "\")'"); |
145
|
|
|
$logoTray->addElement($logoSelect); |
146
|
|
|
$logoTray->addElement(new \XoopsFormLabel('', "<br><img src='" . \XOOPS_URL . '/' . $logoDirectory . '/' . $catLogo . "' id='imglabel_cat_logo' alt='' style='max-width:100px' >")); |
147
|
|
|
// Form Image catLogo: Upload new image |
148
|
|
|
$maxsize = $helper->getConfig('maxsize_image'); |
149
|
|
|
$logoTray->addElement(new \XoopsFormFile('<br>' . \_AM_WGEVENTS_FORM_UPLOAD_NEW, 'logo', $maxsize)); |
150
|
|
|
$logoTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . \_AM_WGEVENTS_FORM_UPLOAD_SIZE_MB)); |
151
|
|
|
$logoTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
152
|
|
|
$logoTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
153
|
|
|
$form->addElement($logoTray); |
154
|
|
|
|
155
|
|
|
|
156
|
|
|
|
157
|
|
|
// Form Image catImage |
158
|
|
|
// Form Image catImage: Select Uploaded Image |
159
|
|
|
$getCatImage = $this->getVar('logo'); |
160
|
|
|
$catImage = $getCatImage ?: 'blank.gif'; |
161
|
|
|
$imageDirectory = '/uploads/wgevents/categories/images'; |
162
|
|
|
$imageTray = new \XoopsFormElementTray(\_AM_WGEVENTS_CATEGORY_IMAGE, '<br>'); |
163
|
|
|
$imageSelect = new \XoopsFormSelect(\sprintf(\_AM_WGEVENTS_CATEGORY_IMAGE_UPLOADS, ".$imageDirectory/"), 'image', $catImage, 5); |
164
|
|
|
$imageArray = \XoopsLists::getImgListAsArray( \XOOPS_ROOT_PATH . $imageDirectory ); |
165
|
|
|
foreach ($imageArray as $image1) { |
166
|
|
|
$imageSelect->addOption(($image1), $image1); |
167
|
|
|
} |
168
|
|
|
$imageSelect->setExtra("onchange='showImgSelected(\"imglabel_cat_image\", \"image\", \"" . $imageDirectory . '", "", "' . \XOOPS_URL . "\")'"); |
169
|
|
|
$imageTray->addElement($imageSelect); |
170
|
|
|
$imageTray->addElement(new \XoopsFormLabel('', "<br><img src='" . \XOOPS_URL . '/' . $imageDirectory . '/' . $catImage . "' id='imglabel_cat_image' alt='' style='max-width:100px' >")); |
171
|
|
|
// Form Image catImage: Upload new image |
172
|
|
|
$imageTray->addElement(new \XoopsFormFile('<br>' . \_AM_WGEVENTS_FORM_UPLOAD_NEW, 'image', $maxsize)); |
173
|
|
|
$imageTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . \_AM_WGEVENTS_FORM_UPLOAD_SIZE_MB)); |
174
|
|
|
$imageTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
175
|
|
|
$imageTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
176
|
|
|
$form->addElement($imageTray); |
177
|
|
|
|
178
|
|
|
|
179
|
|
|
|
180
|
|
|
|
181
|
|
|
// Form Color Picker catColor |
182
|
|
|
$catColor = $this->isNew() ? '#000000' : (string)$this->getVar('color'); |
183
|
|
|
$form->addElement(new \XoopsFormColorPicker(\_AM_WGEVENTS_CATEGORY_COLOR, 'color', $catColor)); |
184
|
|
|
// Form Color Picker catBorderColor |
185
|
|
|
$catBorderColor = $this->isNew() ? '#cccccc' : (string)$this->getVar('bordercolor'); |
186
|
|
|
$form->addElement(new \XoopsFormColorPicker(\_AM_WGEVENTS_CATEGORY_BORDERCOLOR, 'bordercolor', $catBorderColor)); |
187
|
|
|
// Form Color Picker catBgColor |
188
|
|
|
$catBgColor = $this->isNew() ? '#ffffff' : (string)$this->getVar('bgcolor'); |
189
|
|
|
$form->addElement(new \XoopsFormColorPicker(\_AM_WGEVENTS_CATEGORY_BGCOLOR, 'bgcolor', $catBgColor)); |
190
|
|
|
// Form Text catOtherstyles |
191
|
|
|
$catOtherstyles = $this->isNew() ? 'margin:1px 0;padding:8px 5px 20px 5px;border-radius:5px;' : $this->getVar('othercss'); |
192
|
|
|
$form->addElement(new \XoopsFormText(\_AM_WGEVENTS_CATEGORY_OTHERCSS, 'othercss', 100, 255, $catOtherstyles)); |
193
|
|
|
// Form Text catIdentifier |
194
|
|
|
$catIdentifier = new \XoopsFormText(\_AM_WGEVENTS_CATEGORY_IDENTIFIER, 'identifier', 100, 255, $this->getVar('identifier')); |
195
|
|
|
$catIdentifier->setDescription(\_AM_WGEVENTS_CATEGORY_IDENTIFIER_DESC); |
196
|
|
|
$form->addElement($catIdentifier); |
197
|
|
|
// Form Radio catStatus |
198
|
|
|
$catStatus = $this->isNew() ? Constants::STATUS_OFFLINE : $this->getVar('status'); |
199
|
|
|
$catStatusRadio = new \XoopsFormRadio(\_MA_WGEVENTS_STATUS, 'status', $catStatus); |
|
|
|
|
200
|
|
|
$catStatusRadio->addOption(Constants::STATUS_OFFLINE, \_MA_WGEVENTS_STATUS_OFFLINE); |
201
|
|
|
$catStatusRadio->addOption(Constants::STATUS_ONLINE, \_MA_WGEVENTS_STATUS_ONLINE); |
202
|
|
|
$form->addElement($catStatusRadio); |
203
|
|
|
// Form Radio catType |
204
|
|
|
$catType = $this->isNew() ? Constants::CATEGORY_TYPE_BOTH : (int)$this->getVar('type'); |
205
|
|
|
$catTypeRadio = new \XoopsFormRadio(\_AM_WGEVENTS_CATEGORY_TYPE, 'type', $catType); |
206
|
|
|
$catTypeRadio->addOption(Constants::CATEGORY_TYPE_MAIN, \_AM_WGEVENTS_CATEGORY_TYPE_MAIN); |
207
|
|
|
$catTypeRadio->addOption(Constants::CATEGORY_TYPE_SUB, \_AM_WGEVENTS_CATEGORY_TYPE_SUB); |
208
|
|
|
$catTypeRadio->addOption(Constants::CATEGORY_TYPE_BOTH, \_AM_WGEVENTS_CATEGORY_TYPE_BOTH); |
209
|
|
|
$form->addElement($catTypeRadio); |
210
|
|
|
// Form Text catWeight |
211
|
|
|
$catWeight = $this->getVar('weight'); |
212
|
|
|
if ($this->isNew()) { |
213
|
|
|
$catWeight = $categoryHandler->getNextWeight(); |
214
|
|
|
} |
215
|
|
|
$form->addElement(new \XoopsFormText(\_MA_WGEVENTS_WEIGHT, 'weight', 50, 255, $catWeight)); |
216
|
|
|
// Form Text Date Select catDatecreated |
217
|
|
|
$catDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated'); |
218
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $catDatecreated)); |
|
|
|
|
219
|
|
|
// Form Select User catSubmitter |
220
|
|
|
$uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
221
|
|
|
$catSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter'); |
222
|
|
|
$form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $catSubmitter)); |
223
|
|
|
/* |
224
|
|
|
// Permission |
225
|
|
|
$memberHandler = \xoops_getHandler('member'); |
226
|
|
|
$groupList = $memberHandler->getGroupList(); |
227
|
|
|
$grouppermHandler = \xoops_getHandler('groupperm'); |
228
|
|
|
$fullList[] = \array_keys($groupList); |
229
|
|
|
if ($this->isNew()) { |
230
|
|
|
$groupsCanApproveEventsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_EVENTS_APPROVE, 'groups_approve_cat_events[]', $fullList); |
231
|
|
|
$groupsCanSubmitEventsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_EVENTS_SUBMIT, 'groups_submit_cat_events[]', $fullList); |
232
|
|
|
$groupsCanViewEventsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_EVENTS_VIEW, 'groups_view_cat_events[]', $fullList); |
233
|
|
|
$groupsCanApproveRegsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_REGS_APPROVE, 'groups_approve_cat_regs[]', $fullList); |
234
|
|
|
$groupsCanSubmitRegsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_REGS_SUBMIT, 'groups_submit_cat_regs[]', $fullList); |
235
|
|
|
$groupsCanViewRegsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_REGS_VIEW, 'groups_view_cat_regs[]', $fullList); |
236
|
|
|
} else { |
237
|
|
|
$groupsIdsApproveEvents = $grouppermHandler->getGroupIds('wgevents_approve_cat_events', $this->getVar('id'), $GLOBALS['xoopsModule']->getVar('mid')); |
238
|
|
|
$groupsIdsApproveEvents[] = \array_values($groupsIdsApproveEvents); |
239
|
|
|
$groupsCanApproveEventsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_EVENTS_APPROVE, 'groups_approve_cat_events[]', $groupsIdsApproveEvents); |
240
|
|
|
$groupsIdsSubmitEvents = $grouppermHandler->getGroupIds('wgevents_submit_cat_events', $this->getVar('id'), $GLOBALS['xoopsModule']->getVar('mid')); |
241
|
|
|
$groupsIdsSubmitEvents[] = \array_values($groupsIdsSubmitEvents); |
242
|
|
|
$groupsCanSubmitEventsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_EVENTS_SUBMIT, 'groups_submit_cat_events[]', $groupsIdsSubmitEvents); |
243
|
|
|
$groupsIdsViewEvents = $grouppermHandler->getGroupIds('wgevents_view_cat_events', $this->getVar('id'), $GLOBALS['xoopsModule']->getVar('mid')); |
244
|
|
|
$groupsIdsViewEvents[] = \array_values($groupsIdsViewEvents); |
245
|
|
|
$groupsCanViewEventsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_EVENTS_VIEW, 'groups_view_cat_events[]', $groupsIdsViewEvents); |
246
|
|
|
$groupsIdsApproveRegs = $grouppermHandler->getGroupIds('wgevents_approve_cat_regs', $this->getVar('id'), $GLOBALS['xoopsModule']->getVar('mid')); |
247
|
|
|
$groupsIdsApproveRegs[] = \array_values($groupsIdsApproveRegs); |
248
|
|
|
$groupsCanApproveRegsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_REGS_APPROVE, 'groups_approve_cat_regs[]', $groupsIdsApproveRegs); |
249
|
|
|
$groupsIdsSubmitRegs = $grouppermHandler->getGroupIds('wgevents_submit_cat_regs', $this->getVar('id'), $GLOBALS['xoopsModule']->getVar('mid')); |
250
|
|
|
$groupsIdsSubmitRegs[] = \array_values($groupsIdsSubmitRegs); |
251
|
|
|
$groupsCanSubmitRegsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_REGS_SUBMIT, 'groups_submit_cat_regs[]', $groupsIdsSubmitRegs); |
252
|
|
|
$groupsIdsViewRegs = $grouppermHandler->getGroupIds('wgevents_view_cat_regs', $this->getVar('id'), $GLOBALS['xoopsModule']->getVar('mid')); |
253
|
|
|
$groupsIdsViewRegs[] = \array_values($groupsIdsViewRegs); |
254
|
|
|
$groupsCanViewRegsCheckbox = new \XoopsFormCheckBox(\_AM_WGEVENTS_PERMISSIONS_CAT_REGS_VIEW, 'groups_view_cat_regs[]', $groupsIdsViewRegs); |
255
|
|
|
} |
256
|
|
|
// To Approve |
257
|
|
|
$groupsCanApproveEventsCheckbox->addOptionArray($groupList); |
258
|
|
|
$form->addElement($groupsCanApproveEventsCheckbox); |
259
|
|
|
// To Submit |
260
|
|
|
$groupsCanSubmitEventsCheckbox->addOptionArray($groupList); |
261
|
|
|
$form->addElement($groupsCanSubmitEventsCheckbox); |
262
|
|
|
// To View |
263
|
|
|
$groupsCanViewEventsCheckbox->addOptionArray($groupList); |
264
|
|
|
$form->addElement($groupsCanViewEventsCheckbox); |
265
|
|
|
// To Approve |
266
|
|
|
$groupsCanApproveRegsCheckbox->addOptionArray($groupList); |
267
|
|
|
$form->addElement($groupsCanApproveRegsCheckbox); |
268
|
|
|
// To Submit |
269
|
|
|
$groupsCanSubmitRegsCheckbox->addOptionArray($groupList); |
270
|
|
|
$form->addElement($groupsCanSubmitRegsCheckbox); |
271
|
|
|
// To View |
272
|
|
|
$groupsCanViewRegsCheckbox->addOptionArray($groupList); |
273
|
|
|
$form->addElement($groupsCanViewRegsCheckbox); |
274
|
|
|
*/ |
275
|
|
|
// To Save |
276
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'save')); |
277
|
|
|
$form->addElement(new \XoopsFormHidden('start', $this->start)); |
278
|
|
|
$form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
279
|
|
|
$form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); |
280
|
|
|
return $form; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* Get Values |
285
|
|
|
* @param null $keys |
|
|
|
|
286
|
|
|
* @param null $format |
|
|
|
|
287
|
|
|
* @param null $maxDepth |
|
|
|
|
288
|
|
|
* @return array |
289
|
|
|
*/ |
290
|
|
|
public function getValuesCategories($keys = null, $format = null, $maxDepth = null) |
291
|
|
|
{ |
292
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
293
|
|
|
$utility = new \XoopsModules\Wgevents\Utility(); |
294
|
|
|
$ret = $this->getValues($keys, $format, $maxDepth); |
295
|
|
|
$categoryHandler = $helper->getHandler('Category'); |
296
|
|
|
$categoryObj = $categoryHandler->get($this->getVar('pid')); |
297
|
|
|
$pidText = '(' . $this->getVar('pid') . ') '; |
298
|
|
|
if (is_object($categoryObj)) { |
299
|
|
|
$pidText .= $categoryObj->getVar('name'); |
300
|
|
|
} |
301
|
|
|
$ret['pid_text'] = $pidText; |
302
|
|
|
$ret['desc_text'] = $this->getVar('desc', 'e'); |
303
|
|
|
$editorMaxchar = $helper->getConfig('admin_maxchar'); |
304
|
|
|
$ret['desc_short'] = $utility::truncateHtml($ret['desc_text'], $editorMaxchar); |
305
|
|
|
$ret['status_text'] = Utility::getStatusText($this->getVar('status')); |
306
|
|
|
$catType = (int)$this->getVar('type'); |
307
|
|
|
switch ($catType) { |
308
|
|
|
case Constants::CATEGORY_TYPE_MAIN: |
309
|
|
|
$catTypeText = \_AM_WGEVENTS_CATEGORY_TYPE_MAIN; |
310
|
|
|
break; |
311
|
|
|
case Constants::CATEGORY_TYPE_SUB: |
312
|
|
|
$catTypeText = \_AM_WGEVENTS_CATEGORY_TYPE_SUB; |
313
|
|
|
break; |
314
|
|
|
case Constants::CATEGORY_TYPE_BOTH: |
315
|
|
|
default: |
316
|
|
|
$catTypeText = \_AM_WGEVENTS_CATEGORY_TYPE_BOTH; |
317
|
|
|
break; |
318
|
|
|
} |
319
|
|
|
$ret['type_text'] = $catTypeText; |
320
|
|
|
$ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 's'); |
321
|
|
|
$ret['submitter_text'] = \XoopsUser::getUnameFromId($this->getVar('submitter')); |
322
|
|
|
return $ret; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* Returns an array representation of the object |
327
|
|
|
* |
328
|
|
|
* @return array |
329
|
|
|
*/ |
330
|
|
|
/* |
331
|
|
|
public function toArrayCategories() |
332
|
|
|
{ |
333
|
|
|
$ret = []; |
334
|
|
|
$vars = $this->getVars(); |
335
|
|
|
foreach (\array_keys($vars) as $var) { |
336
|
|
|
$ret[$var] = $this->getVar($var); |
337
|
|
|
} |
338
|
|
|
return $ret; |
339
|
|
|
} |
340
|
|
|
*/ |
341
|
|
|
} |
342
|
|
|
|
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