Your IP : 3.145.40.165


Current Path : /home/bitrix/ext_www/easy-comfort.com.ua/local/modules/webprofy.pseudosection/
Upload File :
Current File : /home/bitrix/ext_www/easy-comfort.com.ua/local/modules/webprofy.pseudosection/options.php

<?
$MODULE_ID = "webprofy.pseudosection";
$MLANG = "WP_PSEUDOSECTION_";

IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/options.php");
IncludeModuleLangFile(__FILE__);

CModule::IncludeModule($MODULE_ID);
CModule::IncludeModule("main");

$aTabs = array(
	array(
		'DIV' => 'index',
		'TAB' => GetMessage('MAIN_TAB_SET'),
		'ICON' => $MODULE_ID,
		'TITLE' => GetMessage('MAIN_TAB_TITLE_SET'),
		'OPTIONS' => Array(
			'IBLOCK_ID' => Array(GetMessage($MLANG.'IBLOCK_ID'), array('text', 70)),
			'IBLOCK_SECTION_ID' => Array(GetMessage($MLANG.'IBLOCK_SECTION_ID'), array('text', 70)),
		)
	),
);

$tabControl = new CAdminTabControl("tabControl", $aTabs);

if($REQUEST_METHOD == "POST" && strlen($Update.$Apply.$RestoreDefaults) > 0 && check_bitrix_sessid()){
	if(strlen($RestoreDefaults) > 0){
		COption::RemoveOption($MODULE_ID);
	}else{
		foreach($aTabs as $i => $aTab){
			foreach($aTab["OPTIONS"] as $name => $arOption){
				$disabled = array_key_exists("disabled", $arOption) ? $arOption["disabled"] : "";
				if($disabled){
					continue;
				}

				$val = $_POST[$name];
				if($arOption[1][0] == "checkbox" && $val != "Y"){
					$val = "N";
				}

				COption::SetOptionString($MODULE_ID, $name, $val, $arOption[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());
	}
}

$tabControl->Begin();
?>
<form method="post" action="<? echo $APPLICATION->GetCurPage() ?>?mid=<?=urlencode($mid)?>&amp;lang=<?=LANGUAGE_ID?>">
	<?
	foreach($aTabs as $aTab){
		$tabControl->BeginNextTab();
		foreach($aTab["OPTIONS"] as $name => $arOption){
			$val = COption::GetOptionString($MODULE_ID, $name);
			$type = $arOption[1];
			$disabled = array_key_exists("disabled", $arOption) ? $arOption["disabled"] : "";
			$name = htmlspecialcharsbx($name);

			?>
			<tr>
				<td width="40%" nowrap <?=($type[0] == "textarea") ? 'class="adm-detail-valign-top"' : '';?>>
					<label for="<?=$name?>"><?=$arOption[0]?></label>
				<td width="60%">
					<? if($type[0] == "checkbox"){ ?>
						<input type="checkbox" name="<?=$name;?>" id="<?=$name;?>" value="Y"<?=($val == "Y") ? ' checked' : '';?><?=($disabled) ? ' disabled="disabled"' : '';?>>
						<?=($disabled) ? '<br>'.$disabled : '';?>
					<? }elseif($type[0] == "text"){ ?>
						<input type="text" size="<?=$type[1]?>" maxlength="255" value="<?=htmlspecialcharsbx($val)?>" name="<?=$name?>">
					<? }elseif($type[0] == "select"){ ?>
						<select name="<?=$name?>">
						<? foreach($select as $key => $value){ ?>
							<option value="<?=$key?>" <? if($val == $key){
								echo 'selected';
							} ?>><?=$value?></option>
							<?
						} ?>
						</select>
						<?
					}elseif($type[0] == "textarea"){ ?>
						<textarea rows="<?=$type[1]?>" cols="<?=$type[2]?> " name="<?=$name?>" style="width:100%"><?=htmlspecialcharsbx($val)?></textarea>
					<? } ?>
				</td>
			</tr>
			<?
		}
	} ?>

	<? $tabControl->Buttons(); ?>
	<input type="submit" name="Update" value="<?=GetMessage("MAIN_SAVE")?>"
	       title="<?=GetMessage("MAIN_OPT_SAVE_TITLE")?>" class="adm-btn-save">
	<input type="submit" name="Apply" value="<?=GetMessage("MAIN_OPT_APPLY")?>"
	       title="<?=GetMessage("MAIN_OPT_APPLY_TITLE")?>">
	<? 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 htmlspecialcharsbx(CUtil::addslashes($_REQUEST["back_url_settings"])) ?>'">
		<input type="hidden" name="back_url_settings" value="<?=htmlspecialcharsbx($_REQUEST["back_url_settings"])?>">
	<? } ?>
	<input type="submit" name="RestoreDefaults" title="<?=GetMessage("MAIN_HINT_RESTORE_DEFAULTS")?>"
	       OnClick="return confirm('<?=addslashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING"))?>')"
	       value="<?=GetMessage("MAIN_RESTORE_DEFAULTS")?>">
	<?=bitrix_sessid_post();?>
	<? $tabControl->End(); ?>
</form>