-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.php
More file actions
72 lines (58 loc) · 1.9 KB
/
options.php
File metadata and controls
72 lines (58 loc) · 1.9 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
<?php
use Bitrix\Main\Loader;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\HttpApplication;
$module_id = "otus.customrest";
IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/options.php');
IncludeModuleLangFile(__FILE__);
Loader::includeModule($module_id);
global $APPLICATION;
$request = HttpApplication::getInstance()->getContext()->getRequest();
$defaultOptions = Option::getDefaults($module_id);
$arMainPropsTab = [
"DIV" => "edit1",
"TAB" => Loc::getMessage("OTUS_CUSTOMREST_MAIN_TAB_SETTINGS"),
"TITLE" => Loc::getMessage("OTUS_CUSTOMREST_MAIN_TAB_SETTINGS_TITLE"),
"OPTIONS" => []
];
$aTabs = [
$arMainPropsTab,
[
"DIV" => "edit2",
"TAB" => Loc::getMessage("MAIN_TAB_RIGHTS"),
"TITLE" => Loc::getMessage("MAIN_TAB_TITLE_RIGHTS")
],
];
?>
<?php
//Save form
if ($request->isPost() && $request["save"] && check_bitrix_sessid()) {
foreach ($aTabs as $aTab) {
if (!empty($aTab['OPTIONS'])) {
__AdmSettingsSaveOptions($module_id, $aTab["OPTIONS"]);
}
}
}
?>
<!-- FORM TAB -->
<?php
$tabControl = new CAdminTabControl("tabControl", $aTabs);
?>
<?php $tabControl->Begin(); ?>
<form method="post" action="<?=$APPLICATION->GetCurPage();?>?mid=<?=htmlspecialcharsbx($request["mid"]);?>&lang=<?=LANGUAGE_ID?>" name="<?=$module_id;?>">
<?php $tabControl->BeginNextTab(); ?>
<?php
foreach ($aTabs as $aTab) {
if(is_array($aTab['OPTIONS'])) {
__AdmSettingsDrawList($module_id, $aTab['OPTIONS']);
$tabControl->BeginNextTab();
}
}
?>
<?php require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php"); ?>
<?php $tabControl->Buttons(array('btnApply' => false, 'btnCancel' => false, 'btnSaveAndAdd' => false)); ?>
<?=bitrix_sessid_post();?>
</form>
<?php $tabControl->End(); ?>
<!-- X FORM TAB -->