if (!isset($YANDEX_EXPORT) || !is_array($YANDEX_EXPORT))
$YANDEX_EXPORT = array();
$arYandexKeys = array();
if (!empty($YANDEX_EXPORT))
$arYandexKeys = array_fill_keys($YANDEX_EXPORT, true);
$boolAll = false;
$intCountChecked = 0;
$intCountAvailIBlock = 0;
$arIBlockIDs = array();
$rsCatalogs = CCatalog::GetList(
array(),
array(),
false,
false,
array('IBLOCK_ID')
);
while ($arCatalog = $rsCatalogs->Fetch())
$arIBlockIDs[] = (int)$arCatalog['IBLOCK_ID'];
if (empty($arIBlockIDs))
$arIBlockIDs[] = -1;
$arIBlockList = array();
$db_res = CIBlock::GetList(
array("IBLOCK_TYPE" => "ASC", "NAME" => "ASC"),
array('ID' => $arIBlockIDs, 'ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'Y', 'MIN_PERMISSION' => 'U')
);
while ($res = $db_res->Fetch())
{
$arSiteList = array();
$rsSites = CIBlock::GetSite($res["ID"]);
while ($arSite = $rsSites->Fetch())
{
$arSiteList[] = $arSite["SITE_ID"];
}
$boolYandex = isset($arYandexKeys[$res['ID']]);
$arIBlockList[] = array(
'ID' => $res['ID'],
'NAME' => $res['NAME'],
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
'YANDEX_EXPORT' => $boolYandex,
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
);
if ($boolYandex)
$intCountChecked++;
$intCountAvailIBlock++;
}
if ($intCountChecked == $intCountAvailIBlock)
$boolAll = true;
?>
|