1
|
|
|
<?php namespace Xoopsmodules\instruction; |
2
|
|
|
|
3
|
|
|
use Xmf\Request; |
4
|
|
|
use Xoopsmodules\instruction\common; |
5
|
|
|
|
6
|
|
|
require_once __DIR__ . '/common/VersionChecks.php'; |
7
|
|
|
require_once __DIR__ . '/common/ServerStats.php'; |
8
|
|
|
require_once __DIR__ . '/common/FilesManagement.php'; |
9
|
|
|
|
10
|
|
|
require_once __DIR__ . '/../include/common.php'; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Utility |
14
|
|
|
*/ |
15
|
|
|
class Utility |
16
|
|
|
{ |
17
|
|
|
use common\VersionChecks; //checkVerXoops, checkVerPhp Traits |
18
|
|
|
|
19
|
|
|
use common\ServerStats; // getServerStats Trait |
20
|
|
|
|
21
|
|
|
use common\FilesManagement; // Files Management Trait |
22
|
|
|
|
23
|
|
|
// Права |
24
|
|
|
/** |
25
|
|
|
* @param string $permtype |
26
|
|
|
* @return mixed |
27
|
|
|
*/ |
28
|
|
|
public static function getItemIds($permtype = 'instruction_view') |
29
|
|
|
{ |
30
|
|
|
//global $xoopsUser; |
31
|
|
|
static $permissions = []; |
32
|
|
|
// Если есть в статике |
33
|
|
|
if (is_array($permissions) && array_key_exists($permtype, $permissions)) { |
34
|
|
|
return $permissions[$permtype]; |
35
|
|
|
} |
36
|
|
|
// Находим из базы |
37
|
|
|
$moduleHandler = xoops_getHandler('module'); |
38
|
|
|
$instrModule = $moduleHandler->getByDirname('instruction'); |
39
|
|
|
$groups = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
|
|
|
40
|
|
|
$gpermHandler = xoops_getHandler('groupperm'); |
41
|
|
|
$categories = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid')); |
42
|
|
|
$permissions[$permtype] = $categories; |
43
|
|
|
return $categories; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
// Редактор |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param $caption |
50
|
|
|
* @param $name |
51
|
|
|
* @param string $value |
52
|
|
|
* @return bool|\XoopsFormEditor |
53
|
|
|
*/ |
54
|
|
|
public static function getWysiwygForm($caption, $name, $value = '') |
55
|
|
|
{ |
56
|
|
|
$editor = false; |
|
|
|
|
57
|
|
|
$editor_configs = []; |
58
|
|
|
$editor_configs['name'] = $name; |
59
|
|
|
$editor_configs['value'] = $value; |
60
|
|
|
$editor_configs['rows'] = 35; |
61
|
|
|
$editor_configs['cols'] = 60; |
62
|
|
|
$editor_configs['width'] = '100%'; |
63
|
|
|
$editor_configs['height'] = '350px'; |
64
|
|
|
$editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction')); |
65
|
|
|
|
66
|
|
|
$editor = new \XoopsFormEditor($caption, $name, $editor_configs); |
67
|
|
|
return $editor; |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.