Passed
Push — master ( 919ce4...d1101e )
by Michael
03:15 queued 11s
created

Listing   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 44
dl 0
loc 83
rs 10
c 1
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getForm() 0 3 1
A __construct() 0 34 1
A getGroupsRead() 0 6 1
A getGroupsSubmit() 0 6 1
A getGroupsModeration() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Adslight;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
*/
16
17
use Xmf\Module\Helper\Permission;
18
19
/**
20
 * Module: Adslight
21
 *
22
 * @category        Module
23
 * @package         adslight
24
 * @author          XOOPS Development Team <https://xoops.org>
25
 * @copyright       {@link https://xoops.org/ XOOPS Project}
26
 * @license         GPL 2.0 or later
27
 * @link            https://xoops.org/
28
 * @since           1.0.0
29
 */
30
31
//$permHelper = new \Xmf\Module\Helper\Permission();
32
33
/**
34
 * Class Listing
35
 */
36
class Listing extends \XoopsObject
37
{
38
    public $helper;
39
    public $permHelper;
40
41
    /**
42
     * Constructor
43
     *
44
     * @param null
45
     */
46
    public function __construct()
47
    {
48
        parent::__construct();
49
        /** @var Helper $helper */
50
        $this->helper     = Helper::getInstance();
51
        $this->permHelper = new Permission();
52
        $this->initVar('lid', \XOBJ_DTYPE_INT);
53
        $this->initVar('cid', \XOBJ_DTYPE_INT);
54
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX);
55
        $this->initVar('status', \XOBJ_DTYPE_INT);
56
        $this->initVar('expire', \XOBJ_DTYPE_TXTBOX);
57
        $this->initVar('type', \XOBJ_DTYPE_TXTBOX);
58
        $this->initVar('desctext', \XOBJ_DTYPE_OTHER);
59
        $this->initVar('tel', \XOBJ_DTYPE_TXTBOX);
60
        $this->initVar('price', \XOBJ_DTYPE_DECIMAL);
61
        $this->initVar('typeprice', \XOBJ_DTYPE_TXTBOX);
62
        $this->initVar('typecondition', \XOBJ_DTYPE_TXTBOX);
63
        $this->initVar('date_created', \XOBJ_DTYPE_INT);
64
        $this->initVar('email', \XOBJ_DTYPE_TXTBOX);
65
        $this->initVar('submitter', \XOBJ_DTYPE_TXTBOX);
66
        $this->initVar('usid', \XOBJ_DTYPE_TXTBOX);
67
        $this->initVar('town', \XOBJ_DTYPE_TXTBOX);
68
        $this->initVar('country', \XOBJ_DTYPE_TXTBOX);
69
        $this->initVar('contactby', \XOBJ_DTYPE_TXTBOX);
70
        $this->initVar('premium', \XOBJ_DTYPE_TXTBOX);
71
        $this->initVar('valid', \XOBJ_DTYPE_TXTBOX);
72
        $this->initVar('photo', \XOBJ_DTYPE_TXTBOX);
73
        $this->initVar('hits', \XOBJ_DTYPE_INT);
74
        $this->initVar('item_rating', \XOBJ_DTYPE_DECIMAL);
75
        $this->initVar('item_votes', \XOBJ_DTYPE_INT);
76
        $this->initVar('user_rating', \XOBJ_DTYPE_DECIMAL);
77
        $this->initVar('user_votes', \XOBJ_DTYPE_INT);
78
        $this->initVar('comments', \XOBJ_DTYPE_INT);
79
        $this->initVar('remind', \XOBJ_DTYPE_INT);
80
    }
81
82
    /**
83
     * Get form
84
     *
85
     * @return \XoopsModules\Adslight\Form\ListingForm
86
     */
87
    public function getForm(): Form\ListingForm
88
    {
89
        return new Form\ListingForm($this);
90
    }
91
92
93
    public function getGroupsRead(): ?array
94
    {
95
        //$permHelper = new \Xmf\Module\Helper\Permission();
96
        return $this->permHelper->getGroupsForItem(
97
            'sbcolumns_read',
98
            $this->getVar('lid')
99
        );
100
    }
101
102
103
    public function getGroupsSubmit(): ?array
104
    {
105
        //$permHelper = new \Xmf\Module\Helper\Permission();
106
        return $this->permHelper->getGroupsForItem(
107
            'sbcolumns_submit',
108
            $this->getVar('lid')
109
        );
110
    }
111
112
113
    public function getGroupsModeration(): ?array
114
    {
115
        //$permHelper = new \Xmf\Module\Helper\Permission();
116
        return $this->permHelper->getGroupsForItem(
117
            'sbcolumns_moderation',
118
            $this->getVar('lid')
119
        );
120
    }
121
}
122