1
|
|
|
<?php namespace XoopsModules\Mymenus; |
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
|
|
|
/** |
14
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
15
|
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
16
|
|
|
* @package Mymenus |
17
|
|
|
* @since 1.0 |
18
|
|
|
* @author trabis <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use Xmf\Request; |
|
|
|
|
22
|
|
|
use XoopsModules\Mymenus; |
23
|
|
|
|
24
|
|
|
defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
25
|
|
|
|
26
|
|
|
//require dirname(__DIR__) . '/include/common.php'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class Menus |
30
|
|
|
*/ |
31
|
|
|
class Menus extends \XoopsObject |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var Menus |
35
|
|
|
* @access private |
36
|
|
|
*/ |
37
|
|
|
private $helper; |
38
|
|
|
private $db; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* constructor |
42
|
|
|
*/ |
43
|
|
|
public function __construct() |
44
|
|
|
{ |
45
|
|
|
/** @var \XoopsModules\Mymenus\Helper $this->helper */ |
46
|
|
|
$this->helper = \XoopsModules\Mymenus\Helper::getInstance(); |
47
|
|
|
$this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
|
|
|
48
|
|
|
$this->initVar('id', XOBJ_DTYPE_INT); |
|
|
|
|
49
|
|
|
$this->initVar('title', XOBJ_DTYPE_TXTBOX); |
|
|
|
|
50
|
|
|
$this->initVar('css', XOBJ_DTYPE_TXTBOX); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Get {@link XoopsThemeForm} for adding/editing items |
55
|
|
|
* |
56
|
|
|
* @param bool|string $action |
57
|
|
|
* @return \XoopsThemeForm <a href='psi_element://XoopsThemeForm'>XoopsThemeForm</a> |
58
|
|
|
*/ |
59
|
|
|
public function getForm($action = false) |
60
|
|
|
{ |
61
|
|
|
// $grouppermHandler = xoops_getHandler('groupperm'); |
62
|
|
|
// |
63
|
|
|
xoops_load('XoopsFormLoader'); |
|
|
|
|
64
|
|
|
// |
65
|
|
|
if (false === $action) { |
66
|
|
|
// $action = $_SERVER['REQUEST_URI']; |
67
|
|
|
$action = Request::getString('REQUEST_URI', '', 'SERVER'); |
68
|
|
|
} |
69
|
|
|
// |
70
|
|
|
// $isAdmin = mymenusUserIsAdmin(); |
71
|
|
|
// $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); |
72
|
|
|
// |
73
|
|
|
$title = $this->isNew() ? _AM_MYMENUS_MENUS_ADD : _AM_MYMENUS_MENUS_EDIT; |
74
|
|
|
// |
75
|
|
|
$form = new \XoopsThemeForm($title, 'moneusform', $action, 'post', true); |
|
|
|
|
76
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
77
|
|
|
// menus: title |
78
|
|
|
$menusTitleText = new \XoopsFormText(_AM_MYMENUS_MENU_TITLE, 'title', 50, 255, $this->getVar('title', 'e')); |
|
|
|
|
79
|
|
|
$menusTitleText->setDescription(_AM_MYMENUS_MENU_TITLE_DESC); |
80
|
|
|
$form->addElement($menusTitleText, true); |
81
|
|
|
// menus: css |
82
|
|
|
$menusCssText = new \XoopsFormText(_AM_MYMENUS_MENU_CSS, 'css', 50, 255, $this->getVar('css', 'e')); |
83
|
|
|
$menusCssText->setDescription(_AM_MYMENUS_MENU_CSS_DESC); |
84
|
|
|
$form->addElement($menusCssText, false); |
85
|
|
|
// form: button tray |
86
|
|
|
$buttonTray = new \XoopsFormElementTray('', ''); |
|
|
|
|
87
|
|
|
$buttonTray->addElement(new \XoopsFormHidden('op', 'save')); |
|
|
|
|
88
|
|
|
// |
89
|
|
|
$buttonSubmit = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
|
|
|
|
90
|
|
|
$buttonSubmit->setExtra('onclick="this.form.elements.op.value=\'save\'"'); |
91
|
|
|
$buttonTray->addElement($buttonSubmit); |
92
|
|
|
if ($this->isNew()) { |
93
|
|
|
// NOP |
94
|
|
|
} else { |
95
|
|
|
$form->addElement(new \XoopsFormHidden('id', (int)$this->getVar('id'))); |
96
|
|
|
// |
97
|
|
|
$buttonDelete = new \XoopsFormButton('', '', _DELETE, 'submit'); |
|
|
|
|
98
|
|
|
$buttonDelete->setExtra('onclick="this.form.elements.op.value=\'delete\'"'); |
99
|
|
|
$buttonTray->addElement($buttonDelete); |
100
|
|
|
} |
101
|
|
|
$buttonReset = new \XoopsFormButton('', '', _RESET, 'reset'); |
|
|
|
|
102
|
|
|
$buttonTray->addElement($buttonReset); |
103
|
|
|
// |
104
|
|
|
$buttonCancel = new \XoopsFormButton('', '', _CANCEL, 'button'); |
|
|
|
|
105
|
|
|
$buttonCancel->setExtra('onclick="history.go(-1)"'); |
106
|
|
|
$buttonTray->addElement($buttonCancel); |
107
|
|
|
// |
108
|
|
|
$form->addElement($buttonTray); |
109
|
|
|
|
110
|
|
|
// |
111
|
|
|
return $form; |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths