Your IP : 3.19.209.203


Current Path : /home/bitrix/ext_www/dev.ballu.in.ua/local/modules/rusklimat.yandexproducts/
Upload File :
Current File : /home/bitrix/ext_www/dev.ballu.in.ua/local/modules/rusklimat.yandexproducts/options.php

<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
	die();

use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use RK\YandexProducts\CMSAdapter\Config;
use RK\YandexProducts\CMSAdapter\Options\Builder;
use RK\YandexProducts\CMSAdapter\Options\OptionHandler;
use RK\YandexProducts\CMSAdapter\Options\OptionVisible;
use RK\YandexProducts\DataObject\Options\OptionTypes;

if (!$USER->IsAdmin())
	return;

$moduleId = "rusklimat.yandexproducts";
Loader::includeModule($moduleId);

$optionTypes = new OptionTypes();
$optionHandler = new OptionHandler();
$optionHandler->handlePost();
$optionHandler->getVariants();
$optionCollection = $optionHandler->getAll();
$optionVisible = new OptionVisible();

$lp = Config::getInstance()->getLangPrefix();
$arTabs = [
	[
		"DIV"   => "main",
		"TAB"   => Loc::getMessage($lp . "TAB_"."TAB_"  ."MAIN"),
		"TITLE" => Loc::getMessage($lp . "TAB_"."TITLE_"."MAIN"),
	],
];

if ($optionHandler->isOptionSet( $optionVisible->firstTabRequired() ))
{
	$arTabs[] = [
		"DIV"   => "product",
		"TAB"   => Loc::getMessage($lp . "TAB_"."TAB_"  ."PRODUCT"),
		"TITLE" => Loc::getMessage($lp . "TAB_"."TITLE_"."PRODUCT"),
		"JS" => true,
	];
	
	if ($optionHandler->isOptionSet( $optionVisible->secondTabRequired() ))
    {
	    $arTabs[] = [
		    "DIV"   => "process",
		    "TAB"   => Loc::getMessage($lp . "TAB_"."TAB_"  ."PROCESS"),
		    "TITLE" => Loc::getMessage($lp . "TAB_"."TITLE_"."PROCESS"),
		    "JS" => true,
            "CSS" => true,
	    ];
	
	    $arTabs[] = [
		    "DIV"   => "check",
		    "TAB"   => Loc::getMessage($lp . "TAB_"."TAB_"  ."CHECK"),
		    "TITLE" => Loc::getMessage($lp . "TAB_"."TITLE_"."CHECK"),
		    "JS" => true,
		    "CSS" => true,
	    ];
    }
}

$builder = new Builder($arTabs, "options");
$builder->includeCommonJSCSS();

$aTabs = $builder->getTabs();
$oTabControl = new CAdmintabControl("tabControl", $aTabs);
$oTabControl->Begin();
?>

<form method="POST" enctype="multipart/form-data"
      action="<?= $APPLICATION->GetCurPage() ?>?mid=<?= htmlspecialchars($moduleId) ?>&lang=<?= LANG ?>&mid_menu=1">
<?
    echo bitrix_sessid_post();
    
    foreach ($aTabs as $tab)
    {
        $oTabControl->BeginNextTab();
        $tabCode = $builder->getTabCode($tab);
        
        $scriptName = $builder->includeTab($tab);
        
        if (file_exists($scriptName) && is_readable($scriptName))
            include $scriptName;
        
        $oTabControl->EndTab();
    }
    
    $oTabControl->Buttons();

    ?><input type="submit" name="save" class="adm-btn-save"
         value="<?= Loc::getMessage($lp . "OPTION_" . "BUTTON_" . "SAVE") ?>"/><?

?></form><?

$oTabControl->End();