-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.php
More file actions
114 lines (86 loc) · 2.68 KB
/
options.php
File metadata and controls
114 lines (86 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
namespace Fi1a\BitrixValidation;
global $APPLICATION;
use Bitrix\Main\Application;
use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\Web\Uri;
use CAdminMessage;
use Fi1a\BitrixValidation\Helpers\Flush;
$module_id = 'fi1a.bitrixvalidation';
$moduleMode = Loader::includeSharewareModule($module_id);
$rightForModule = $APPLICATION->GetGroupRight($module_id);
// Если нет прав, или не установлен модуль - не продолжаем
if ('R' > $rightForModule || !in_array($moduleMode, [Loader::MODULE_DEMO, Loader::MODULE_INSTALLED])) {
return;
}
Loc::loadMessages($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/options.php');
Loc::loadMessages(__FILE__);
$request = Application::getInstance()->getContext()->getRequest();
$isSubmit = $request->isPost()
&& ($request->getPost('save') || $request->getPost('apply'))
&& check_bitrix_sessid();
// Если нет прав, а форму отправили
if ($isSubmit && $rightForModule < 'W') {
CAdminMessage::ShowMessage([
'MESSAGE' => Loc::getMessage('FBV_NO_RIGHTS'),
'TYPE' => 'ERROR',
]);
$isSubmit = false;
}
if ($isSubmit) {
$Update = true;
}
$backUrlSettings = $request->getQuery('back_url_settings');
if (!$backUrlSettings) {
$backUrlSettings = $request->getPost('back_url_settings');
}
$errors = [];
if (Flush::get('FBV_EDIT_SUCCESS')) {
CAdminMessage::ShowMessage([
'MESSAGE' => Loc::getMessage('FBV_EDIT_SUCCESS'),
'TYPE' => 'OK',
]);
}
$tabs = [
[
'DIV' => 'rights',
'TAB' => Loc::getMessage('MAIN_TAB_RIGHTS'),
'TITLE' => Loc::getMessage('MAIN_TAB_TITLE_RIGHTS'),
],
];
$tabControl = new \CAdminTabControl('tabControl', $tabs);
?>
<form method="POST" action="">
<?php
$tabControl->Begin();
foreach ($tabs as $tab) {
$tabControl->BeginNextTab();
switch ($tab['DIV']) {
case 'rights':
// Права на модуль
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/admin/group_rights.php';
break;
}
}
unset($tab);
$tabControl->Buttons(
array(
"disabled" => ($rightForModule < "W"),
"back_url" => !empty($backUrlSettings) ? $backUrlSettings : null
)
);
echo bitrix_sessid_post();
$tabControl->End();
?>
</form>
<?php
if ($isSubmit && !count($errors)) {
// Редиректим
Flush::set('FBV_EDIT_SUCCESS', true);
$uri = new Uri($request->getRequestUri());
if ($request->getPost('save') && $backUrlSettings) {
$uri = new Uri($backUrlSettings);
}
\LocalRedirect($uri->getUri());
}