1
|
|
|
<?php declare(strict_types=1); |
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
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
14
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
15
|
|
|
* @author XOOPS Development Team |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use Xmf\Module\Admin; |
19
|
|
|
use XoopsModules\Myiframe; |
20
|
|
|
|
21
|
|
|
require_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
22
|
|
|
|
23
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
24
|
|
|
$moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
25
|
|
|
|
26
|
|
|
/** @var \XoopsDatabase $db */ |
27
|
|
|
/** @var Myiframe\Helper $helper */ |
28
|
|
|
/** @var Myiframe\Utility $utility */ |
29
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
30
|
|
|
$helper = Myiframe\Helper::getInstance(); |
31
|
|
|
$utility = new Myiframe\Utility(); |
32
|
|
|
//$configurator = new Myiframe\Common\Configurator(); |
33
|
|
|
|
34
|
|
|
$helper->loadLanguage('common'); |
35
|
|
|
|
36
|
|
|
//handlers |
37
|
|
|
//$categoryHandler = new Myiframe\CategoryHandler($db); |
38
|
|
|
//$downloadHandler = new Myiframe\DownloadHandler($db); |
39
|
|
|
|
40
|
|
|
if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
41
|
|
|
define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
42
|
|
|
define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
43
|
|
|
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
44
|
|
|
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); |
45
|
|
|
define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
46
|
|
|
define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); |
47
|
|
|
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
48
|
|
|
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
49
|
|
|
define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
50
|
|
|
define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
51
|
|
|
define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
52
|
|
|
define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
53
|
|
|
define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
$pathIcon16 = Admin::iconUrl('', '16'); |
57
|
|
|
$pathIcon32 = Admin::iconUrl('', '32'); |
58
|
|
|
//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
59
|
|
|
//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
60
|
|
|
|
61
|
|
|
$icons = [ |
62
|
|
|
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
63
|
|
|
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
64
|
|
|
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
65
|
|
|
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
66
|
|
|
'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
67
|
|
|
'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
68
|
|
|
'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
69
|
|
|
'0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
70
|
|
|
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
71
|
|
|
]; |
72
|
|
|
|
73
|
|
|
$debug = false; |
74
|
|
|
|
75
|
|
|
// MyTextSanitizer object |
76
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
77
|
|
|
|
78
|
|
|
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
79
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
80
|
|
|
$GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
$GLOBALS['xoopsTpl']->assign('mod_url', $helper->url()); |
84
|
|
|
// Local icons path |
85
|
|
|
if (is_object($helper->getModule())) { |
86
|
|
|
$pathModIcon16 = $helper->getModule() |
87
|
|
|
->getInfo('modicons16'); |
88
|
|
|
$pathModIcon32 = $helper->getModule() |
89
|
|
|
->getInfo('modicons32'); |
90
|
|
|
|
91
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
|
|
|
92
|
|
|
$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
93
|
|
|
} |
94
|
|
|
|