Passed
Push — master ( dfe250...f7a069 )
by Goffy
04:12
created

EventHandler   C

Complexity

Total Complexity 57

Size/Duplication

Total Lines 492
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 220
c 1
b 0
f 0
dl 0
loc 492
rs 5.04
wmc 57

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getInsertId() 0 3 1
A create() 0 3 1
A get() 0 3 1
A getCountEvents() 0 5 1
A getAllEvents() 0 5 1
A __construct() 0 3 1
A getFormEventSelect() 0 21 2
A getEventsCriteria() 0 7 1
A getRecipientsNotify() 0 16 5
F getEvents() 0 125 18
B getFormFilterExport() 0 56 5
B getDateFromToText() 0 45 11
B getEventsCompare() 0 44 7
A getFormPageNavCounter() 0 29 2

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 null fields
0 ignored issues
show
Bug introduced by
The type XoopsModules\Wgevents\fields was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
     * @param null
72
     * @return int reference to the {@link Get} object
73
     */
74
    public function getInsertId()
75
    {
76
        return $this->db->getInsertId();
77
    }
78
79
    /**
80
     * Get Count Event in the database
81
     * @param int    $start
82
     * @param int    $limit
83
     * @param string $sort
84
     * @param string $order
85
     * @return int
86
     */
87
    public function getCountEvents($start = 0, $limit = 0, $sort = 'id', $order = 'DESC')
88
    {
89
        $crCountEvents = new \CriteriaCompo();
90
        $crCountEvents = $this->getEventsCriteria($crCountEvents, $start, $limit, $sort, $order);
91
        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

91
        return $this->getCount(/** @scrutinizer ignore-type */ $crCountEvents);
Loading history...
92
    }
93
94
    /**
95
     * Get All Event in the database
96
     * @param int    $start
97
     * @param int    $limit
98
     * @param string $sort
99
     * @param string $order
100
     * @return array
101
     */
102
    public function getAllEvents($start = 0, $limit = 0, $sort = 'id', $order = 'DESC')
103
    {
104
        $crAllEvents = new \CriteriaCompo();
105
        $crAllEvents = $this->getEventsCriteria($crAllEvents, $start, $limit, $sort, $order);
106
        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

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

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

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

504
        $form->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_DATEFROM, 'datefrom', /** @scrutinizer ignore-type */ '', $dateFrom), true);
Loading history...
505
        // Form Text Date Select evDateto
506
        $form->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_DATETO, 'dateto', '', $dateTo));
507
        // Form Select for setting limit of events
508
        $eventCountSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENTS_FILTER_NB, 'limit', $limit);
509
        $eventCountSelect->addOption(10, 10);
510
        $eventCountSelect->addOption(20, 20);
511
        $eventCountSelect->addOption(30, 30);
512
        $eventCountSelect->addOption(40, 40);
513
        $eventCountSelect->addOption(50, 50);
514
        $eventCountSelect->addOption(0, _ALL);
515
        $form->addElement($eventCountSelect);
516
        $btnFilter = new \XoopsFormButton('', 'submit', \_MA_WGEVENTS_APPLY_FILTER, 'submit');
517
        $btnFilter->setClass('btn btn-success');
518
        $form->addElement($btnFilter);
519
520
        // To Save
521
        $form->addElement(new \XoopsFormHidden('op', 'list'));
522
        $form->addElement(new \XoopsFormHidden('start', '0'));
523
        $form->addElement(new \XoopsFormHidden('new', '1'));
524
        //$form->addElement(new \XoopsFormHidden('filter', $filter));
525
        return $form;
526
    }
527
}
528