Issues (525)

class/Modulemenu.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace XoopsModules\Wgsitenotice;
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
     * @param bool $includeUrl
31
     * @return array
32
     */
33
    public function getMenuitemsDefault($includeUrl = false)
34
    {
35
36
        $moduleDirName = \basename(\dirname(__DIR__));
37
        $pathname      = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
38
39
        $urlModule = '';
40
        if ($includeUrl) {
41
            $urlModule = \XOOPS_URL . '/modules/' . $moduleDirName . '/';
0 ignored issues
show
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42
        }
43
44
        require_once $pathname . 'include/common.php';
45
        $helper = \XoopsModules\Wgsitenotice\Helper::getInstance();
46
47
        // start creation of link list as array
48
        $items = [];
49
        // versions
50
        $versionsHandler = $helper->getHandler('Versions');
51
        $version_crit = new \CriteriaCompo();
0 ignored issues
show
The type CriteriaCompo was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
52
        $version_crit->setSort('version_weight');
53
        $version_crit->setOrder('ASC');
54
        $version_crit->add(new \Criteria('version_current', '1'));
0 ignored issues
show
The type Criteria was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
55
        $versions_rows = $versionsHandler->getCount($version_crit);
56
        $versions_arr = $versionsHandler->getAll($version_crit);
57
58
        if ($versions_rows > 0) {
59
            foreach (\array_keys($versions_arr) as $i)
60
            {
61
                $items[] = [
62
                    'name' => $versions_arr[$i]->getVar('version_name'),
63
                    'url'  => $urlModule . 'index.php?version_id=' . $versions_arr[$i]->getVar('version_id'),
64
                ];
65
            }
66
        }
67
        // end creation of link list as array
68
69
        return $items;
70
    }
71
72
    /** function to create a list of nested sublinks
73
     *
74
     * @return array
75
     */
76
    public function getMenuitemsSbadmin5()
77
    {
78
        return $this->getMenuitemsDefault(true);
79
    }
80
81
82
}
83