Registrationhist::getInstance()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 5
rs 10
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 Registrationhist
33
 */
34
class Registrationhist extends \XoopsObject
35
{
36
    /**
37
     * Constructor
38
     *
39
     */
40
    public function __construct()
41
    {
42
        $this->initVar('hist_id', \XOBJ_DTYPE_INT);
43
        $this->initVar('hist_info', \XOBJ_DTYPE_TXTBOX);
44
        $this->initVar('hist_datecreated', \XOBJ_DTYPE_INT);
45
        $this->initVar('hist_submitter', \XOBJ_DTYPE_INT);
46
        $this->initVar('id', \XOBJ_DTYPE_INT);
47
        $this->initVar('evid', \XOBJ_DTYPE_INT);
48
        $this->initVar('salutation', \XOBJ_DTYPE_INT);
49
        $this->initVar('firstname', \XOBJ_DTYPE_TXTBOX);
50
        $this->initVar('lastname', \XOBJ_DTYPE_TXTBOX);
51
        $this->initVar('email', \XOBJ_DTYPE_TXTBOX);
52
        $this->initVar('email_send', \XOBJ_DTYPE_INT);
53
        $this->initVar('gdpr', \XOBJ_DTYPE_INT);
54
        $this->initVar('ip', \XOBJ_DTYPE_TXTBOX);
55
        $this->initVar('status', \XOBJ_DTYPE_INT);
56
        $this->initVar('financial', \XOBJ_DTYPE_INT);
57
        $this->initVar('paidamount', \XOBJ_DTYPE_FLOAT);
58
        $this->initVar('listwait', \XOBJ_DTYPE_INT);
59
        $this->initVar('datecreated', \XOBJ_DTYPE_INT);
60
        $this->initVar('submitter', \XOBJ_DTYPE_INT);
61
    }
62
63
    /**
64
     * @static function &getInstance
65
     *
66
     */
67
    public static function getInstance()
68
    {
69
        static $instance = false;
70
        if (!$instance) {
71
            $instance = new self();
72
        }
73
    }
74
75
    /**
76
     * Get Values
77
     * @param null $keys
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $keys is correct as it would always require null to be passed?
Loading history...
78
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
79
     * @param null $maxDepth
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $maxDepth is correct as it would always require null to be passed?
Loading history...
80
     * @return array
81
     */
82
    public function getValuesRegistrationhists($keys = null, $format = null, $maxDepth = null)
83
    {
84
        $helper  = \XoopsModules\Wgevents\Helper::getInstance();
85
        $ret = $this->getValues($keys, $format, $maxDepth);
86
        $ret['hist_datecreated_text'] = \formatTimestamp($this->getVar('hist_datecreated'), 'm');
87
        $ret['hist_submitter_text']   = \XoopsUser::getUnameFromId($this->getVar('hist_submitter'));
88
        $eventHandler = $helper->getHandler('Event');
89
        $eventObj = $eventHandler->get($this->getVar('evid'));
90
        $ret['eventname']        = $eventObj->getVar('name');
91
        $ret['salutation_text']  = Utility::getSalutationText($this->getVar('salutation'));
92
        $ret['status_text']      = Utility::getStatusText($this->getVar('status'));
93
        $ret['financial_text']   = Utility::getFinancialText($this->getVar('financial'));
94
        $ret['paidamount_text']  = Utility::FloatToString($this->getVar('paidamount'));
95
        $ret['listwait_text']    = (int)$this->getVar('listwait') > 0 ? \_YES : \_NO;
96
        $ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 'm');
97
        $ret['submitter_text']   = \XoopsUser::getUnameFromId($this->getVar('submitter'));
98
        return $ret;
99
    }
100
101
}
102