Current Path : /var/www/html/clients/nkpgkx11.e-nk.ru/bitrix/modules/citrus.tszhdemo/ |
Current File : /var/www/html/clients/nkpgkx11.e-nk.ru/bitrix/modules/citrus.tszhdemo/options.php |
<? /** * Ìîäóëü «ÒÑÆ-äåìî» * ñòðàíèöà íàñòðîåê ìîäóëÿ * @package tszh */ require_once($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/citrus.tszhdemo/include.php"); $POST_RIGHT = $APPLICATION->GetGroupRight(TSZHDEMO_MODULE_ID); if ($POST_RIGHT < "W") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/options.php"); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/citrus.tszhdemo/include.php"); IncludeModuleLangFile(__FILE__); $bSubscribeInstalled = CModule::IncludeModule("subscribe"); $module_id = 'citrus.tszhdemo'; $arGROUPS = array(); $arGROUPS_tmp = array(); $z = CGroup::GetList($v1, $v2, array("ACTIVE"=>"Y", "ADMIN"=>"N", "ANONYMOUS"=>"N")); while($zr = $z->Fetch()) { $ar = array(); $ar["ID"] = intval($zr["ID"]); $ar["NAME"] = htmlspecialchars($zr["NAME"])." [<a title=\"".GetMessage("MAIN_USER_GROUP_TITLE")."\" href=\"/bitrix/admin/group_edit.php?ID=".intval($zr["ID"])."&lang=".LANGUAGE_ID."\">".intval($zr["ID"])."</a>]"; $groups[$zr["ID"]] = "[".$zr["ID"]."] ".$zr["NAME"]; $arGROUPS[] = $ar; $arGROUPS_tmp[] = array( 'ID' => $ar["ID"], 'NAME' => htmlspecialchars($zr["NAME"]) ); } $arServiceOptions = Array( "user_group_id", // "meters_block_edit" ); $arAllOptions = Array( GetMessage("TSZH_OPT_SYSTEM_SETTINGS"), Array("user_group_id", GetMessage("TSZH_OPT_USER_GROUP"), "", Array("multiselectbox", $groups)), Array("meters_block_edit", GetMessage("TSZH_OPT_METERS_BLOCK_EDIT"), "", Array("checkbox", $groups)), ); if ($bSubscribeInstalled) { $arRubrics = Array(0 => GetMessage("TSZH_OPTIONS_RUBRIC_NOT_SELECTED")); $rsRubrics = CRubric::GetList(Array("SORT" => "ASC")); while ($arRubric = $rsRubrics->GetNext()) { $arRubrics[$arRubric["ID"]] = "[{$arRubric["ID"]}] {$arRubric["NAME"]}"; } $arAllOptions = array_merge($arAllOptions, Array( GetMessage("TSZH_OPTIONS_DEBT_TITLE"), Array("dolg_subscription_rubric", GetMessage("TSZH_OPTIONS_DEBT_RUBRIC"), "", Array("selectbox", $arRubrics)), Array("dolg_subscription_min_debt", GetMessage("TSZH_OPTIONS_DEBT_MIN_SUMM"), "", Array("text", 20)), GetMessage("TSZH_OPTIONS_RECEIPT_TITLE"), Array("receipt_subscription_rubric", GetMessage("TSZH_OPTIONS_RECEIPT_RUBRIC"), "", Array("selectbox", $arRubrics)), )); } $aTabs = array( array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "tszh_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")), array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB_GROUPS"), "ICON" => "tszh_groups", "TITLE" => GetMessage("MAIN_TAB_TITLE_GROUPS")), array("DIV" => "edit3", "TAB" => GetMessage("MAIN_TAB_1C_EXCHANGE"), "ICON" => "tszh_1c_exchange", "TITLE" => GetMessage("MAIN_TAB_1C_EXCHANGE")), ); $tabControl = new CAdminTabControl("tabControl", $aTabs); ob_start(); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php"); $htmlGroupRights = ob_get_contents(); ob_end_clean(); $strRedirectURL = false; if($REQUEST_METHOD=="POST" && strlen($Update.$Apply.$RestoreDefaults)>0 && check_bitrix_sessid()) { if(strlen($RestoreDefaults)>0) { // ñîõðàíèì ñëóæåáíûå ïàðàìåòðû $arSaveOptions = Array(); foreach ($arServiceOptions as $sServiceOption) { $Value = COption::GetOptionString('tszg', $sServiceOption); $arSaveOptions[$sServiceOption] = $Value; } COption::RemoveOption(TSZHDEMO_MODULE_ID); foreach ($arServiceOptions as $sServiceOption) { COption::SetOptionString(TSZHDEMO_MODULE_ID, $sServiceOption, $arSaveOptions[$sServiceOption]); $arSaveOptions[$sServiceOption] = $Value; } } else { foreach($arAllOptions as $arOption) { __AdmSettingsSaveOption(TSZHDEMO_MODULE_ID, $arOption); } COption::SetOptionString('citrus.tszhdemo', '1c_exchange.UpdateMode', $_REQUEST['updateMode']); COption::SetOptionString('citrus.tszhdemo', '1c_exchange.CreateUsers', $_REQUEST['createUsers']); COption::SetOptionString('citrus.tszhdemo', '1c_exchange.UpdateUsers', ($_REQUEST['dontUpdateUsers'] == "Y" ? "N" : "Y")); COption::SetOptionString('citrus.tszhdemo', '1c_exchange.Action', $_REQUEST["outFileAction"]); COption::SetOptionInt('citrus.tszhdemo', '1c_exchange.Interval', IntVal($_REQUEST["INTERVAL"]) > 0 ? IntVal($_REQUEST["INTERVAL"]) : 0); COption::SetOptionInt('citrus.tszhdemo', '1C_FILE_SIZE_LIMIT', IntVal($_REQUEST["FILESIZE_LIMIT"]) > 0 ? IntVal($_REQUEST["FILESIZE_LIMIT"]) : 0); } if(strlen($Update)>0 && strlen($_REQUEST["back_url_settings"])>0) LocalRedirect($_REQUEST["back_url_settings"]); else LocalRedirect($APPLICATION->GetCurPage()."?mid=".urlencode($mid)."&lang=".urlencode(LANGUAGE_ID)."&back_url_settings=".urlencode($_REQUEST["back_url_settings"])."&".$tabControl->ActiveTabParam()); } $aMenu = array( array( "TEXT"=> GetMessage("TSZH_OPT_IMPORT"), "LINK"=>"tszh_import.php", "TITLE"=> GetMessage("TSZH_OPT_IMPORT_TITLE"), ), array( "TEXT"=> GetMessage("TSZH_OPT_EXPORT"), "LINK"=>"tszh_export.php", "TITLE"=> GetMessage("TSZH_OPT_EXPORT_TITLE") ), ); $context = new CAdminContextMenu($aMenu); $context->Show(); $tabControl->Begin(); ?><form method="post" action="<?echo $APPLICATION->GetCurPage()?>?mid=<?=urlencode($mid)?>&lang=<?=LANGUAGE_ID?>"> <?=bitrix_sessid_post();?> <? $tabControl->BeginNextTab(); foreach($arAllOptions as $arOption): __AdmSettingsDrawRow(TSZHDEMO_MODULE_ID, $arOption); endforeach; $tabControl->BeginNextTab(); echo $htmlGroupRights; $tabControl->BeginNextTab(); ?> <tr valign="top" class="heading"> <td colspan="2"><?echo GetMessage("TI_COMMON_TITLE")?></td> </tr> <tr valign="top"> <td><?=GetMessage("TI_FILESIZE")?>:</td> <td> <input type="text" name="FILESIZE_LIMIT" value="<?=COption::GetOptionInt('citrus.tszhdemo', '1C_FILE_SIZE_LIMIT', 262144)?>" /> </td> </tr> <tr valign="top" class="heading"> <td colspan="2"><?echo GetMessage("TI_IMPORT_TITLE")?></td> </tr> <tr valign="top"> <td><?=GetMessage("TI_UPDATE_MODE")?>:</td> <td> <label><input type="radio" name="updateMode" value=""<? if (!in_array(COption::GetOptionString('citrus.tszhdemo', '1c_exchange.UpdateMode', "Y"), Array("Y", "D"))) { echo ' checked="checked"'; } ?> /><?echo GetMessage("TI_UPDATE_MODE_NO")?></label><br /> <label title="<?=GetMessage("TI_NOTE_1")?>"><input type="radio" name="updateMode" value="Y"<? if (COption::GetOptionString('citrus.tszhdemo', '1c_exchange.UpdateMode', "Y") == 'Y') { echo ' checked="checked"'; } ?> /><?echo GetMessage("TI_UPDATE_MODE_TITLE")?><span class="required"><sup>1</sup></span></label><br /> <label title="<?=GetMessage("TI_NOTE_2")?>"><input type="radio" name="updateMode" value="D"<? if (COption::GetOptionString('citrus.tszhdemo', '1c_exchange.UpdateMode', "Y") == 'D') { echo ' checked="checked"'; } ?> /><?echo GetMessage("TI_UPDATE_MODE_ONLY_DEBT")?><span class="required"><sup>2</sup></span></label><br /> </td> </tr> <tr valign="top"> <td><?=GetMessage("TI_USERS")?>:</td> <td> <label style="margin-left: 7px"><input type="checkbox" name="createUsers" id="createUsers" value="Y" onchange="CreateUsersChanged();"<? if (COption::GetOptionString('citrus.tszhdemo', '1c_exchange.CreateUsers', "Y") == 'Y') { echo ' checked="checked"'; } ?> /><?echo GetMessage("TI_CREATE_USERS")?></label><br /> <label title="<?=GetMessage("TI_NOTE_3")?>"><span class="required"><sup>3</sup></span><input type="checkbox" name="dontUpdateUsers" id="dontUpdateUsers" value="Y"<? if (COption::GetOptionString('citrus.tszhdemo', '1c_exchange.UpdateUsers', "N") == 'N') { echo ' checked="checked"'; } ?> /><?echo GetMessage("TI_DONT_UPDATE_USERS_TITLE")?></label><br /> </td> </tr> <tr valign="top"> <td><?echo GetMessage("TI_ACTION")?>:</td> <td><? $action = COption::GetOptionString('citrus.tszhdemo', '1c_exchange.Action', "N"); ?> <input type="radio" name="outFileAction" value="N" id="outFileAction_N"<?=($action == 'N' ? ' checked="checked"' : '')?> /><label for="outFileAction_N"><?echo GetMessage("TI_ACTION_NONE")?></label><br> <input type="radio" name="outFileAction" value="A" id="outFileAction_A"<?=($action == 'A' ? ' checked="checked"' : '')?> /><label for="outFileAction_A"><?echo GetMessage("TI_ACTION_DEACTIVATE")?></label><br> <input type="radio" name="outFileAction" value="D" id="outFileAction_D"<?=($action == 'D' ? ' checked="checked"' : '')?> /><label for="outFileAction_D"><?echo GetMessage("TI_ACTION_DELETE")?></label><br> </td> </tr> <tr valign="top"> <td><?echo GetMessage("TI_INTERVAL")?>:</td> <td><? $INTERVAL = COption::GetOptionInt('citrus.tszhdemo', '1c_exchange.Interval', "30"); ?> <input type="text" id="INTERVAL" name="INTERVAL" size="5" value="<?echo intval($INTERVAL)?>"> </td> </tr> <tr valign="top"> <td colspan="2"> <?echo BeginNote();?> <span class="required"><sup>1</sup></span> <?=GetMessage('TI_NOTE_1')?><br /> <span class="required"><sup>2</sup></span> <?=GetMessage('TI_NOTE_2')?><br /> <span class="required"><sup>3</sup></span> <?=GetMessage('TI_NOTE_3')?><br /> <?echo EndNote();?> </td> </tr> <?$tabControl->Buttons();?> <input type="submit" name="Update" value="<?=GetMessage("MAIN_SAVE")?>" title="<?=GetMessage("MAIN_OPT_SAVE_TITLE")?>"> <input type="hidden" name="Update" value="Y"> <?if(strlen($_REQUEST["back_url_settings"])>0):?> <input type="button" name="Cancel" value="<?=GetMessage("MAIN_OPT_CANCEL")?>" title="<?=GetMessage("MAIN_OPT_CANCEL_TITLE")?>" onclick="window.location='<?echo htmlspecialchars(CUtil::addslashes($_REQUEST["back_url_settings"]))?>'"> <input type="hidden" name="back_url_settings" value="<?=htmlspecialchars($_REQUEST["back_url_settings"])?>"> <?endif?> <input type="submit" name="RestoreDefaults" title="<?echo GetMessage("MAIN_HINT_RESTORE_DEFAULTS")?>" OnClick="return confirm('<?echo AddSlashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING"))?>')" value="<?echo GetMessage("MAIN_RESTORE_DEFAULTS")?>"> </form> <script type="text/javascript"> <!-- function CreateUsersChanged() { bCreateUsers = document.getElementById('createUsers').checked; document.getElementById('dontUpdateUsers').disabled = !bCreateUsers; } CreateUsersChanged(); //--> </script> <?$tabControl->End();?>