EventHandler   F
last analyzed

Complexity

Total Complexity 60

Size/Duplication

Total Lines 507
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 234
c 2
b 0
f 0
dl 0
loc 507
rs 3.6
wmc 60

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getInsertId() 0 3 1
A getCountEvents() 0 5 1
A getAllEvents() 0 5 1
A getFormEventSelect() 0 21 2
A getEventsCriteria() 0 7 1
A create() 0 3 1
A get() 0 3 1
A __construct() 0 3 1
A getFormPageNavCounter() 0 29 2
A getRecipientsNotify() 0 16 5
F getEvents() 0 121 19
B getFormFilterExport() 0 56 5
B getDateFromToText() 0 46 10
B getEventsCompare() 0 63 10

How to fix   Complexity   

Complex Class

Complex classes like EventHandler often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use EventHandler, and based on these observations, apply Extract Interface, too.

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\MailHandler;
29
30
31
/**
32
 * Class Object Handler Event
33
 */
34
class EventHandler extends \XoopsPersistableObjectHandler
35
{
36
    /**
37
     * Constructor
38
     *
39
     * @param \XoopsDatabase $db
40
     */
41
    public function __construct(\XoopsDatabase $db)
42
    {
43
        parent::__construct($db, 'wgevents_event', Event::class, 'id', 'name');
44
    }
45
46
    /**
47
     * @param bool $isNew
48
     *
49
     * @return object
50
     */
51
    public function create($isNew = true)
52
    {
53
        return parent::create($isNew);
54
    }
55
56
    /**
57
     * retrieve a field
58
     *
59
     * @param int $id field id
60
     * @param $fields
61
     * @return \XoopsObject|null reference to the {@link Get} object
62
     */
63
    public function get($id = null, $fields = null)
64
    {
65
        return parent::get($id, $fields);
66
    }
67
68
    /**
69
     * get inserted id
70
     *
71
     * @return int reference to the {@link Get} object
72
     */
73
    public function getInsertId()
74
    {
75
        return $this->db->getInsertId();
76
    }
77
78
    /**
79
     * Get Count Event in the database
80
     * @param int    $start
81
     * @param int    $limit
82
     * @param string $sort
83
     * @param string $order
84
     * @return int
85
     */
86
    public function getCountEvents($start = 0, $limit = 0, $sort = 'id', $order = 'DESC')
87
    {
88
        $crCountEvents = new \CriteriaCompo();
89
        $crCountEvents = $this->getEventsCriteria($crCountEvents, $start, $limit, $sort, $order);
90
        return $this->getCount($crCountEvents);
0 ignored issues
show
Bug introduced by
$crCountEvents of type integer is incompatible with the type CriteriaElement|null expected by parameter $criteria of XoopsPersistableObjectHandler::getCount(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

90
        return $this->getCount(/** @scrutinizer ignore-type */ $crCountEvents);
Loading history...
91
    }
92
93
    /**
94
     * Get All Event in the database
95
     * @param int    $start
96
     * @param int    $limit
97
     * @param string $sort
98
     * @param string $order
99
     * @return array
100
     */
101
    public function getAllEvents($start = 0, $limit = 0, $sort = 'id', $order = 'DESC')
102
    {
103
        $crAllEvents = new \CriteriaCompo();
104
        $crAllEvents = $this->getEventsCriteria($crAllEvents, $start, $limit, $sort, $order);
105
        return $this->getAll($crAllEvents);
0 ignored issues
show
Bug introduced by
$crAllEvents of type integer is incompatible with the type CriteriaElement|null expected by parameter $criteria of XoopsPersistableObjectHandler::getAll(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

105
        return $this->getAll(/** @scrutinizer ignore-type */ $crAllEvents);
Loading history...
106
    }
107
108
    /**
109
     * Get Criteria Event
110
     * @param        $crEvent
111
     * @param int $start
112
     * @param int $limit
113
     * @param string $sort
114
     * @param string $order
115
     * @return int
116
     */
117
    private function getEventsCriteria($crEvent, int $start, int $limit, string $sort, string $order)
118
    {
119
        $crEvent->setStart($start);
120
        $crEvent->setLimit($limit);
121
        $crEvent->setSort($sort);
122
        $crEvent->setOrder($order);
123
        return $crEvent;
124
    }
125
126
    /**
127
     * @public function getForm
128
     * @param bool $action
129
     * @return \XoopsThemeForm
130
     */
131
    public function getFormEventSelect($action = false)
132
    {
133
        $helper = Helper::getInstance();
134
        if (!$action) {
135
            $action = $_SERVER['REQUEST_URI'];
136
        }
137
        // Get Theme Form
138
        \xoops_load('XoopsFormLoader');
139
        $form = new \XoopsThemeForm(\_MA_WGEVENTS_EVENT_SELECT, 'form', $action, 'post', true);
140
        $form->setExtra('enctype="multipart/form-data"');
141
        // Form Table categories
142
        $eventHandler = $helper->getHandler('Event');
143
        $evidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_ID, 'evid', 0);
144
        $evidSelect->addOption('');
145
        $evidSelect->addOptionArray($eventHandler->getList());
146
        $evidSelect->setExtra("onchange='submit()'");
147
        $form->addElement($evidSelect);
148
        // To list
149
        $form->addElement(new \XoopsFormHidden('op', 'list'));
150
151
        return $form;
152
    }
153
154
    /**
155
     * TODO: not in use currently
156
     * @public function getForm
157
     * @param array  $params
158
     * @param string $action
159
     * @return Forms\FormInline
160
     */
161
    public function getFormPageNavCounter($params = [], $action = '')
162
    {
163
        if (!$action) {
164
            $action = $_SERVER['REQUEST_URI'];
165
        }
166
        // Get Theme Form
167
        \xoops_load('XoopsFormLoader');
168
        $form = new Forms\FormInline('', 'formPageNavCounter', $action, 'post', true);
169
        $form->setExtra('enctype="multipart/form-data"');
170
        // Form Table categories
171
        $pageNavTray = new Forms\FormElementTray('', '');
172
        $evidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_ID, 'limit', $params['limit']);
173
        $evidSelect->addOption(10);
174
        $evidSelect->addOption(20);
175
        $evidSelect->addOption(30);
176
        $evidSelect->addOption(40);
177
        $evidSelect->addOption(50);
178
        $evidSelect->addOption(100);
179
        $evidSelect->addOption(0, _ALL);
180
        $evidSelect->setExtra("onchange='submit()'");
181
        $pageNavTray->addElement($evidSelect);
182
        $form->addElement($pageNavTray);
183
        // To list
184
        $form->addElement(new \XoopsFormHidden('op',         $params['op']));
185
        $form->addElement(new \XoopsFormHidden('start', 0));
186
        $form->addElement(new \XoopsFormHidden('cat_id',     $params['cat_id']));
187
        $form->addElement(new \XoopsFormHidden('filterCats', $params['filterCats']));
188
189
        return $form;
190
    }
191
192
    /**
193
     * @public function to get events for given params
194
     *
195
     * @param int    $start
196
     * @param int    $limit
197
     * @param int    $dateFrom      // filter date created from (timestamp)
198
     * @param int    $dateTo        // filter date created to (timestamp)
199
     * @param string $sortBy
200
     * @param string $orderBy
201
     * @param string $op
202
     * @param int    $evId
203
     * @param string $filter
204
     * @param array  $filterCats
205
     * @param int    $dateCreated
206
     * @return array
207
     */
208
    public function getEvents($start = 0, $limit = 0, $dateFrom = 0, $dateTo = 0, $sortBy = 'datefrom', $orderBy = 'ASC', $op = 'list', $evId = 0, $filter = '', $filterCats = [], $dateCreated = 0)
209
    {
210
        $helper = Helper::getInstance();
211
212
        /*
213
        echo '<br>start:'.$start;
214
        echo '<br>limit:'.$limit;
215
        echo '<br>datefrom:'.\formatTimestamp($dateFrom, 'm').'('.$dateFrom.')';
216
        echo '<br>dateto:'.\formatTimestamp($dateTo, 'm').'('.$dateTo.')';
217
        echo '<br>sortBy:'.$sortBy;
218
        echo '<br>orderBy:'.$orderBy;
219
        echo '<br>op:'.$op;
220
        echo '<br>evId:'.$evId;
221
        echo '<br>filter:'.$filter;
222
        foreach ($filterCats as $filterCat) {
223
            echo '<br>filterCat:'.$filterCat;
224
        }
225
        */
226
227
        $showItem = ($evId > 0);
228
        $uidCurrent  = 0;
229
        $userIsAdmin = false;
230
        if (\is_object($GLOBALS['xoopsUser'])) {
231
            $uidCurrent  = $GLOBALS['xoopsUser']->uid();
232
            $userIsAdmin = $GLOBALS['xoopsUser']->isAdmin();
233
        }
234
        $useGroups = (bool)$helper->getConfig('use_groups');
235
236
        //apply criteria for events
237
        $crEvent = new \CriteriaCompo();
238
        if ($showItem) {
239
            $crEvent->add(new \Criteria('id', $evId));
240
        } elseif ('me' === $filter && $uidCurrent > 0) {
241
            $crEvent->add(new \Criteria('submitter', $uidCurrent));
242
        }
243
        //get only events which are online or from me
244
        $crEventOnline = new \CriteriaCompo();
245
        $crEventOnline->add(new \Criteria('status', Constants::STATUS_OFFLINE, '>'));
246
        $crEventOnline->add(new \Criteria('submitter', $uidCurrent), 'OR');
247
        $crEvent->add($crEventOnline);
248
249
        if ($dateCreated > 0) {
250
            $crEvent->add(new \Criteria('datecreated', $dateCreated, '>='));
251
        }
252
        // current user
253
        // - must have perm to see event or
254
        // - must be event owner
255
        // - is admin
256
        if ($useGroups && !$userIsAdmin) {
257
            $crEventGroup = new \CriteriaCompo();
258
            $crEventGroup->add(new \Criteria('groups', '%00000%', 'LIKE')); //all users
259
            if ($uidCurrent > 0) {
260
                // Get groups
261
                $memberHandler = \xoops_getHandler('member');
262
                $xoopsGroups = $memberHandler->getGroupsByUser($uidCurrent);
0 ignored issues
show
Bug introduced by
The method getGroupsByUser() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsMembershipHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

262
                /** @scrutinizer ignore-call */ 
263
                $xoopsGroups = $memberHandler->getGroupsByUser($uidCurrent);
Loading history...
263
                foreach ($xoopsGroups as $group) {
264
                    $crEventGroup->add(new \Criteria('groups', '%' . substr('00000' . $group, -5) . '%', 'LIKE'), 'OR');
265
                }
266
            }
267
            $crEventGroup->add(new \Criteria('submitter', $uidCurrent), 'OR');
268
            $crEvent->add($crEventGroup);
269
            unset($crEventGroup);
270
        }
271
        if (!$showItem) {
272
            if ('past' === $op) {
273
                // list events before now
274
                $crEvent->add(new \Criteria('datefrom', $dateFrom, '<'));
275
                $sortBy  = 'datefrom';
276
                $orderBy = 'DESC';
277
            } else {
278
                // calendar view:
279
                // - event start is between dateFrom and dateTo
280
                // - event end is between dateFrom and dateTo
281
                // ==> dateFrom and dateTo needed
282
283
                // index/event/block view:
284
                // - event start or event end is greater than dateFrom
285
                // ==> dateFrom needed, dateTo must be 0
286
                $crEventFromTo = new \CriteriaCompo();
287
                $crEventStart = new \CriteriaCompo();
288
                $crEventStart->add(new \Criteria('datefrom', $dateFrom, '>='));
289
                if ($dateTo > 0) {
290
                    $crEventStart->add(new \Criteria('datefrom', $dateTo, '<='));
291
                }
292
                $crEventFromTo->add($crEventStart);
293
                $crEventEnd = new \CriteriaCompo();
294
                $crEventEnd->add(new \Criteria('dateto', $dateFrom, '>='));
295
                if ($dateTo > 0) {
296
                    $crEventEnd->add(new \Criteria('dateto', $dateTo, '<='));
297
                }
298
                $crEventFromTo->add($crEventEnd, 'OR');
299
                $crEvent->add($crEventFromTo);
300
301
                unset($crEventStart, $crEventEnd, $crEventFromTo);
302
                $sortBy  = 'datefrom';
303
                $orderBy = 'ASC';
304
            }
305
            if (\count($filterCats) > 0) {
306
                $crEventCats = new \CriteriaCompo();
307
                $crEventCats->add(new \Criteria('catid', '(' . \implode(',', $filterCats) . ')', 'IN'));
308
                foreach ($filterCats as $filterCat) {
309
                    $crEventCats->add(new \Criteria('subcats', '%"' . $filterCat . '"%', 'LIKE'), 'OR');
310
                }
311
                $crEvent->add($crEventCats);
312
            }
313
        }
314
        $crEvent->setSort($sortBy);
315
        $crEvent->setOrder($orderBy);
316
        $eventsCount = $this->getCount($crEvent);
317
        if ($eventsCount > 0) {
318
            if ($limit > 0 && !$showItem) {
319
                $crEvent->setStart($start);
320
                $crEvent->setLimit($limit);
321
            }
322
            // Get All Event
323
            $eventsAll = $this->getAll($crEvent);
324
325
            return ['count' => $eventsCount, 'eventsAll' => $eventsAll];
326
        }
327
328
        return ['count' => 0, 'eventsAll' => []];
329
    }
330
331
    /**
332
     * compare two versions of events
333
     * @param  $versionOld
334
     * @param  $versionNew
335
     * @return string
336
     */
337
    public function getEventsCompare($versionOld, $versionNew)
338
    {
339
        $changedValues = [];
340
        // find changes in important fields of table events
341
        $fields = [];
342
        $fields[] = ['name' => 'name', 'caption' => \_MA_WGEVENTS_EVENT_NAME, 'type' => 'text'];
343
        $fields[] = ['name' => 'desc', 'caption' => \_MA_WGEVENTS_EVENT_DESC, 'type' => 'text'];
344
        $fields[] = ['name' => 'datefrom', 'caption' => \_MA_WGEVENTS_EVENT_DATEFROM, 'type' => 'datetime'];
345
        $fields[] = ['name' => 'dateto', 'caption' => \_MA_WGEVENTS_EVENT_DATETO, 'type' => 'datetime'];
346
        $fields[] = ['name' => 'location', 'caption' => \_MA_WGEVENTS_EVENT_LOCATION, 'type' => 'text'];
347
        $fields[] = ['name' => 'fee', 'caption' => \_MA_WGEVENTS_EVENT_FEE, 'type' => 'fee'];
348
349
        foreach ($fields as $field) {
350
            $valueOld = (string)$versionOld->getVar($field['name']);
351
            $valueNew = (string)$versionNew->getVar($field['name']);
352
            if ($valueOld !== $valueNew) {
353
                if ('' === $valueNew) {
354
                    $valueNew = _MA_WGEVENTS_MAIL_REG_MODIFICATION_DELETED;
355
                }
356
                switch ($field['type']) {
357
                    case 'datetime':
358
                        $changedValues[] = [
359
                            'caption' => $field['caption'],
360
                            'valueOld' => \formatTimestamp($valueOld, 'm'),
361
                            'valueNew' => \formatTimestamp($valueNew, 'm')
362
                        ];
363
                        break;
364
                    case 'fee':
365
                        $evFee = \json_decode($valueOld, true);
366
                        $evFeeText = '';
367
                        foreach($evFee as $fee) {
368
                            $evFeeText .= Utility::FloatToString((float)$fee[0]) . ' ' . $fee[1] . '<br>';
369
                        }
370
                        $valueOld = $evFeeText;
371
                        $evFee = \json_decode($valueNew, true);
372
                        $evFeeText = '';
373
                        foreach($evFee as $fee) {
374
                            $evFeeText .= Utility::FloatToString((float)$fee[0]) . ' ' . $fee[1] . '<br>';
375
                        }
376
                        $valueNew = $evFeeText;
377
                        $changedValues[] = [
378
                            'caption' => $field['caption'],
379
                            'valueOld' => $valueOld,
380
                            'valueNew' => $valueNew
381
                        ];
382
                        break;
383
                    case'default':
384
                    default:
385
                       $changedValues[] = [
386
                            'caption' => $field['caption'],
387
                            'valueOld' => $valueOld,
388
                            'valueNew' => $valueNew
389
                        ];
390
                        break;
391
                }
392
            }
393
        }
394
        if (\count($changedValues) > 0) {
395
            $mailHandler = new MailHandler();
396
            return $mailHandler->array2table ($changedValues);
397
        }
398
399
        return '';
400
    }
401
    /**
402
     * get email recipients for noticiations
403
     * @param  $registerNotify
404
     * @return array|false|string[]
405
     */
406
    public function getRecipientsNotify($registerNotify)
407
    {
408
        $notifyEmails   = preg_split("/\r\n|\n|\r/", $registerNotify);
409
        // no notification to myself
410
        if (\is_object($GLOBALS['xoopsUser'])) {
411
            $email = $GLOBALS['xoopsUser']->email();
412
            if ('' !== $email) {
413
                foreach ($notifyEmails as $key => $value) {
414
                    if ($value == $email) {
415
                        unset($notifyEmails[$key]);
416
                    }
417
                }
418
            }
419
       }
420
421
        return $notifyEmails;
422
    }
423
    /**
424
     * get clean date from/to for displaying
425
     * @param  int $datefrom
426
     * @param  int $dateto
427
     * @param  bool $allday
428
     * @return string
429
     */
430
    public function getDateFromToText($datefrom, $dateto, $allday)
431
    {
432
        $text       = '';
433
        $today      = date('d.m.Y', time()) === date('d.m.Y', $datefrom);
434
        $multiday   = (int)date('j', $dateto) !== (int)date('j', $datefrom);
435
        /*
436
        $days       = 1;
437
        if ($multiday) {
438
            $days = (1 + date_create(date('d.m.Y', $dateto))->diff(date_create(date('d.m.Y', $datefrom)))->format("%a"));
439
        }
440
        */
441
        $lng_until  = ' ' . \_MA_WGEVENTS_EVENT_DATEUNTIL . ' ';
442
        $lng_today  = \_MA_WGEVENTS_EVENT_TODAY;
443
        $lng_allday = \_MA_WGEVENTS_EVENT_ALLDAY;
444
445
        if ($today) {
446
            // get all types of today
447
            if ($allday && !$multiday) {
448
                // today, allday, no multiday
449
                $text = $lng_today . ' ' . $lng_allday;
450
            } elseif (!$allday && !$multiday) {
451
                // today, no allday, no multiday
452
                $text = $lng_today . ' ' . date('H:i', $datefrom) . $lng_until . date('H:i', $dateto);
453
            } else {
454
                // today, no allday, multiday
455
                $text = $lng_today . ' ' . date('H:i', $datefrom) . $lng_until . \formatTimestamp($dateto, 'm');
456
            }
457
        } elseif ($allday && $multiday) {
458
            // not today, allday, multiday
459
            $text =  \formatTimestamp($datefrom, 's') . $lng_allday . $lng_until . \formatTimestamp($dateto, 'm') . $lng_allday;
460
        } elseif (!$allday && !$multiday) {
461
            // not today, no allday, no multiday
462
            $text = \formatTimestamp($datefrom, 's') . ' ' . date('H:i', $datefrom) . $lng_until . date('H:i', $dateto);
463
        } else {
464
            // not today, no allday, multiday
465
            $text = \formatTimestamp($datefrom, 'm') . $lng_until . \formatTimestamp($dateto, 'm');
466
            //TODO: same time for each day / different times for different days
467
        }
468
        /*
469
        echo '<br>today:'.$today;
470
        echo '<br>datefrom:'.\formatTimestamp($datefrom, 'm');
471
        echo '<br>dateto:'.\formatTimestamp($dateto, 'm');
472
        echo '<br>multiday:'.$multiday;
473
        echo '<br>return:'.$text;
474
        */
475
        return $text;
476
    }
477
478
479
    /**
480
     * @public function getFormFilterExport: form for selecting cats and number of lines for export of events
481
     * @param bool  $eventDisplayCats
482
     * @param array $filterCats
483
     * @return \XoopsThemeForm
484
     */
485
    public function getFormFilterExport($limit, $dateFrom, $dateTo, $eventDisplayCats = false, $filterCats = [])
486
    {
487
        $helper = Helper::getInstance();
488
489
        $categoryHandler = $helper->getHandler('Category');
490
        // Get Theme Form
491
        \xoops_load('XoopsFormLoader');
492
        $form = new \XoopsThemeForm('', 'formFilterExport', $_SERVER['REQUEST_URI'], 'post', true);
493
        $form->setExtra('enctype="multipart/form-data"');
494
495
        if ($eventDisplayCats) {
496
            $cbAll = 1;
497
            // Form Select categories
498
            $catsOnline = $categoryHandler->getAllCatsOnline();
499
            if (0 === \count($filterCats)) {
500
                foreach (\array_keys($catsOnline) as $i) {
501
                    $filterCats[] = $i;
502
                }
503
            } elseif (\count($filterCats) < \count($catsOnline)) {
504
                $cbAll = 0;
505
            }
506
            $catTray = new \XoopsFormElementTray(\_MA_WGEVENTS_CATEGORY_FILTER);
507
            // checkbox for(de)select all
508
            $catAllSelect = new Forms\FormCheckboxInline('', 'all_cats', $cbAll);
509
            $catAllSelect->addOption(1, _ALL);
510
            $catAllSelect->setExtra(" onclick='toggleAllCats()' ");
511
            // checkboxes for all existing categories
512
            $catTray->addElement($catAllSelect);
513
            $catSelect = new Forms\FormCheckboxInline('', 'filter_cats', $filterCats);
514
            $catSelect->addOptionArray($catsOnline);
515
            $catTray->addElement($catSelect);
516
            $form->addElement($catTray);
517
        }
518
        // Form Text Date Select evDateto
519
        $form->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_DATEFROM, 'datefrom', 15, $dateFrom), true);
520
        // Form Text Date Select evDateto
521
        $form->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_DATETO, 'dateto', 15, $dateTo));
522
        // Form Select for setting limit of events
523
        $eventCountSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENTS_FILTER_NB, 'limit', $limit);
524
        $eventCountSelect->addOption(10, 10);
525
        $eventCountSelect->addOption(20, 20);
526
        $eventCountSelect->addOption(30, 30);
527
        $eventCountSelect->addOption(40, 40);
528
        $eventCountSelect->addOption(50, 50);
529
        $eventCountSelect->addOption(0, _ALL);
530
        $form->addElement($eventCountSelect);
531
        $btnFilter = new \XoopsFormButton('', 'submit', \_MA_WGEVENTS_APPLY_FILTER, 'submit');
532
        $btnFilter->setClass('btn btn-success');
533
        $form->addElement($btnFilter);
534
535
        // To Save
536
        $form->addElement(new \XoopsFormHidden('op', 'list'));
537
        $form->addElement(new \XoopsFormHidden('start', '0'));
538
        $form->addElement(new \XoopsFormHidden('new', '1'));
539
        //$form->addElement(new \XoopsFormHidden('filter', $filter));
540
        return $form;
541
    }
542
}
543