本文整理汇总了PHP中CIBlock::GetSite方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetSite方法的具体用法?PHP CIBlock::GetSite怎么用?PHP CIBlock::GetSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::GetSite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIBlockId
public static function getIBlockId($code, $site_id, $use_cache = true)
{
$iblock_list = null;
$arIblock = null;
$result = array();
if ($use_cache) {
$iblock_list = static::getCache(__FUNCTION__ . '_list');
}
if (!is_array($iblock_list['RESULT'])) {
\CModule::IncludeModule('iblock');
$dbResult = \CIBlock::GetList();
while ($next = $dbResult->fetch()) {
$iblock_list['RESULT'][] = $next;
}
static::setCache(__FUNCTION__ . '_list', $iblock_list['RESULT']);
}
if ($use_cache) {
$arIblock = static::getCache(__FUNCTION__ . '_iblock');
}
if (!is_array($arIblock['RESULT'])) {
\CModule::IncludeModule('iblock');
foreach ($iblock_list['RESULT'] as $iblock) {
if ($iblock['CODE'] == $code) {
$dbResult = \CIBlock::GetSite($iblock['ID']);
while ($next = $dbResult->getNext()) {
if ($next['SITE_ID'] == $site_id) {
$arIblock['RESULT'][] = $iblock;
}
}
}
}
static::setCache(__FUNCTION__ . '_iblock', $arIblock['RESULT']);
}
if (is_array($arIblock['RESULT']) && count($arIblock['RESULT']) > 0) {
foreach ($arIblock['RESULT'] as $iblock) {
$result[] = $iblock['ID'];
}
}
return $result;
}
示例2: GetMessage
$tabControl->EndCustomField("CATALOG", "");
}
if ($arShowTabs['sku'])
{
$tabControl->BeginNextFormTab();
$tabControl->BeginCustomField('OFFERS', GetMessage("IBLOCK_EL_TAB_OFFERS"), false);
?><tr id="tr_OFFERS"><td colspan="2"><?
define('B_ADMIN_SUBELEMENTS',1);
define('B_ADMIN_SUBELEMENTS_LIST',false);
$intSubIBlockID = $arMainCatalog['IBLOCK_ID'];
$arSubIBlock = CIBlock::GetArrayByID($intSubIBlockID);
$arSubIBlock["SITE_ID"] = array();
$rsSites = CIBlock::GetSite($intSubIBlockID);
while($arSite = $rsSites->Fetch())
$arSubIBlock["SITE_ID"][] = $arSite["LID"];
$strSubIBlockType = $arSubIBlock['IBLOCK_TYPE_ID'];
$arSubIBlockType = CIBlockType::GetByIDLang($strSubIBlockType, LANGUAGE_ID);
$boolIncludeOffers = CIBlockRights::UserHasRightTo($intSubIBlockID, $intSubIBlockID, "iblock_admin_display");;
$arSubCatalog = CCatalogSKU::GetInfoByOfferIBlock($arMainCatalog['IBLOCK_ID']);
$boolSubCatalog = (!empty($arSubCatalog) && is_array($arSubCatalog));
if (!$boolCatalogRead && !$boolCatalogPrice)
$boolSubCatalog = false;
$boolSubWorkFlow = CModule::IncludeModule("workflow") && $arSubIBlock["WORKFLOW"] != "N";
$boolSubBizproc = CModule::IncludeModule("bizproc") && $arSubIBlock["BIZPROC"] != "N";
$intSubPropValue = (0 == $ID || $bCopy ? '-'.$TMP_ID : $ID);
示例3: OnAfterIBlockElementDelete
function OnAfterIBlockElementDelete($arFields)
{
// news
if (!array_key_exists("WF_STATUS_ID", $arFields) || $arFields["WF_STATUS_ID"] == 1) {
$dbIBlock = CIBlock::GetByID($arFields["IBLOCK_ID"]);
if ($arIBlock = $dbIBlock->Fetch()) {
$rsSite = CIBlock::GetSite($arFields["IBLOCK_ID"]);
if ($arSite = $rsSite->Fetch()) {
$site_id = $arSite["SITE_ID"];
}
$val = COption::GetOptionString("intranet", "sonet_log_news_iblock", "", $site_id);
if (strlen($val) > 0) {
$arIBCode = unserialize($val);
if (!is_array($arIBCode) || count($arIBCode) <= 0) {
$arIBCode = array();
}
} else {
$arIBCode = array();
}
if (in_array($arIBlock["CODE"], $arIBCode) && CModule::IncludeModule("socialnetwork")) {
CSocNetAllowed::GetAllowedEntityTypes();
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_NEWS, "EVENT_ID" => "news", "SOURCE_ID" => $arFields["ID"]), false, false, array("ID"));
while ($arRes = $dbRes->Fetch()) {
CSocNetLog::Delete($arRes["ID"]);
}
}
}
}
// --news
}
示例4: die
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
die();
if (!CModule::IncludeModule("iblock"))
return false;
$rsIBlock = CIBlock::GetList(array(), array("CODE" => "aqw_shop_products", "TYPE" => "catalog"));
if ($arIBlock = $rsIBlock->Fetch())
{
$arSites = array();
$db_res = CIBlock::GetSite($arIBlock['ID']);
while ($res = $db_res->Fetch())
$arSites[] = $res["LID"];
if (!in_array(WIZARD_SITE_ID, $arSites))
{
$arSites[] = WIZARD_SITE_ID;
$iBlock = new CIBlock;
$iBlock->Update($arIBlock['ID'], array("LID" => $arSites));
}
$iblockID = $arIBlock['ID'];
} else {
$iblockID = WizardServices::ImportIBlockFromXML(
WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/products.xml",
"aqw_shop_products",
"catalog",
WIZARD_SITE_ID
);
}
示例5: CAdminList
$lAdmin = new CAdminList($sTableID);
$arHeader = array(array("id" => "NAME", "content" => GetMessage("CAT_CADM_NAME"), "default" => true), array("id" => "SORT", "content" => GetMessage("CAT_CADM_SORT"), "default" => true, "align" => "right"), array("id" => "ACTIVE", "content" => GetMessage("CAT_CADM_ACTIVE"), "default" => true, "align" => "center"), array("id" => "LID", "content" => GetMessage("CAT_CADM_LANG"), "default" => true, "align" => "left"), array("id" => "ID", "content" => GetMessage("CAT_CADM_ID"), "sort" => "id", "default" => true, "align" => "right"));
$lAdmin->AddHeaders($arHeader);
$arCatalogs = array();
$rsCatalog = CCatalog::GetList(array(), array(), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID'));
while ($ar = $rsCatalog->Fetch()) {
if (!$ar["PRODUCT_IBLOCK_ID"]) {
$arCatalogs[$ar["IBLOCK_ID"]] = 1;
}
}
$rsIBlocks = CIBlock::GetList(array("SORT" => "asc", "NAME" => "ASC"), array('ID' => array_keys($arCatalogs), "MIN_PERMISSION" => "U"));
$rsIBlocks = new CAdminResult($rsIBlocks, $sTableID);
while ($dbrs = $rsIBlocks->NavNext(true, "f_")) {
$row =& $lAdmin->AddRow($f_ID, $dbrs, 'cat_catalog_edit.php?IBLOCK_ID=' . $f_ID . '&lang=' . LANGUAGE_ID);
$f_LID = '';
$db_LID = CIBlock::GetSite($f_ID);
while ($ar_LID = $db_LID->Fetch()) {
$f_LID .= ($f_LID != "" ? " / " : "") . htmlspecialcharsbx($ar_LID["LID"]);
}
$row->AddViewField("LID", $f_LID);
$row->AddViewField("NAME", '<a href="' . htmlspecialcharsbx('cat_catalog_edit.php?IBLOCK_ID=' . $f_ID . '&lang=' . LANGUAGE_ID) . '">' . $f_NAME . '</a>');
$row->AddCheckField("ACTIVE", false);
$arActions = array();
if (CIBlockRights::UserHasRightTo($f_ID, $f_ID, "iblock_edit")) {
$arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("MAIN_ADMIN_MENU_EDIT"), "DEFAULT" => $_REQUEST["admin"] == "Y", "ACTION" => "window.location='" . CUtil::JSEscape('cat_catalog_edit.php?IBLOCK_ID=' . $f_ID . '&lang=' . LANGUAGE_ID) . "';");
}
if (!empty($arActions)) {
$row->AddActions($arActions);
}
}
$lAdmin->CheckListMode();
示例6: ShowError
?>
<?echo ShowError(GetMessage("IBLIST_A_BAD_IBLOCK"));?>
<a href="<?echo htmlspecialcharsbx("iblock_admin.php?lang=".LANGUAGE_ID."&type=".urlencode($type))?>"><?echo GetMessage("IBLOCK_BACK_TO_ADMIN")?></a>
<?
endif;
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
die();
}
if(!$arIBlock["SECTIONS_NAME"])
$arIBlock["SECTIONS_NAME"] = $arIBTYPE["SECTION_NAME"]? $arIBTYPE["SECTION_NAME"]: GetMessage("IBLIST_A_SECTIONS");
if(!$arIBlock["ELEMENTS_NAME"])
$arIBlock["ELEMENTS_NAME"] = $arIBTYPE["ELEMENT_NAME"]? $arIBTYPE["ELEMENT_NAME"]: GetMessage("IBLIST_A_ELEMENTS");
$arIBlock["SITE_ID"] = array();
$rsSites = CIBlock::GetSite($IBLOCK_ID);
while($arSite = $rsSites->Fetch())
$arIBlock["SITE_ID"][] = $arSite["LID"];
$bWorkFlow = $bWorkflow && (CIBlock::GetArrayByID($IBLOCK_ID, "WORKFLOW") != "N");
$bBizproc = $bBizproc && (CIBlock::GetArrayByID($IBLOCK_ID, "BIZPROC") != "N");
define("MODULE_ID", "iblock");
define("ENTITY", "CIBlockDocument");
define("DOCUMENT_TYPE", "iblock_".$IBLOCK_ID);
$bCatalog = Loader::includeModule("catalog");
$boolSKU = false;
$boolSKUFiltrable = false;
$strSKUName = '';
$uniq_id = 0;
示例7: array
$tasksForumId = 0;
if (CModule::IncludeModule("iblock")) {
$iblockCode = "intranet_tasks";
$iblockType = "services";
$rsIBlock = CIBlock::GetList(array(), array("XML_ID" => $iblockCode, "TYPE" => $iblockType));
if ($arIBlock = $rsIBlock->Fetch()) {
$tasksIblockId = $arIBlock["ID"];
}
if ($tasksIblockId == 0) {
$tasksIblockId = WizardServices::ImportIBlockFromXML(WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/tasks.xml", $iblockCode, $iblockType, WIZARD_SITE_ID, array("1" => "X", "2" => "R", WIZARD_PORTAL_ADMINISTRATION_GROUP => "X"));
$iblock = new CIBlock();
$arFields = array("CODE" => $iblockCode, "XML_ID" => $iblockCode);
$iblock->Update($tasksIblockId, $arFields);
} else {
$arSites = array();
$db_res = CIBlock::GetSite($tasksIblockId);
while ($res = $db_res->Fetch()) {
$arSites[] = $res["LID"];
}
if (!in_array(WIZARD_SITE_ID, $arSites)) {
$arSites[] = WIZARD_SITE_ID;
$iblock = new CIBlock();
$iblock->Update($tasksIblockId, array("LID" => $arSites));
}
}
}
if (CModule::IncludeModule("forum")) {
$forumCode = "intranet_tasks";
$dbRes = CForumNew::GetListEx(array(), array("SITE_ID" => WIZARD_SITE_ID, "XML_ID" => $forumCode));
if ($arRes = $dbRes->Fetch()) {
$tasksForumId = $arRes["ID"];
示例8: intval
);
while ($arCatalog = $rsCatalogs->Fetch())
{
$arIBlockIDs[] = intval($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' => 'W')
);
while ($res = $db_res->Fetch())
{
$arSiteList = array();
$rsSites = CIBlock::GetSite($res["ID"]);
while ($arSite = $rsSites->Fetch())
{
$arSiteList[] = $arSite["SITE_ID"];
}
$boolYandex = array_key_exists($res['ID'], $arYandexKeys);
$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++;
示例9: run
/**
* @param $id
* @param bool|false $forCache
* @return bool|string
*/
public static function run($id, $forCache = false)
{
$data = \CIBlock::GetByID($id)->Fetch();
if ($data) {
$code = $data['CODE'];
$name = $data['NAME'];
$isactive = $data['ACTIVE'] == 'Y';
$sort = $data['SORT'];
$description = (string) $data['DESCRIPTION'];
$descriptionType = $data['DESCRIPTION_TYPE'];
$className = $forCache ? \TAO::normalizeMnemocode($code) : \TAO::chunkCap($code);
unset($data['ID']);
unset($data['TIMESTAMP_X']);
unset($data['IBLOCK_TYPE_ID']);
unset($data['CODE']);
unset($data['NAME']);
unset($data['LANG_DIR']);
unset($data['SERVER_NAME']);
unset($data['LID']);
unset($data['ACTIVE']);
unset($data['SORT']);
unset($data['DESCRIPTION']);
unset($data['DESCRIPTION_TYPE']);
$defs = array('RSS_ACTIVE' => 'Y', 'RSS_TTL' => '24', 'RSS_FILE_ACTIVE' => 'N', 'RSS_YANDEX_ACTIVE' => 'N', 'INDEX_ELEMENT' => 'Y', 'INDEX_SECTION' => 'N', 'WORKFLOW' => 'Y', 'VERSION' => '1', 'BIZPROC' => 'N', 'SECTION_CHOOSER' => 'L', 'RIGHTS_MODE' => 'S', 'SECTION_PROPERTY' => 'N', 'PROPERTY_INDEX' => 'N');
foreach (array_keys($data) as $k) {
if (empty($data[$k])) {
unset($data[$k]);
}
if (isset($defs[$k]) && $defs[$k] == $data[$k]) {
unset($data[$k]);
}
}
$sites = '';
$res = \CIBlock::GetSite($id);
while ($row = $res->Fetch()) {
$sites .= $sites != '' ? ',' : '';
$sites .= "'" . $row['SITE_ID'] . "'";
}
unset($data['ELEMENTS_NAME']);
unset($data['ELEMENT_NAME']);
$sData = self::generateArrayExport($data, ' ');
$sDescription = self::generateSimpleStringFunctionText('description', $description, '');
$sDescriptionType = self::generateSimpleStringFunctionText('descriptionType', $descriptionType, 'text');
$sIsActive = self::generateSimpleStringFunctionText('isActive', $isactive, true);
$sSort = self::generateSimpleStringFunctionText('sort', $sort, '500');
$sSites = "\n\n public function sites()\n {\n return array({$sites});\n }";
$properties = array();
$result = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $id, 'CHECK_PERMISSIONS' => 'N'));
$defs = array('VERSION' => '1', 'FILTRABLE' => 'N', 'SEARCHABLE' => 'N', 'LIST_TYPE' => 'L', 'COL_COUNT' => '30', 'ROW_COUNT' => '1', 'MULTIPLE' => 'N', 'SORT' => '500', 'IS_REQUIRED' => 'N', 'WITH_DESCRIPTION' => 'N', 'MULTIPLE_CNT' => '5');
while ($row = $result->Fetch()) {
$code = trim($row['CODE']);
if ($code == '') {
$code = 'PROP_' . $row['ID'];
}
$pid = $row['ID'];
unset($row['ID']);
unset($row['TIMESTAMP_X']);
unset($row['IBLOCK_ID']);
unset($row['ACTIVE']);
unset($row['CODE']);
foreach (array_keys($row) as $k) {
if (empty($row[$k])) {
unset($row[$k]);
}
if (isset($defs[$k]) && $defs[$k] == $row[$k]) {
unset($row[$k]);
}
}
if ($row['PROPERTY_TYPE'] == 'L') {
$items = array();
$res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $pid, 'CHECK_PERMISSIONS' => 'N'));
while ($lrow = $res->Fetch()) {
$iid = $lrow['ID'];
$eid = $lrow['EXTERNAL_ID'];
unset($lrow['ID']);
unset($lrow['EXTERNAL_ID']);
unset($lrow['XML_ID']);
unset($lrow['TMP_ID']);
unset($lrow['PROPERTY_ID']);
unset($lrow['PROPERTY_NAME']);
unset($lrow['PROPERTY_CODE']);
unset($lrow['PROPERTY_SORT']);
if ($lrow['SORT'] == '500') {
unset($lrow['SORT']);
}
if ($lrow['DEF'] == 'N') {
unset($lrow['DEF']);
}
if (count($lrow) == 1 && isset($lrow['VALUE'])) {
$lrow = $lrow['VALUE'];
}
$items[$eid] = $lrow;
}
$row['ITEMS'] = $items;
}
//.........这里部分代码省略.........
示例10: foreach
$oldPropertyProduct = null;
if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
$oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
}
}
$oldPropertyUnitProduct = null;
if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
$oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
}
}
$arSiteList = array();
$rsSites = CIBlock::GetSite($iblock["ID"]);
while ($arSite = $rsSites->Fetch())
{
$arSiteList[] = $arSite["SITE_ID"];
}
if (count($IBLOCK_EXPORT) != 0)
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
else
$boolExport = true;
$arIBlockList[] = array(
'ID' => $iblock['ID'],
'NAME' => $iblock['NAME'],
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
示例11: array
}
}
//--offers
if ($IBLOCK_OFFERS_ID == false) {
$permissions = array("1" => "X", "2" => "R");
$dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "sale_administrator"));
if ($arGroup = $dbGroup->Fetch()) {
$permissions[$arGroup["ID"]] = 'W';
}
$dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
if ($arGroup = $dbGroup->Fetch()) {
$permissions[$arGroup["ID"]] = 'W';
}
$IBLOCK_OFFERS_ID = WizardServices::ImportIBlockFromXML($iblockXMLFileOffers, "clothes_offers", $iblockTypeOffers, WIZARD_SITE_ID, $permissions);
$iblockID1 = WizardServices::ImportIBlockFromXML($iblockXMLFilePricesOffers, "clothes_offers", $iblockTypeOffers . "_prices", WIZARD_SITE_ID, $permissions);
if ($IBLOCK_OFFERS_ID < 1) {
return;
}
$_SESSION["WIZARD_OFFERS_IBLOCK_ID"] = $IBLOCK_OFFERS_ID;
} else {
$arSites = array();
$db_res = CIBlock::GetSite($IBLOCK_OFFERS_ID);
while ($res = $db_res->Fetch()) {
$arSites[] = $res["LID"];
}
if (!in_array(WIZARD_SITE_ID, $arSites)) {
$arSites[] = WIZARD_SITE_ID;
$iblock = new CIBlock();
$iblock->Update($IBLOCK_OFFERS_ID, array("LID" => $arSites));
}
}
示例12: foreach
foreach ($keys as $key) {
$id = intval($arParams["IBLOCK_OTHER_IDS"][$key]);
if ($id > 0 && $id != $arParams['IBLOCK_USER_ID'] && $id != $arParams['IBLOCK_GROUP_ID']) {
$arParams["IBLOCK_OTHER_IDS"][$key] = $id;
$dbRes = CIBlock::GetByID($id);
if ($dbRes && ($arRes = $dbRes->Fetch())) {
$path = str_replace(array('///', '//'), '/', str_replace('#SITE_DIR#', SITE_DIR, $arRes['LIST_PAGE_URL']));
if (SubStr($path, 0, 1) != '/') {
$path = '/' . $path;
}
if (SubStr($path, -1, 1) != '/') {
$path .= '/';
}
$path .= '#PATH#';
$arSites = array();
$rSites = CIBlock::GetSite($id);
while ($arSite = $rSites->Fetch()) {
$arSites[$arSite['LID']] = $arSite;
}
if (isset($arSites[SITE_ID])) {
$arDefaultUrlTemplates404 = array('i' . $id => $path) + $arDefaultUrlTemplates404;
$modes = array($id => rawurlencode(str_replace("/", "", $arRes['NAME']))) + $modes;
} else {
unset($arParams["IBLOCK_OTHER_IDS"][$key]);
}
} else {
unset($arParams["IBLOCK_OTHER_IDS"][$key]);
}
} else {
unset($arParams["IBLOCK_OTHER_IDS"][$key]);
}
示例13: PClearComponentCacheEx
function PClearComponentCacheEx($iblockId = false, $arSections = array(), $arGalleries = array(), $arUsers = array(), $clearCommon = true)
{
if (!$iblockId) {
return;
}
$arCache = array();
$arCache[] = "photogallery";
if ($clearCommon) {
$arCache[] = "search.page";
$arCache[] = "search.tags.cloud";
$arCache[] = "photogallery/" . $iblockId;
$arCache[] = "photogallery/" . $iblockId . "/pemission";
$arCache[] = "photogallery.detail.comment/" . $iblockId;
$arCache[] = "photogallery.gallery.list/" . $iblockId;
}
if (is_array($arSections)) {
$arSections = array_unique($arSections);
foreach ($arSections as $sectionId) {
$arCache[] = "photogallery/" . $iblockId . "/section" . intVal($sectionId);
}
}
$arCache[] = "photogallery/" . $iblockId . "/section" . intVal($sectionId);
if (is_array($arGalleries)) {
$arGalleries = array_unique($arGalleries);
foreach ($arGalleries as $galleryCode) {
$arCache[] = "photogallery/" . $iblockId . "/gallery" . $galleryCode;
}
// todo: secure galleryCode!!!!
}
if (is_array($arUsers)) {
$arUsers = array_unique($arUsers);
foreach ($arUsers as $userId) {
$arCache[] = "photogallery/" . $iblockId . "/user" . intVal($userId);
}
}
$arSite = array();
$rsIblockSite = CIBlock::GetSite($iblockId);
while ($arIblockSite = $rsIblockSite->Fetch()) {
$arSite[] = $arIblockSite["SITE_ID"];
}
PClearComponentCache($arCache, $arSite);
}
示例14: getIBlockSites
public static function getIBlockSites($iblockID)
{
$db_res = \CIBlock::GetSite($iblockID);
while ($res = $db_res->Fetch()) {
$arSites[] = $res["LID"];
}
return $arSites;
}
示例15: executeComponent
public function executeComponent()
{
if (!CModule::IncludeModule('sale')) {
ShowError("Module sale not installed!");
return;
}
if (!CModule::IncludeModule('catalog')) {
ShowError("Module catalog not installed!");
return;
}
$this->arResult["BITRIX_CATEGORY_ID"] = isset($this->arParams["BITRIX_CATEGORY_ID"]) ? $this->arParams["BITRIX_CATEGORY_ID"] : 0;
$this->arResult["IBLOCK_ID"] = isset($this->arParams["IBLOCK_ID"]) ? $this->arParams["IBLOCK_ID"] : 0;
if (isset($this->arParams["EBAY_CATEGORY_ID"])) {
$this->arResult["EBAY_CATEGORY_ID"] = $this->arParams["EBAY_CATEGORY_ID"];
} else {
$this->arResult["EBAY_CATEGORY_ID"] = $this->getMappedEbayCategoryId($this->arResult["BITRIX_CATEGORY_ID"]);
}
$this->arResult["TOP_CATEGORIES_LIST"] = $this->getTopCategories();
$this->arResult["VARIATIONS_BLOCK_ID"] = 'SALE_EBAY_CAT_' . $this->arResult["EBAY_CATEGORY_ID"] . '_VARIATIONS';
$siteRes = CIBlock::GetSite($this->arResult["IBLOCK_ID"]);
//todo: It can be many sites for one iblock.
if ($site = $siteRes->Fetch()) {
$this->arResult["SITE_ID"] = $site["LID"];
} else {
$this->arResult["SITE_ID"] = "";
}
if (strlen($this->arResult["EBAY_CATEGORY_ID"]) > 0) {
$this->arResult["CATEGORY_AND_PARENTS_INFO"] = $this->getCategoryAndParentsInfo($this->arResult["EBAY_CATEGORY_ID"]);
if (isset($this->arResult["CATEGORY_AND_PARENTS_INFO"][1]["CATEGORY_ID"])) {
$this->arResult["TOP_CATEGORY_ID"] = $this->arResult["CATEGORY_AND_PARENTS_INFO"][1]["CATEGORY_ID"];
}
$this->arResult["EBAY_CATEGORY_VARIATIONS"] = \Bitrix\Sale\TradingPlatform\Ebay\Helper::getEbayCategoryVariations($this->arResult["EBAY_CATEGORY_ID"], $this->arResult["SITE_ID"]);
if (isset($this->arParams["VARIATIONS_VALUES"])) {
$this->arResult["VARIATIONS_VALUES"] = $this->arParams["VARIATIONS_VALUES"];
} else {
$this->arResult["VARIATIONS_VALUES"] = $this->getVariationsValues($this->arResult["IBLOCK_ID"], $this->arResult["EBAY_CATEGORY_ID"], $this->arResult["EBAY_CATEGORY_VARIATIONS"]);
}
} else {
$this->arResult["VARIATIONS_VALUES"] = array('' => '');
$this->arResult["EBAY_CATEGORY_VARIATIONS"] = array();
}
$this->arResult["CATEGORY_PROPS"] = \CIBlockSectionPropertyLink::GetArray($this->arParams["IBLOCK_ID"], $this->arParams["BITRIX_CATEGORY_ID"]);
$rsProps = \CIBlockProperty::GetList(array("SORT" => "ASC", 'ID' => 'ASC'), array("IBLOCK_ID" => $this->arParams["IBLOCK_ID"], "CHECK_PERMISSIONS" => "N", "ACTIVE" => "Y"));
while ($arProp = $rsProps->Fetch()) {
if (isset($this->arResult["CATEGORY_PROPS"][$arProp["ID"]])) {
$this->arResult["CATEGORY_PROPS"][$arProp["ID"]]["NAME"] = $arProp["NAME"];
}
}
$this->arResult["IBLOCK_IDS"] = array($this->arParams["IBLOCK_ID"] => Loc::getMessage("SALE_EBAY_SEC_CATEGORY_PROP"));
$arOffers = \CCatalogSKU::GetInfoByProductIBlock($this->arParams["IBLOCK_ID"]);
if (is_array($arOffers) && !empty($arOffers)) {
$this->arResult["OFFERS_IBLOCK_ID"] = $arOffers["IBLOCK_ID"];
$this->arResult["CATEGORY_OFFERS_PROPS"] = \CIBlockSectionPropertyLink::GetArray($arOffers["IBLOCK_ID"], $this->arParams["BITRIX_CATEGORY_ID"]);
$rsProps = \CIBlockProperty::GetList(array("SORT" => "ASC", 'ID' => 'ASC'), array("IBLOCK_ID" => $arOffers["IBLOCK_ID"], "CHECK_PERMISSIONS" => "N", "ACTIVE" => "Y"));
while ($arProp = $rsProps->Fetch()) {
if (isset($this->arResult["CATEGORY_OFFERS_PROPS"][$arProp["ID"]])) {
$this->arResult["CATEGORY_OFFERS_PROPS"][$arProp["ID"]]["NAME"] = $arProp["NAME"];
}
}
$this->arResult["IBLOCK_IDS"][$arOffers["IBLOCK_ID"]] = Loc::getMessage("SALE_EBAY_SEC_OFFERS_PROP");
}
$this->IncludeComponentTemplate();
}