<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
die();
if(!CModule::IncludeModule("iblock"))
return;
$iblockXMLFile = WIZARD_SERVICE_RELATIVE_PATH."/xml/".LANGUAGE_ID."/sers.xml"; //soderg demo
$iblockCode = "sers".WIZARD_SITE_ID; //simvolnii kod infobloka
$iblockType = "sers"; //simvolnii kod tipainfobloka
$rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $iblockType));
$iblockID = false;
if ($arIBlock = $rsIBlock->Fetch())
{
$iblockID = $arIBlock["ID"];
if (WIZARD_INSTALL_DEMO_DATA)
{
CIBlock::Delete($arIBlock["ID"]);
$iblockID = false;
}
}
if($iblockID == false)
{
$permissions = Array(
"1" => "X",
"2" => "R"
);
$iblockID = WizardServices::ImportIBlockFromXML(
$iblockXMLFile,
$iblockCode,
$iblockType,
WIZARD_SITE_ID,
$permissions
);
if ($iblockID < 1)
return;
//polya infobloka для настроек
$iblock = new CIBlock;
$arFields = Array(
"ACTIVE" => "Y",
"FIELDS" => array (
'IBLOCK_SECTION' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'ACTIVE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y', ),
'ACTIVE_FROM' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'ACTIVE_TO' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'SORT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'NAME' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => '', ),
'PREVIEW_PICTURE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array ( 'FROM_DETAIL' => 'Y', 'SCALE' => 'Y', 'WIDTH' => '50', 'HEIGHT' => '175', 'IGNORE_ERRORS' => 'N', ), ),
'PREVIEW_TEXT_TYPE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text', ),
'PREVIEW_TEXT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'DETAIL_PICTURE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array ( 'SCALE' => 'Y', 'WIDTH' => '1000', 'HEIGHT' => '800', 'IGNORE_ERRORS' => 'N', ), ),
'DETAIL_TEXT_TYPE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text', ),
'DETAIL_TEXT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'XML_ID' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'CODE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'TAGS' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ),
'SECTION_CODE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => '100', 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'N'))
),
"CODE" => $iblockCode,
"XML_ID" => $iblockCode,
"NAME" => $iblock->GetArrayByID($iblockID, "NAME")
);
$iblock->Update($iblockID, $arFields);
}
else
{
$arSites = array();
$db_res = CIBlock::GetSite($iblockID);
while ($res = $db_res->Fetch())
$arSites[] = $res["LID"];
if (!in_array(WIZARD_SITE_ID, $arSites))
{
$arSites[] = WIZARD_SITE_ID;
$iblock = new CIBlock;
$iblock->Update($iblockID, array("LID" => $arSites));
}
}
CWizardUtil::Repl aceMacros(WIZARD_SITE_PATH."/sera/index.php", array("SERA_IBLOCK_ID" => $iblockID));
?>
|