1
|
|
|
<?php namespace Xoopsmodules\randomquote; |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
You may not change or alter any portion of this comment or credits |
5
|
|
|
of supporting developers from this source code or any supporting source code |
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
7
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
*/ |
12
|
|
|
/** |
13
|
|
|
* Module: randomquote |
14
|
|
|
* |
15
|
|
|
* @category Module |
16
|
|
|
* @package randomquote |
17
|
|
|
* @author XOOPS Development Team <[email protected]> - <https://xoops.org> |
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
19
|
|
|
* @license GPL 2.0 or later |
20
|
|
|
* @link https://xoops.org/ |
21
|
|
|
* @since 1.0.0 |
22
|
|
|
*/ |
23
|
|
|
use Xoopsmodules\randomquote; |
24
|
|
|
use Xoopsmodules\randomquote\form; |
25
|
|
|
|
26
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
27
|
|
|
|
28
|
|
|
$permHelper = new \Xmf\Module\Helper\Permission(); |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Quotes |
32
|
|
|
*/ |
33
|
|
|
class Quotes extends \XoopsObject |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* Constructor |
37
|
|
|
* |
38
|
|
|
* @param null |
39
|
|
|
*/ |
40
|
|
|
public function __construct() |
41
|
|
|
{ |
42
|
|
|
parent::__construct(); |
43
|
|
|
$this->initVar('id', XOBJ_DTYPE_INT); |
44
|
|
|
$this->initVar('quote', XOBJ_DTYPE_OTHER); |
45
|
|
|
$this->initVar('author', XOBJ_DTYPE_TXTBOX); |
46
|
|
|
$this->initVar('online', XOBJ_DTYPE_INT); |
47
|
|
|
$this->initVar('created', XOBJ_DTYPE_TIMESTAMP); |
48
|
|
|
$this->initVar('cid', XOBJ_DTYPE_INT); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get form |
53
|
|
|
* |
54
|
|
|
* @return \Xoopsmodules\randomquote\form\QuotesForm |
55
|
|
|
*/ |
56
|
|
|
public function getForm() |
57
|
|
|
{ |
58
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/randomquote/class/form/QuotesForm.php'; |
59
|
|
|
|
60
|
|
|
$form = new form\QuotesForm($this); |
61
|
|
|
return $form; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return array|null |
66
|
|
|
*/ |
67
|
|
|
public function getGroupsRead() |
68
|
|
|
{ |
69
|
|
|
global $permHelper; |
70
|
|
|
//return $this->publisher->getHandler('permission')->getGrantedGroupsById('quotes_read', id); |
71
|
|
|
return $permHelper->getGroupsForItem('sbcolumns_read', $this->getVar('id')); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return array|null |
76
|
|
|
*/ |
77
|
|
|
public function getGroupsSubmit() |
78
|
|
|
{ |
79
|
|
|
global $permHelper; |
80
|
|
|
// return $this->publisher->getHandler('permission')->getGrantedGroupsById('quotes_submit', id); |
81
|
|
|
return $permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('id')); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return array|null |
86
|
|
|
*/ |
87
|
|
|
public function getGroupsModeration() |
88
|
|
|
{ |
89
|
|
|
global $permHelper; |
90
|
|
|
// return $this->publisher->getHandler('permission')->getGrantedGroupsById('quotes_moderation', id); |
91
|
|
|
return $permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('id')); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
|