Modulemenu::getMenuitemsDefault()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
cc 1
eloc 16
c 4
b 1
f 0
nc 1
nop 0
dl 0
loc 27
rs 9.7333
1
<?php
2
3
namespace XoopsModules\Wgfilemanager;
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
 * @copyright    XOOPS Project https://xoops.org/
17
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
18
 * @author       Goffy - XOOPS Development Team
19
 */
20
//\defined('\XOOPS_ROOT_PATH') || die('Restricted access');
21
22
/**
23
 * Class Modulemenu
24
 */
25
class Modulemenu
26
{
27
28
    /** function to create an array for XOOPS main menu
29
     *
30
     * @return array
31
     */
32
    public function getMenuitemsDefault()
33
    {
34
35
        $moduleDirName = \basename(\dirname(__DIR__));
36
        $pathname      = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/';
37
38
        require_once $pathname . 'include/common.php';
39
        $helper = \XoopsModules\Wgfilemanager\Helper::getInstance();
40
41
        //load necessary language files from this module
42
        $helper->loadLanguage('modinfo');
43
44
        $items = [];
45
        $items[] = [
46
            'name' => \_MI_WGFILEMANAGER_SMNAME1,
47
            'url'  =>  'index.php',
48
        ];
49
        $items[] = [
50
            'name' => \_MI_WGFILEMANAGER_SMNAME2,
51
            'url'  =>  'directory.php',
52
        ];
53
        $items[] = [
54
            'name' => \_MI_WGFILEMANAGER_SMNAME3,
55
            'url'  =>  'file.php?op=new',
56
        ];
57
58
        return $items;
59
    }
60
61
62
    /** function to create a list of sublinks
63
     *
64
     * @return array
65
     */
66
    public function getMenuitemsSbadmin5()
67
    {
68
        $moduleDirName = \basename(\dirname(__DIR__));
69
        $pathname      = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/';
70
        $urlModule     = \XOOPS_URL . '/modules/' . $moduleDirName . '/';
71
72
        require_once $pathname . 'include/common.php';
73
        $helper = \XoopsModules\Wgfilemanager\Helper::getInstance();
74
75
        //load necessary language files from this module
76
        /*        $helper->loadLanguage('common');
77
                $helper->loadLanguage('main');*/
78
        $helper->loadLanguage('modinfo');
79
80
        // start creation of link list as array
81
82
        $requestUri = $_SERVER['REQUEST_URI'];
83
        /*read navbar items related to perms of current user*/
84
        $items = [];
85
        $items[] = [
86
            'highlight' => \strpos($requestUri, $moduleDirName . '/index.php') > 0,
87
            'url' => $urlModule . 'index.php',
88
            'icon' => '<i class="fa fa-tachometer fa-fw fa-lg"></i>',
89
            'name' => \_MI_WGFILEMANAGER_SMNAME1,
90
            'sublinks' => []
91
        ];
92
        $items[] = [
93
            'highlight' => \strpos($requestUri, $moduleDirName . '/directory.php') > 0,
94
            'url' => $urlModule . 'directory.php',
95
            'icon' => '<i class="fa fa-folder fa-fw fa-lg"></i>',
96
            'name' => \_MI_WGFILEMANAGER_SMNAME2,
97
            'sublinks' => []
98
        ];
99
        $items[] = [
100
            'highlight' => \strpos($requestUri, $moduleDirName . '/file.php') > 0,
101
            'url' => $urlModule . 'file.php',
102
            'icon' => '<i class="fa fa-file fa-fw fa-lg"></i>',
103
            'name' => \_MI_WGFILEMANAGER_SMNAME3,
104
            'sublinks' => []
105
        ];
106
107
        return $items;
108
    }
109
110
111
}
112