1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//namespace XoopsModules\Publisher\Plugin; |
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
|
|
|
* Publisher class |
17
|
|
|
* |
18
|
|
|
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ |
19
|
|
|
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
20
|
|
|
* @package Class |
21
|
|
|
* @subpackage Utils |
22
|
|
|
* @since 1.0 |
23
|
|
|
* @author trabis <[email protected]> |
24
|
|
|
* @version $Id$ |
25
|
|
|
*/ |
26
|
|
|
use MenusPluginInterface; |
27
|
|
|
use Xoops\Module\Plugin\PluginAbstract; |
28
|
|
|
use XoopsModules\Publisher\Helper; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class MenusPlugin |
32
|
|
|
* @package XoopsModules\Publisher\Plugin |
33
|
|
|
*/ |
34
|
|
|
class PublisherMenusPlugin extends PluginAbstract implements MenusPluginInterface |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* expects an array of array containing: |
38
|
|
|
* name, Name of the submenu |
39
|
|
|
* url, Url of the submenu relative to the module |
40
|
|
|
* ex: return array(0 => array( |
41
|
|
|
* 'name' => _MI_PUBLISHER_SUB_SMNAME3; |
42
|
|
|
* 'url' => "search.php"; |
43
|
|
|
* )); |
44
|
|
|
* |
45
|
|
|
* @return array |
46
|
|
|
*/ |
47
|
|
|
public function subMenus() |
48
|
|
|
{ |
49
|
|
|
$ret = []; |
50
|
|
|
$helper = Helper::getInstance(); |
51
|
|
|
|
52
|
|
|
// Add the Submit new item button |
53
|
|
|
if ($helper->isUserAdmin() || ($helper->getConfig('perm_submit') && ($helper->xoops()->isUser() || $helper->getConfig('permissions_anon_post')))) { |
54
|
|
|
$ret[] = [ |
55
|
|
|
'name' => _MI_PUBLISHER_SUB_SMNAME1, |
56
|
|
|
'url' => 'submit.php?op=add', |
57
|
|
|
]; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
// DISABLED since the internal search doesn't work |
61
|
|
|
// Add the Search button |
62
|
|
|
if (false && $helper->getConfig('perm_search')) { |
63
|
|
|
$ret[] = [ |
64
|
|
|
'name' => _MI_PUBLISHER_SUB_SMNAME3, |
65
|
|
|
'url' => 'search.php', |
66
|
|
|
]; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
// Add the Archive button |
70
|
|
|
$ret[] = [ |
71
|
|
|
'name' => _MI_PUBLISHER_SUB_ARCHIVE, |
72
|
|
|
'url' => 'archive.php', |
73
|
|
|
]; |
74
|
|
|
|
75
|
|
|
return $ret; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|