Passed
Push — master ( ac9a19...e11ae0 )
by Michael
13:36 queued 09:25
created

editBlock()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 43
Code Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 36
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 43
rs 9.344
1
<?php declare(strict_types=1);
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
 *
9
 * @category        Module
10
 * @author          XOOPS Development Team
11
 * @copyright       XOOPS Project
12
 * @link            https://xoops.org
13
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
14
 */
15
16
use Xmf\Module\Admin;
17
use Xmf\Request;
18
use XoopsModules\Xoopspoll\{
19
    Common\Blocksadmin,
20
    Common\BlockActionsHandler,
21
    Helper
22
};
23
24
/** @var Admin $adminObject */
25
/** @var Helper $helper */
26
require __DIR__ . '/admin_header.php';
27
xoops_cp_header();
28
29
$moduleDirName      = $helper->getDirname();
30
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
31
32
$xoopsModule = XoopsModule::getByDirname($moduleDirName);
33
34
if (!is_object($GLOBALS['xoopsUser']) || !is_object($xoopsModule)
35
    || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) {
36
    exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'));
37
}
38
39
/** @var \XoopsMySQLDatabase $xoopsDB */
40
$xoopsDB       = \XoopsDatabaseFactory::getDatabaseConnection();
41
$xoopsSecurity = new \XoopsSecurity();
42
43
$blocksadmin = new Blocksadmin($xoopsDB, $helper, $xoopsModule, $xoopsSecurity);
44
45
// Call the handleActions method
46
$op = Request::getCmd('op', 'list');
47
48
// Instantiate the BlockActionsHandler
49
$blockActionsHandler = new BlockActionsHandler($blocksadmin);
50
51
// Instantiate the Block DTO
52
$blockData = $blockActionsHandler->processPostData();
53
$blockData->op = $op;
54
$blockActionsHandler->handleActions($blockData);
55
56
    if ('order' === $op) {
57
    $blockActionsHandler->processOrderBlockAction($blockData);
58
    }
59
60
require __DIR__ . '/admin_footer.php';
61