Listing::getForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Adslight;
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
use Xmf\Module\Helper\Permission;
16
17
/**
18
 * Module: Adslight
19
 *
20
 * @category        Module
21
 * @author          XOOPS Development Team <https://xoops.org>
22
 * @copyright       {@link https://xoops.org/ XOOPS Project}
23
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
24
 * @link            https://xoops.org/
25
 * @since           1.0.0
26
 */
27
28
//$permHelper = new \Xmf\Module\Helper\Permission();
29
30
/**
31
 * Class Listing
32
 */
33
class Listing extends \XoopsObject
34
{
35
    private $lid;
0 ignored issues
show
introduced by
The private property $lid is not used, and could be removed.
Loading history...
36
    private $cid;
0 ignored issues
show
introduced by
The private property $cid is not used, and could be removed.
Loading history...
37
    private $title;
0 ignored issues
show
introduced by
The private property $title is not used, and could be removed.
Loading history...
38
    private $status;
0 ignored issues
show
introduced by
The private property $status is not used, and could be removed.
Loading history...
39
    private $expire;
0 ignored issues
show
introduced by
The private property $expire is not used, and could be removed.
Loading history...
40
    private $type;
0 ignored issues
show
introduced by
The private property $type is not used, and could be removed.
Loading history...
41
    private $desctext;
0 ignored issues
show
introduced by
The private property $desctext is not used, and could be removed.
Loading history...
42
    private $tel;
0 ignored issues
show
introduced by
The private property $tel is not used, and could be removed.
Loading history...
43
    private $price;
0 ignored issues
show
introduced by
The private property $price is not used, and could be removed.
Loading history...
44
    private $typeprice;
0 ignored issues
show
introduced by
The private property $typeprice is not used, and could be removed.
Loading history...
45
    private $typecondition;
0 ignored issues
show
introduced by
The private property $typecondition is not used, and could be removed.
Loading history...
46
    private $date_created;
0 ignored issues
show
introduced by
The private property $date_created is not used, and could be removed.
Loading history...
47
    private $email;
0 ignored issues
show
introduced by
The private property $email is not used, and could be removed.
Loading history...
48
    private $submitter;
0 ignored issues
show
introduced by
The private property $submitter is not used, and could be removed.
Loading history...
49
    private $usid;
0 ignored issues
show
introduced by
The private property $usid is not used, and could be removed.
Loading history...
50
    private $town;
0 ignored issues
show
introduced by
The private property $town is not used, and could be removed.
Loading history...
51
    private $country;
0 ignored issues
show
introduced by
The private property $country is not used, and could be removed.
Loading history...
52
    private $contactby;
0 ignored issues
show
introduced by
The private property $contactby is not used, and could be removed.
Loading history...
53
    private $premium;
0 ignored issues
show
introduced by
The private property $premium is not used, and could be removed.
Loading history...
54
    private $valid;
0 ignored issues
show
introduced by
The private property $valid is not used, and could be removed.
Loading history...
55
    private $photo;
0 ignored issues
show
introduced by
The private property $photo is not used, and could be removed.
Loading history...
56
    private $hits;
0 ignored issues
show
introduced by
The private property $hits is not used, and could be removed.
Loading history...
57
    private $item_rating;
0 ignored issues
show
introduced by
The private property $item_rating is not used, and could be removed.
Loading history...
58
    private $item_votes;
0 ignored issues
show
introduced by
The private property $item_votes is not used, and could be removed.
Loading history...
59
    private $user_rating;
0 ignored issues
show
introduced by
The private property $user_rating is not used, and could be removed.
Loading history...
60
    private $user_votes;
0 ignored issues
show
introduced by
The private property $user_votes is not used, and could be removed.
Loading history...
61
    private $comments;
0 ignored issues
show
introduced by
The private property $comments is not used, and could be removed.
Loading history...
62
    private $remind;
0 ignored issues
show
introduced by
The private property $remind is not used, and could be removed.
Loading history...
63
    public  $helper;
64
    public  $permHelper;
65
66
    /**
67
     * Constructor
68
     *
69
     * @param null
70
     */
71
    public function __construct()
72
    {
73
        parent::__construct();
74
        /** @var Helper $helper */
75
        $this->helper     = Helper::getInstance();
76
        $this->permHelper = new Permission();
77
        $this->initVar('lid', \XOBJ_DTYPE_INT);
78
        $this->initVar('cid', \XOBJ_DTYPE_INT);
79
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX);
80
        $this->initVar('status', \XOBJ_DTYPE_INT);
81
        $this->initVar('expire', \XOBJ_DTYPE_TXTBOX);
82
        $this->initVar('type', \XOBJ_DTYPE_TXTBOX);
83
        $this->initVar('desctext', \XOBJ_DTYPE_OTHER);
84
        $this->initVar('tel', \XOBJ_DTYPE_TXTBOX);
85
        $this->initVar('price', \XOBJ_DTYPE_DECIMAL);
86
        $this->initVar('typeprice', \XOBJ_DTYPE_TXTBOX);
87
        $this->initVar('typecondition', \XOBJ_DTYPE_TXTBOX);
88
        $this->initVar('date_created', \XOBJ_DTYPE_INT);
89
        $this->initVar('email', \XOBJ_DTYPE_TXTBOX);
90
        $this->initVar('submitter', \XOBJ_DTYPE_TXTBOX);
91
        $this->initVar('usid', \XOBJ_DTYPE_TXTBOX);
92
        $this->initVar('town', \XOBJ_DTYPE_TXTBOX);
93
        $this->initVar('country', \XOBJ_DTYPE_TXTBOX);
94
        $this->initVar('contactby', \XOBJ_DTYPE_TXTBOX);
95
        $this->initVar('premium', \XOBJ_DTYPE_TXTBOX);
96
        $this->initVar('valid', \XOBJ_DTYPE_TXTBOX);
97
        $this->initVar('photo', \XOBJ_DTYPE_TXTBOX);
98
        $this->initVar('hits', \XOBJ_DTYPE_INT);
99
        $this->initVar('item_rating', \XOBJ_DTYPE_DECIMAL);
100
        $this->initVar('item_votes', \XOBJ_DTYPE_INT);
101
        $this->initVar('user_rating', \XOBJ_DTYPE_DECIMAL);
102
        $this->initVar('user_votes', \XOBJ_DTYPE_INT);
103
        $this->initVar('comments', \XOBJ_DTYPE_INT);
104
        $this->initVar('remind', \XOBJ_DTYPE_INT);
105
    }
106
107
    /**
108
     * Get form
109
     *
110
     * @return \XoopsModules\Adslight\Form\ListingForm
111
     */
112
    public function getForm(): Form\ListingForm
113
    {
114
        return new Form\ListingForm($this);
115
    }
116
117
    public function getGroupsRead(): ?array
118
    {
119
        //$permHelper = new \Xmf\Module\Helper\Permission();
120
        return $this->permHelper->getGroupsForItem(
121
            'sbcolumns_read',
122
            $this->getVar('lid')
123
        );
124
    }
125
126
    public function getGroupsSubmit(): ?array
127
    {
128
        //$permHelper = new \Xmf\Module\Helper\Permission();
129
        return $this->permHelper->getGroupsForItem(
130
            'sbcolumns_submit',
131
            $this->getVar('lid')
132
        );
133
    }
134
135
    public function getGroupsModeration(): ?array
136
    {
137
        //$permHelper = new \Xmf\Module\Helper\Permission();
138
        return $this->permHelper->getGroupsForItem(
139
            'sbcolumns_moderation',
140
            $this->getVar('lid')
141
        );
142
    }
143
}
144