Itemvotedata::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
c 1
b 0
f 0
dl 0
loc 3
rs 10
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
/**
16
 * Module: Adslight
17
 *
18
 * @category        Module
19
 * @author          XOOPS Development Team <https://xoops.org>
20
 * @copyright       {@link https://xoops.org/ XOOPS Project}
21
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
22
 * @link            https://xoops.org/
23
 * @since           1.0.0
24
 */
25
26
use Xmf\Module\Helper\Permission;
27
use XoopsModules\Adslight\{
28
    Form
29
};
30
31
//$permHelper = new \Xmf\Module\Helper\Permission();
32
33
/**
34
 * Class Itemvotedata
35
 */
36
class Itemvotedata extends \XoopsObject
37
{
38
    private $ratingid;
0 ignored issues
show
introduced by
The private property $ratingid is not used, and could be removed.
Loading history...
39
    private $lid;
0 ignored issues
show
introduced by
The private property $lid is not used, and could be removed.
Loading history...
40
    private $ratinguser;
0 ignored issues
show
introduced by
The private property $ratinguser is not used, and could be removed.
Loading history...
41
    private $rating;
0 ignored issues
show
introduced by
The private property $rating is not used, and could be removed.
Loading history...
42
    private $ratinghostname;
0 ignored issues
show
introduced by
The private property $ratinghostname is not used, and could be removed.
Loading history...
43
    private $date_created;
0 ignored issues
show
introduced by
The private property $date_created is not used, and could be removed.
Loading history...
44
    public  $helper;
45
    public  $permHelper;
46
47
    /**
48
     * Constructor
49
     *
50
     * @param null
51
     */
52
    public function __construct()
53
    {
54
        parent::__construct();
55
        /** @var Helper $helper */
56
        $this->helper     = Helper::getInstance();
57
        $this->permHelper = new Permission();
58
        $this->initVar('ratingid', \XOBJ_DTYPE_INT);
59
        $this->initVar('lid', \XOBJ_DTYPE_INT);
60
        $this->initVar('ratinguser', \XOBJ_DTYPE_INT);
61
        $this->initVar('rating', \XOBJ_DTYPE_INT);
62
        $this->initVar('ratinghostname', \XOBJ_DTYPE_TXTBOX);
63
        $this->initVar('date_created', \XOBJ_DTYPE_INT);
64
    }
65
66
    /**
67
     * Get form
68
     *
69
     * @return Form\ItemvotesForm
70
     */
71
    public function getForm(): Form\ItemvotesForm
72
    {
73
        return new Form\ItemvotesForm($this);
74
    }
75
76
    /**
77
     * @return array|null
78
     */
79
    public function getGroupsRead(): ?array
80
    {
81
        //$permHelper = new \Xmf\Module\Helper\Permission();
82
        return $this->permHelper->getGroupsForItem(
83
            'sbcolumns_read',
84
            $this->getVar('ratingid')
85
        );
86
    }
87
88
    /**
89
     * @return array|null
90
     */
91
    public function getGroupsSubmit(): ?array
92
    {
93
        //$permHelper = new \Xmf\Module\Helper\Permission();
94
        return $this->permHelper->getGroupsForItem(
95
            'sbcolumns_submit',
96
            $this->getVar('ratingid')
97
        );
98
    }
99
100
    /**
101
     * @return array|null
102
     */
103
    public function getGroupsModeration(): ?array
104
    {
105
        //$permHelper = new \Xmf\Module\Helper\Permission();
106
        return $this->permHelper->getGroupsForItem(
107
            'sbcolumns_moderation',
108
            $this->getVar('ratingid')
109
        );
110
    }
111
}
112