-
Notifications
You must be signed in to change notification settings - Fork 4
/
options.php
102 lines (86 loc) · 3.39 KB
/
options.php
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
<?
\Bitrix\Main\Localization\Loc::loadMessages(__FILE__);
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/options.php");
$module_id = "simple.module";
global $settings_id;
$settings_id = "simple_module";
$MODULE_RIGHT = $APPLICATION->GetGroupRight($module_id);
if($MODULE_RIGHT < "W")
{
CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("ACCESS_DENIED"), "TYPE" => "ERROR"));
return;
}
CModule::IncludeModuleEx($module_id);
$strWarning = "";
$aTabs = array(
array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")),
array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => $settings_id . "_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS")),
);
$arOptionGroups = array(
// array(
// GetMessage($settings_id . "_OPTION_GROUP_NAME"),
// array(
// array("option_text", GetMessage($settings_id . "option_text_OPTION_NAME"), "", array("text", 50)),
// array("option_checkbox", GetMessage($settings_id . "option_checkbox_OPTION_NAME"), "", array("checkbox"))
// )
// )
);
//Restore defaults
if($MODULE_RIGHT >= "W" && $_SERVER["REQUEST_METHOD"] == "GET" && strlen($RestoreDefaults) > 0 && check_bitrix_sessid())
{
COption::RemoveOption($settings_id);
}
$tabControl = new CAdminTabControl("tabControl", $aTabs);
function ShowParamsHTMLByarray($arParams)
{
global $settings_id;
foreach($arParams as $Option)
__AdmSettingsDrawRow($settings_id, $Option);
}
//Save options
if($REQUEST_METHOD == "POST" && $MODULE_RIGHT >= "W" && strlen($Update.$Apply.$RestoreDefaults) > 0 && check_bitrix_sessid())
{
if(strlen($RestoreDefaults) > 0)
{
COption::RemoveOption($settings_id);
}
else
{
foreach($arOptionGroups as $arOptionGroup)
{
foreach($arOptionGroup[1] as $option)
__AdmSettingsSaveOption($settings_id, $option);
}
}
}
?>
<script type="text/javascript">
<!--
function RestoreDefaults()
{
if(confirm('<? echo GetMessageJS("MAIN_HINT_RESTORE_DEFAULTS_WARNING"); ?>'))
window.location = "<?echo $APPLICATION->GetCurPage()?>?RestoreDefaults=Y&lang=<?echo LANG?>&mid=<?echo urlencode($mid)?>&<?=bitrix_sessid_get()?>";
}
//-->
</script>
<form method="post" action="<?echo $APPLICATION->GetCurPage()?>?mid=<?=htmlspecialchars($mid)?>&lang=<?echo LANG?>"><?
$tabControl->Begin();
$tabControl->BeginNextTab();
foreach($arOptionGroups as $arOptionGroup)
{
?><tr class="heading">
<td colspan=2><? echo $arOptionGroup[0]; ?></td>
</tr><?
foreach($arOptionGroup[1] as $option)
__AdmSettingsDrawRow($settings_id, $option);
}
$tabControl->BeginNextTab();
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php");?>
<?$tabControl->Buttons();?>
<input type="hidden" name="Update" value="Y">
<input type="submit" class="adm-btn-save"<?if($MODULE_RIGHT < "W") echo " disabled ";?>name="Update" value="<?echo GetMessage("MAIN_SAVE")?>">
<input type="reset"<?if($MODULE_RIGHT < "W") echo " disabled ";?>name="reset" value="<? echo GetMessage("MAIN_RESET"); ?>">
<input type="button"<?if($MODULE_RIGHT < "W") echo " disabled ";?>type="button" title="<?echo GetMessage("MAIN_HINT_RESTORE_DEFAULTS")?>" OnClick="RestoreDefaults();" value="<?echo GetMessage("MAIN_RESTORE_DEFAULTS")?>">
<?$tabControl->End();?>
<?=bitrix_sessid_post();?>
</form>