Code Duplication    Length = 62-63 lines in 3 locations

class/customer.php 1 location

@@ 34-96 (lines=63) @@
31
/**
32
 * Class EquipmentCustomer
33
 */
34
class EquipmentCustomer extends XoopsObject
35
{
36
    /**
37
     * Constructor
38
     *
39
     * @param null
40
     */
41
    public function __construct()
42
    {
43
        parent::__construct();
44
        $this->initVar('id', XOBJ_DTYPE_INT);
45
        $this->initVar('first', XOBJ_DTYPE_TXTBOX);
46
        $this->initVar('last', XOBJ_DTYPE_TXTBOX);
47
        $this->initVar('address', XOBJ_DTYPE_TXTBOX);
48
        $this->initVar('city', XOBJ_DTYPE_TXTBOX);
49
        $this->initVar('country', XOBJ_DTYPE_TXTBOX);
50
        $this->initVar('created', XOBJ_DTYPE_TIMESTAMP);
51
    }
52
53
    /**
54
     * Get form
55
     *
56
     * @param null
57
     * @return EquipmentCustomerForm
58
     */
59
    public function getForm()
60
    {
61
        require_once XOOPS_ROOT_PATH . '/modules/equipment/class/form/customer.php';
62
63
        $form = new EquipmentCustomerForm($this);
64
        return $form;
65
    }
66
67
    /**
68
     * @return array|null
69
     */
70
    public function getGroupsRead()
71
    {
72
        global $permHelper;
73
        //return $this->publisher->getHandler('permission')->getGrantedGroupsById('customer_read', id);
74
        return $permHelper->getGroupsForItem('sbcolumns_read', $this->getVar('id'));
75
    }
76
77
    /**
78
     * @return array|null
79
     */
80
    public function getGroupsSubmit()
81
    {
82
        global $permHelper;
83
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('customer_submit', id);
84
        return $permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('id'));
85
    }
86
87
    /**
88
     * @return array|null
89
     */
90
    public function getGroupsModeration()
91
    {
92
        global $permHelper;
93
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('customer_moderation', id);
94
        return $permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('id'));
95
    }
96
}
97
98
/**
99
 * Class EquipmentCustomerHandler

class/equipment.php 1 location

@@ 34-95 (lines=62) @@
31
/**
32
 * Class EquipmentEquipment
33
 */
34
class EquipmentEquipment extends XoopsObject
35
{
36
    /**
37
     * Constructor
38
     *
39
     * @param null
40
     */
41
    public function __construct()
42
    {
43
        parent::__construct();
44
        $this->initVar('id', XOBJ_DTYPE_INT);
45
        $this->initVar('owner', XOBJ_DTYPE_TXTBOX);
46
        $this->initVar('name', XOBJ_DTYPE_TXTBOX);
47
        $this->initVar('amount', XOBJ_DTYPE_INT);
48
        $this->initVar('total', XOBJ_DTYPE_INT);
49
        $this->initVar('image', XOBJ_DTYPE_TXTBOX);
50
    }
51
52
    /**
53
     * Get form
54
     *
55
     * @param null
56
     * @return EquipmentEquipmentForm
57
     */
58
    public function getForm()
59
    {
60
        require_once XOOPS_ROOT_PATH . '/modules/equipment/class/form/equipment.php';
61
62
        $form = new EquipmentEquipmentForm($this);
63
        return $form;
64
    }
65
66
    /**
67
     * @return array|null
68
     */
69
    public function getGroupsRead()
70
    {
71
        global $permHelper;
72
        //return $this->publisher->getHandler('permission')->getGrantedGroupsById('equipment_read', id);
73
        return $permHelper->getGroupsForItem('sbcolumns_read', $this->getVar('id'));
74
    }
75
76
    /**
77
     * @return array|null
78
     */
79
    public function getGroupsSubmit()
80
    {
81
        global $permHelper;
82
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('equipment_submit', id);
83
        return $permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('id'));
84
    }
85
86
    /**
87
     * @return array|null
88
     */
89
    public function getGroupsModeration()
90
    {
91
        global $permHelper;
92
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('equipment_moderation', id);
93
        return $permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('id'));
94
    }
95
}
96
97
/**
98
 * Class EquipmentEquipmentHandler

class/rentals.php 1 location

@@ 34-95 (lines=62) @@
31
/**
32
 * Class EquipmentRentals
33
 */
34
class EquipmentRentals extends XoopsObject
35
{
36
    /**
37
     * Constructor
38
     *
39
     * @param null
40
     */
41
    public function __construct()
42
    {
43
        parent::__construct();
44
        $this->initVar('id', XOBJ_DTYPE_INT);
45
        $this->initVar('customerid', XOBJ_DTYPE_INT);
46
        $this->initVar('equipmentid', XOBJ_DTYPE_INT);
47
        $this->initVar('quantity', XOBJ_DTYPE_INT);
48
        $this->initVar('datefrom', XOBJ_DTYPE_TIMESTAMP);
49
        $this->initVar('dateto', XOBJ_DTYPE_TIMESTAMP);
50
    }
51
52
    /**
53
     * Get form
54
     *
55
     * @param null
56
     * @return EquipmentRentalsForm
57
     */
58
    public function getForm()
59
    {
60
        require_once XOOPS_ROOT_PATH . '/modules/equipment/class/form/rentals.php';
61
62
        $form = new EquipmentRentalsForm($this);
63
        return $form;
64
    }
65
66
    /**
67
     * @return array|null
68
     */
69
    public function getGroupsRead()
70
    {
71
        global $permHelper;
72
        //return $this->publisher->getHandler('permission')->getGrantedGroupsById('rentals_read', id);
73
        return $permHelper->getGroupsForItem('sbcolumns_read', $this->getVar('id'));
74
    }
75
76
    /**
77
     * @return array|null
78
     */
79
    public function getGroupsSubmit()
80
    {
81
        global $permHelper;
82
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('rentals_submit', id);
83
        return $permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('id'));
84
    }
85
86
    /**
87
     * @return array|null
88
     */
89
    public function getGroupsModeration()
90
    {
91
        global $permHelper;
92
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('rentals_moderation', id);
93
        return $permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('id'));
94
    }
95
}
96
97
/**
98
 * Class EquipmentRentalsHandler