| Current Path : /var/www/homesaver/www/bitrix/modules/aspro.next/admin/ |
| Current File : /var/www/homesaver/www/bitrix/modules/aspro.next/admin/develop.php |
<?
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_before.php');
require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_after.php');
global $APPLICATION;
IncludeModuleLangFile(__FILE__);
$moduleClass = "CNext";
$moduleID = "aspro.next";
\Bitrix\Main\Loader::includeModule($moduleID);
use \Bitrix\Main\Config\Option;
$RIGHT = $APPLICATION->GetGroupRight($moduleID);
if($RIGHT >= "R"){
$GLOBALS['APPLICATION']->SetAdditionalCss("/bitrix/css/".$moduleID."/style.css");
$by = "id";
$sort = "asc";
$arSites = array();
$db_res = CSite::GetList($by, $sort, array("ACTIVE"=>"Y"));
while($res = $db_res->Fetch()){
$arSites[] = $res;
}
$arParametrsList = array(
'CUSTOMIZE' => array(
'TITLE' => GetMessage('CUSTOMIZE_OPTIONS'),
'THEME' => 'N',
'OPTIONS' => array(
'TEMPLATE_CUSTOM_CSS' => array(
'TITLE' => GetMessage('TEMPLATE_CUSTOM_CSS_TITLE'),
'TYPE' => 'includefile',
'INCLUDEFILE' => '#TEMPLATE_DIR#css/custom.css',
),
'TEMPLATE_CUSTOM_JS' => array(
'TITLE' => GetMessage('TEMPLATE_CUSTOM_JS_TITLE'),
'TYPE' => 'includefile',
'INCLUDEFILE' => '#TEMPLATE_DIR#js/custom.js',
),
),
),
);
$arTabs = array();
foreach($arSites as $key => $arSite){
$arBackParametrs = array();
$arTabs[] = array(
"DIV" => "edit".($key+1),
"TAB" => GetMessage("MAIN_OPTIONS_SITE_TITLE", array("#SITE_NAME#" => $arSite["NAME"], "#SITE_ID#" => $arSite["ID"])),
"ICON" => "settings",
// "TITLE" => GetMessage("MAIN_OPTIONS_TITLE"),
"PAGE_TYPE" => "site_settings",
"SITE_ID" => $arSite["ID"],
"SITE_DIR" => $arSite["DIR"],
"TEMPLATE" => CNext::GetSiteTemplate($arSite["ID"]),
"OPTIONS" => $arBackParametrs,
);
}
$tabControl = new CAdminTabControl("tabControl", $arTabs);
if($REQUEST_METHOD == "POST" && strlen($Update.$Apply.$RestoreDefaults) > 0 && $RIGHT >= "W" && check_bitrix_sessid()){
global $APPLICATION, $CACHE_MANAGER;
if(strlen($RestoreDefaults) > 0){
}
else{
}
// clear composite cache
if($compositeMode = $moduleClass::IsCompositeEnabled()){
$obCache = new CPHPCache();
$obCache->CleanDir('', 'html_pages');
$moduleClass::EnableComposite($compositeMode === 'AUTO_COMPOSITE');
}
$APPLICATION->RestartBuffer();
}
CJSCore::Init(array("jquery"));
CAjax::Init();
?>
<?if(!count($arTabs)):?>
<div class="adm-info-message-wrap adm-info-message-red">
<div class="adm-info-message">
<div class="adm-info-message-title"><?=GetMessage("ASPRO_NEXT_NO_SITE_INSTALLED", array("#SESSION_ID#"=>bitrix_sessid_get()))?></div>
<div class="adm-info-message-icon"></div>
</div>
</div>
<?else:?>
<div class="adm-info-message"><?=GetMessage("NEXT_MODULE_DEVELOP_INFO");?></div>
<br>
<br>
<?$tabControl->Begin();?>
<form method="post" class="next_options" enctype="multipart/form-data" action="<?=$APPLICATION->GetCurPage()?>?mid=<?=urlencode($mid)?>&lang=<?=LANGUAGE_ID?>">
<?=bitrix_sessid_post();?>
<?
foreach($arTabs as $key => $arTab){
$tabControl->BeginNextTab();
if($arTab["SITE_ID"]){
$optionsSiteID = $arTab["SITE_ID"];
foreach($arParametrsList as $blockCode => $arBlock)
{?>
<tr class="heading"><td colspan="2"><?=$arBlock["TITLE"]?></td></tr>
<?
foreach($arBlock["OPTIONS"] as $optionCode => $arOption)
{
if(array_key_exists($optionCode, $arTab["OPTIONS"]) || $arOption["TYPE"] == 'note' || $arOption["TYPE"] == 'includefile')
{
$arControllerOption = CControllerClient::GetInstalledOptions($module_id);
if($arOption['TYPE'] === 'array'){
$itemsKeysCount = Option::get($moduleID, $optionCode, 0, $optionsSiteID);
if($arOption['OPTIONS'] && is_array($arOption['OPTIONS'])){
$arOptionsKeys = array_keys($arOption['OPTIONS']);
?>
<tr>
<td style="text-align:center;" colspan="2"><?=$arOption["TITLE"]?></td>
</tr>
<tr>
<td colspan="2">
<table class="aspro-admin-item-table">
<tr style="text-align:center;">
<?
for($itemKey = 0, $cnt = $itemsKeysCount; $itemKey <= $cnt; ++$itemKey){
$_arParameters = array();
foreach($arOptionsKeys as $_optionKey){
$_arParameters[$optionCode.'_array_'.$_optionKey.'_'.($itemKey != $cnt ? $itemKey : 'new')] = $arOption['OPTIONS'][$_optionKey];
if(!$itemKey){
?><th colspan="2"><?=$arOption['OPTIONS'][$_optionKey]['TITLE']?></th><?
}
}
?>
</tr>
<tr class="aspro-admin-item<?=(!$itemKey ? ' first' : '')?><?=($itemKey == $itemsKeysCount - 1 ? ' last' : '')?><?=($itemKey == $cnt ? ' new' : '')?>" data-itemkey="<?=$itemKey?>" style="text-align:center;"><?
foreach($_arParameters as $_optionCode => $_arOption){
$moduleClass::ShowAdminRow($_optionCode, $_arOption, $arTab, $arControllerOption);
}
?><td class="rowcontrol"><span class="up"></span><span class="down"></span><span class="remove"></span></td></tr><?
}
?>
<tr style="text-align:center;">
<td><a href="javascript:;" class="adm-btn adm-btn-save adm-btn-add" title="<?=GetMessage('PRIME_OPTIONS_ADD_BUTTON_TITLE')?>"><?=GetMessage('OPTIONS_ADD_BUTTON_TITLE')?></a></td>
</tr>
</table>
</td>
</tr><?
}
}
else{
if($arOption["TYPE"] == 'note')
{
if($optionCode === 'CONTACTS_EDIT_LINK_NOTE'){
$contactsHref = str_replace('//', '/', $arTab['SITE_DIR'].'/contacts/?bitrix_include_areas=Y');
$arOption["TITLE"] = GetMessage('CONTACTS_OPTIONS_EDIT_LINK_NOTE', array('#CONTACTS_HREF#' => $contactsHref));
}
?>
<tr data-option_code="<?=$optionCode;?>">
<td colspan="2" align="center">
<?=BeginNote('align="center" name="'.htmlspecialcharsbx($optionCode)."_".$optionsSiteID.'"');?>
<?=$arOption["TITLE"]?>
<?=EndNote();?>
</td>
</tr>
<?
}
else{
$optionName = $arOption["TITLE"];
$optionType = $arOption["TYPE"];
$optionList = $arOption["LIST"];
$optionDefault = $arOption["DEFAULT"];
$optionVal = $arTab["OPTIONS"][$optionCode];
$optionSize = $arOption["SIZE"];
$optionCols = $arOption["COLS"];
$optionRows = $arOption["ROWS"];
$optionChecked = $optionVal == "Y" ? "checked" : "";
$optionDisabled = isset($arControllerOption[$optionCode]) || array_key_exists("DISABLED", $arOption) && $arOption["DISABLED"] == "Y" ? "disabled" : "";
$optionSup_text = array_key_exists("SUP", $arOption) ? $arOption["SUP"] : "";
$optionController = isset($arControllerOption[$optionCode]) ? "title='".GetMessage("MAIN_ADMIN_SET_CONTROLLER_ALT")."'" : "";
$style = "";
if(($optionCode == 'BGCOLOR_THEME' || $optionCode == 'CUSTOM_BGCOLOR_THEME') && $arTab["OPTIONS"]['SHOW_BG_BLOCK'] != 'Y')
{
$style = "style=display:none;";
}
?>
<tr data-optioncode="<?=$optionCode;?>" <?=$style;?>>
<?=$moduleClass::ShowAdminRow($optionCode, $arOption, $arTab, $arControllerOption);?>
</tr>
<?if(isset($arOption['SUB_PARAMS']) && $arOption['SUB_PARAMS'] && (isset($arOption['LIST']) && $arOption['LIST'])): //nested params?>
<?foreach($arOption['LIST'] as $key => $value):?>
<?foreach((array)$arOption['SUB_PARAMS'][$key] as $key2 => $arValue)
{
if(isset($arValue['VISIBLE']) && $arValue['VISIBLE'] == 'N')
unset($arOption['SUB_PARAMS'][$key][$key2]);
}
if($arOption['SUB_PARAMS'][$key]):?>
<tr data-parent='<?=$optionCode."_".$arTab["SITE_ID"]?>' class="block <?=$key?>" <?=($key == $arTab["OPTIONS"][$optionCode] ? "style='display:table-row'" : "style='display:none'");?>>
<?if($arOption['SUB_PARAMS'][$key]):?><td style="text-align:center;" colspan="2"><?=GetMessage('SUB_PARAMS');?></td><?endif;?>
</tr>
<?foreach((array)$arOption['SUB_PARAMS'][$key] as $key2 => $arValue):
if($arValue['VISIBLE'] != 'N'):?>
<tr data-parent='<?=$optionCode."_".$arTab["SITE_ID"]?>' class="block <?=$key?>" <?=($key == $arTab["OPTIONS"][$optionCode] ? "style='display:table-row'" : "style='display:none'");?>><?=$moduleClass::ShowAdminRow($key.'_'.$key2, $arValue, $arTab, $arControllerOption);?></tr>
<?endif;?>
<?endforeach;?>
<?endif;?>
<?endforeach;?>
<?endif;?>
<?if(isset($arOption['DEPENDENT_PARAMS']) && $arOption['DEPENDENT_PARAMS']): //dependent params?>
<?foreach($arOption['DEPENDENT_PARAMS'] as $key => $arValue):?>
<?if(!isset($arValue['CONDITIONAL_VALUE']) || ($arValue['CONDITIONAL_VALUE'] && $arTab["OPTIONS"][$optionCode] == $arValue['CONDITIONAL_VALUE']))
$style = "style='display:table-row'";
else
$style = "style='display:none'";
?>
<tr data-optioncode="<?=$key;?>" class="depend-block <?=$key?>" <?=((isset($arValue['CONDITIONAL_VALUE']) && $arValue['CONDITIONAL_VALUE']) ? "data-show='".$arValue['CONDITIONAL_VALUE']."'" : "");?> data-parent='<?=$optionCode."_".$arTab["SITE_ID"]?>' <?=$style;?>><?=$moduleClass::ShowAdminRow($key, $arValue, $arTab, $arControllerOption);?></tr>
<?endforeach;?>
<?endif;?>
<?
}
}
}
}
}
}
}
?>
<?
if($REQUEST_METHOD == "POST" && strlen($Update.$Apply.$RestoreDefaults) && check_bitrix_sessid())
{
if(strlen($Update) && strlen($_REQUEST["back_url_settings"]))
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->Buttons();?>
<?/*<input <?if($RIGHT < "W") echo "disabled"?> type="submit" name="Apply" class="submit-btn" 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='<?=htmlspecialcharsbx(CUtil::addslashes($_REQUEST["back_url_settings"]))?>'">
<input type="hidden" name="back_url_settings" value="<?=htmlspecialcharsbx($_REQUEST["back_url_settings"])?>">
<?endif;?>
</form>
<?$tabControl->End();?>
<?endif;?>
<?}
else
{
echo CAdminMessage::ShowMessage(GetMessage('NO_RIGHTS_FOR_VIEWING'));
}?>
<?require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin.php');?>