<?
$module_id = "#part#.#modul#";
CModule::IncludeModule($module_id);
$POST_RIGHT = $APPLICATION->GetGroupRight($module_id);
if ($POST_RIGHT >= "R"){
	$rsGroups = CGroup::GetList($by = "ID", $order = "asc",Array("ACTIVE"=>"Y"),"N");
	$arGruppMs = array();
    while($arGroups = $rsGroups->Fetch()){
      $arGruppMs[$arGroups['ID']] = $arGroups["NAME"];
    }
	
	IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/options.php");
	IncludeModuleLangFile(__FILE__);
	$arAllOptions = array();
	$aTabs = array(
		array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "", "TITLE" => GetMessage("header_common_settings")),
		array("DIV" => "edit4", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS"))
	);
	$tabControl = new CAdmintabControl("tabControl", $aTabs);
	if (ToUpper($REQUEST_METHOD) == "POST" && strlen($Update.$Apply.$RestoreDefaults)>0 && ($POST_RIGHT=="W" || $POST_RIGHT=="X") && check_bitrix_sessid()){
		$error = '';
	    if (strlen($RestoreDefaults)>0){
			COption::RemoveOption($module_id);
			$z = CGroup::GetList($v1="id",$v2="asc", array("ACTIVE" => "Y", "ADMIN" => "N"));
			while ($zr = $z->Fetch()){
				$APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
			}
		}else{
			foreach ($arAllOptions as $arOption){
				
			}
			 
		}
		$Update = $Update.$Apply;
		ob_start();
		require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php");
		ob_end_clean();
		if (strlen($error)) {
			ShowError($error);
		} elseif(strlen($Update)>0 && strlen($_REQUEST["back_url_settings"])>0) {
			LocalRedirect($_REQUEST["back_url_settings"]);
		} else {
			LocalRedirect($APPLICATION->GetCurPage()."?mid=".urlencode($module_id)."&lang=".urlencode(LANGUAGE_ID)."&back_url_settings=".urlencode($_REQUEST["back_url_settings"])."&".$tabControl->ActiveTabParam());
		}
	}
	?>
	<form method="post" action="<?echo $APPLICATION->GetCurPage()?>?mid=<?=urlencode($mid)?>&amp;lang=<?=LANGUAGE_ID?>">
	<?
	 $tabControl->Begin();
	 $tabControl->BeginNextTab();
	 ?>
	 <tr>
	 <td></td>
	 <td><p><?=GetMessage("#modul_upper_full#_about_settings_start").'<sup style="color: red;">1</sup>';?></p></td>
	 </tr>
	 <?
	 foreach($arAllOptions as $Option){
	 }
	 $tabControl->BeginNextTab();
	 require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php");
	 $tabControl->Buttons();
	?>
	<input <?if ($POST_RIGHT<"W") echo "disabled" ?> type="submit" name="Update" value="<?=GetMessage("MAIN_SAVE")?>" title="<?=GetMessage("MAIN_OPT_SAVE_TITLE")?>" />
	<input <?if ($POST_RIGHT<"W") echo "disabled" ?> type="submit" name="Apply" value="<?=GetMessage("MAIN_OPT_APPLY")?>" title="<?=GetMessage("MAIN_OPT_APPLY_TITLE")?>" />
	<?if(strlen($_REQUEST["back_url_settings"])>0):?>
		<input <?if ($POST_RIGHT<"W") echo "disabled" ?> type="button" name="Cancel" value="<?=GetMessage("MAIN_OPT_CANCEL")?>" title="<?=GetMessage("MAIN_OPT_CANCEL_TITLE")?>" onclick="window.location='<?echo htmlspecialcharsbx(CUtil::addslashes($_REQUEST["back_url_settings"]))?>'" />
		<input type="hidden" name="back_url_settings" value="<?=htmlspecialcharsbx($_REQUEST["back_url_settings"])?>" />
	<?endif?>
	<input <?if ($POST_RIGHT<"W") echo "disabled" ?> type="submit" name="RestoreDefaults" title="<?echo GetMessage("MAIN_HINT_RESTORE_DEFAULTS")?>" OnClick="confirm('<?echo AddSlashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING"))?>')" value="<?echo GetMessage("MAIN_RESTORE_DEFAULTS")?>" />
	<?=bitrix_sessid_post();?>
	<?$tabControl->End();?>
	</form>
    <?= BeginNote()?>
	<?= '<sup style="color: red;">1</sup>'.GetMessage("#modul_upper_full#_about_settings");?><br/>
	<?= EndNote()?>	
<?}
?>