Passed
Push — master ( 6af1fb...f5fe55 )
by Michael
02:53 queued 10s
created

Categories::getGroupsRead()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
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 4
rs 10
cc 1
nc 1
nop 0
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
/**
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         GPL 2.0 or later
24
 */
25
26
use Xmf\Module\Helper\Permission;
27
use XoopsModules\Adslight;
28
use XoopsModules\Adslight\Form;
29
30
//$permHelper = new \Xmf\Module\Helper\Permission();
31
32
/**
33
 * Class Categories
34
 */
35
class Categories extends \XoopsObject
36
{
37
    public $helper;
38
    public $permHelper;
39
40
    /**
41
     * Constructor
42
     *
43
     * @param null
44
     */
45
    public function __construct()
46
    {
47
        parent::__construct();
48
        //        /** @var  Adslight\Helper $helper */
49
        //        $this->helper = Adslight\Helper::getInstance();
50
        $this->permHelper = new Permission();
51
52
        $this->initVar('cid', \XOBJ_DTYPE_INT);
53
        $this->initVar('pid', \XOBJ_DTYPE_INT);
54
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX);
55
        $this->initVar('cat_desc', \XOBJ_DTYPE_OTHER);
56
        $this->initVar('cat_keywords', \XOBJ_DTYPE_TXTBOX);
57
        $this->initVar('img', \XOBJ_DTYPE_TXTBOX);
58
        $this->initVar('cat_order', \XOBJ_DTYPE_INT);
59
        $this->initVar('affprice', \XOBJ_DTYPE_INT);
60
        $this->initVar('cat_moderate', \XOBJ_DTYPE_INT);
61
        $this->initVar('moderate_subcat', \XOBJ_DTYPE_INT);
62
    }
63
64
    /**
65
     * Get form
66
     *
67
     * @param null
68
     * @return Adslight\Form\CategoriesForm
69
     */
70
    public function getForm(): Form\CategoriesForm
71
    {
72
        $form = new Form\CategoriesForm($this);
73
        return $form;
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('sbcolumns_read', $this->getVar('cid'));
83
    }
84
85
    /**
86
     * @return array|null
87
     */
88
    public function getGroupsSubmit(): ?array
89
    {
90
        //$permHelper = new \Xmf\Module\Helper\Permission();
91
        return $this->permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('cid'));
92
    }
93
94
    /**
95
     * @return array|null
96
     */
97
    public function getGroupsModeration(): ?array
98
    {
99
        //$permHelper = new \Xmf\Module\Helper\Permission();
100
        return $this->permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('cid'));
101
    }
102
}
103