Passed
Push — master ( b847d6...d6d54c )
by Michael
09:34 queued 05:00
created

admin/permissions.php (1 issue)

Labels
Severity
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * Pedigree module for xoops
14
 *
15
 * @copyright       {@link https://xoops.org/ XOOPS Project}
16
 * @license         GPL 2.0 or later
17
 * @package         pedigree
18
 * @since
19
 * @author          XOOPS Module Dev Team (https://xoops.org)
20
 */
21
22
use Xmf\Request;
23
use XoopsModules\Pedigree;
24
25
require_once __DIR__ . '/admin_header.php';
26
//xoops_cp_header();
27
require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
28
//require_once XOOPS_ROOT_PATH."/class/xoopsform/FormHiddenToken.php";
29
30
if (!empty($_POST['submit'])) {
31
    $helper->redirect('admin/permissions.php', 1, _MP_GPERMUPDATED);
0 ignored issues
show
The constant _MP_GPERMUPDATED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
32
}
33
34
$permissions_admin = \Xmf\Module\Admin::getInstance();
35
echo $permissions_admin->displayNavigation(basename(__FILE__));
36
37
$permission                = Request::getInt('permission', 1, 'POST');
38
$selected                  = ['', '', ''];
39
$selected[$permission - 1] = ' selected';
40
41
echo '
42
<form method="post" name="fselperm" action="permissions.php">
43
    <table border=0>
44
        <tr>
45
            <td>
46
                <select name="permission" onChange="document.fselperm.submit()">
47
                    <option value="1"' . $selected[0] . '>' . _AM_PEDIGREE_PERMISSIONS_ACCESS . '</option>
48
                    <option value="2"' . $selected[1] . '>' . _AM_PEDIGREE_PERMISSIONS_SUBMIT . '</option>
49
                    <option value="3"' . $selected[2] . '>' . _AM_PEDIGREE_PERMISSIONS_VIEW . '</option>
50
                </select>
51
            </td>
52
        </tr>
53
    </table>
54
</form>';
55
56
$module_id = $xoopsModule->getVar('mid');
57
58
switch ($permission) {
59
    case 1:
60
        $formTitle = _AM_PEDIGREE_PERMISSIONS_ACCESS;
61
        $permName  = 'xdirectory_access';
62
        $permDesc  = '';
63
        break;
64
    case 2:
65
        $formTitle = _AM_PEDIGREE_PERMISSIONS_SUBMIT;
66
        $permName  = 'xdirectory_submit';
67
        $permDesc  = '';
68
        break;
69
    case 3:
70
        $formTitle = _AM_PEDIGREE_PERMISSIONS_VIEW;
71
        $permName  = 'xdirectory_view';
72
        $permDesc  = '';
73
        break;
74
}
75
76
$permform = new \XoopsGroupPermForm($formTitle, $module_id, $permName, $permDesc, 'admin/permissions.php');
77
//    $xdir_catHandler= xoops_getModuleHandler('xdirectory_xdir_cat', $xoopsModule->getVar("dirname"));
78
$criteria = new \CriteriaCompo();
79
$criteria->setSort('title');
80
$criteria->setOrder('ASC');
81
//    $xdir_cat_arr = $xdir_catHandler->getObjects($criteria);
82
83
//foreach (array_keys($xdir_cat_arr) as $xdir_cat_id => $xdir_cat)
84
foreach (array_keys($xdir_cat_arr) as $i) {
85
    //$permform->addItem($xdir_cat_id, $xdir_cat["xdir_cat_title"], $xdir_cat["xdir_cat_pid"]);
86
    $permform->addItem($xdir_cat_arr[$i]->getVar('cid'), $xdir_cat_arr[$i]->getVar('title'));
87
}
88
echo $permform->render();
89
echo "<br><br><br><br>\n";
90
unset($permform);
91
92
require_once __DIR__ . '/admin_footer.php';
93