本文整理汇总了PHP中CIBlock::GetArrayById方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetArrayById方法的具体用法?PHP CIBlock::GetArrayById怎么用?PHP CIBlock::GetArrayById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::GetArrayById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if ($sections) {
$sectionList = CIBlockSection::GetList(array("left_margin" => "asc"), array("=ID" => $sections), false, array("ID", "NAME"));
while ($section = $sectionList->Fetch()) {
if (!$firstSection) {
$firstSection = $section["ID"];
}
if ($section_id == $section["ID"]) {
$inSelect = true;
$html .= '<option value="' . htmlspecialcharsbx($section["ID"]) . '" selected>' . htmlspecialcharsEx($section["NAME"]) . '</option>';
} else {
$html .= '<option value="' . htmlspecialcharsbx($section["ID"]) . '">' . htmlspecialcharsEx($section["NAME"]) . '</option>';
}
}
}
$html .= '</select><br>';
$arIBlock = CIBlock::GetArrayById($_REQUEST["IBLOCK_ID"]);
$arFields = array("LANG_DIR" => "", "LID" => $arIBlock["LID"], "ID" => $_REQUEST["ID"], "IBLOCK_ID" => $_REQUEST["IBLOCK_ID"], "CODE" => $_POST["CODE"], "EXTERNAL_ID" => $_POST["XML_ID"], "IBLOCK_TYPE_ID" => CIBlock::GetArrayById($_REQUEST["IBLOCK_ID"], "IBLOCK_TYPE_ID"), "IBLOCK_CODE" => CIBlock::GetArrayById($_REQUEST["IBLOCK_ID"], "CODE"), "IBLOCK_EXTERNAL_ID" => CIBlock::GetArrayById($_REQUEST["IBLOCK_ID"], "XML_ID"), "IBLOCK_SECTION_ID" => $inSelect ? $section_id : $firstSection);
if ($arIBlock["CANONICAL_PAGE_URL"]) {
$html .= GetMessage("IB_TA_CANONICAL_PAGE_URL") . "<br>";
$page_url = CIBlock::ReplaceDetailUrl($arIBlock["CANONICAL_PAGE_URL"], $arFields, true, "E");
$html .= '<a href="' . htmlspecialcharsbx($page_url) . '" target="_blank">' . htmlspecialcharsEx($page_url) . '</a>';
} else {
$page_url = CIBlock::ReplaceDetailUrl($arIBlock["DETAIL_PAGE_URL"], $arFields, true, "E");
$html .= htmlspecialcharsEx($page_url);
}
$result[] = array("htmlId" => "RESULT_IBLOCK_ELEMENT_SECTION_ID", "value" => $html);
}
echo CUtil::PhpToJSObject($result);
}
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_after.php";
示例2: array
//Types
$arTypes = array(array("SID" => "MAIN", "ACTIVE" => "Y", "SORT" => 1, "NAME" => GetMessage("DEMO_ADV_MAIN_TYPE"), "DESCRIPTION" => ""), array("SID" => "PARALLAX", "ACTIVE" => "Y", "SORT" => 2, "NAME" => GetMessage("DEMO_ADV_PARALLAX_TYPE"), "DESCRIPTION" => ""));
foreach ($arTypes as $arFields) {
$dbResult = CAdvType::GetByID($arTypes["SID"], $CHECK_RIGHTS = "N");
if ($dbResult && $dbResult->Fetch()) {
continue;
}
CAdvType::Set($arFields, "", $CHECK_RIGHTS = "N");
}
$pathToBanner = str_replace("\\", "/", dirname(__FILE__));
$lang = in_array(LANGUAGE_ID, array("ru", "en", "de")) ? LANGUAGE_ID : \Bitrix\Main\Localization\Loc::getDefaultLang(LANGUAGE_ID);
$pathToBanner = $pathToBanner . "/lang/" . $lang;
if (CModule::IncludeModule("iblock")) {
$IBLOCK_CATALOG_ID = $_SESSION["WIZARD_CATALOG_IBLOCK_ID"];
$arSectionLinks = array();
$urlTemplate = CIBlock::GetArrayById($IBLOCK_CATALOG_ID, "SECTION_PAGE_URL");
$urlTemplate = str_replace("#SITE_DIR#", WIZARD_SITE_DIR, $urlTemplate);
$dbSect = CIBlockSection::GetList(array(), array("IBLOCK_TYPE" => "catalog", "IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => array("underwear", "shoes"), "IBLOCK_SITE_ID" => WIZARD_SITE_ID), false, array("SECTION_PAGE_URL"));
$dbSect->SetUrlTemplates("", $urlTemplate);
while ($arSect = $dbSect->GetNext()) {
$arSectionLinks[$arSect["CODE"]] = $arSect["SECTION_PAGE_URL"];
}
}
$arBanners = array(array("CONTRACT_ID" => $contractId, "TYPE_SID" => "MAIN", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("DEMO_ADV_NAME"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 200, "FIX_SHOW" => "N", "FIX_CLICK" => "Y", "AD_TYPE" => "template", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "banner for " . WIZARD_SITE_ID, "TEMPLATE" => serialize(array("NAME" => "bootstrap", "MODE" => "N", "PROPS" => array(0 => array("BANNER_NAME" => GetMessage("DEMO_ADV_1_NAME"), "BACKGROUND" => "stream", "IMG_FIXED" => "N", "LINK_URL" => $arSectionLinks["underwear"], "LINK_TITLE" => "", "LINK_TARGET" => "_self", "PRESET" => "3", "HEADING_SHOW" => "Y", "HEADING" => GetMessage("DEMO_ADV_1_NAME"), "HEADING_FONT_SIZE" => 35, "HEADING_FONT_COLOR" => "000000", "HEADING_BG_COLOR" => "FFFFFF", "HEADING_BG_OPACITY" => 20, "ANNOUNCEMENT_SHOW" => "Y", "ANNOUNCEMENT" => GetMessage("DEMO_ADV_1_ANNOUNCEMENT"), "ANNOUNCEMENT_FONT_SIZE" => "14", "ANNOUNCEMENT_FONT_COLOR" => "000000", "ANNOUNCEMENT_BG_COLOR" => "FFFFFF", "ANNOUNCEMENT_BG_OPACITY" => "100", "ANNOUNCEMENT_MOBILE_HIDE" => "N", "BUTTON" => "Y", "BUTTON_TEXT" => GetMessage("DEMO_ADV_1_BUTTON"), "BUTTON_FONT_COLOR" => "FFFFFF", "BUTTON_BG_COLOR" => "E6A323", "BUTTON_LINK_URL" => $arSectionLinks["underwear"], "BUTTON_LINK_TARGET" => "_self", "ANIMATION" => "N", "OVERLAY" => "N", "STREAM" => "https://youtu.be/h-Sw7RZc4mQ", "STREAM_MUTE" => "Y"), 1 => array("BANNER_NAME" => GetMessage("DEMO_ADV_2_NAME"), "BACKGROUND" => "image", "IMG_FIXED" => "N", "LINK_URL" => $arSectionLinks["shoes"], "LINK_TITLE" => "", "LINK_TARGET" => "_self", "PRESET" => "3", "HEADING_SHOW" => "Y", "HEADING" => GetMessage("DEMO_ADV_2_HEADING"), "HEADING_FONT_SIZE" => 30, "HEADING_FONT_COLOR" => "000000", "HEADING_BG_COLOR" => "FFFFFF", "HEADING_BG_OPACITY" => 20, "ANNOUNCEMENT_SHOW" => "Y", "ANNOUNCEMENT" => GetMessage("DEMO_ADV_2_ANNOUNCEMENT"), "ANNOUNCEMENT_FONT_SIZE" => "14", "ANNOUNCEMENT_FONT_COLOR" => "000000", "ANNOUNCEMENT_BG_COLOR" => "FFFFFF", "ANNOUNCEMENT_BG_OPACITY" => "100", "ANNOUNCEMENT_MOBILE_HIDE" => "N", "BUTTON" => "Y", "BUTTON_TEXT" => GetMessage("DEMO_ADV_2_BUTTON"), "BUTTON_FONT_COLOR" => "FFFFFF", "BUTTON_BG_COLOR" => "E6A323", "BUTTON_LINK_URL" => $arSectionLinks["shoes"], "BUTTON_LINK_TARGET" => "_self", "ANIMATION" => "N", "OVERLAY" => "N"), 2 => array("BANNER_NAME" => GetMessage("DEMO_ADV_3_NAME"), "BACKGROUND" => "image", "IMG_FIXED" => "N", "LINK_TITLE" => "", "LINK_TARGET" => "_self", "PRESET" => "3", "HEADING_SHOW" => "Y", "HEADING" => GetMessage("DEMO_ADV_3_HEADING"), "HEADING_FONT_SIZE" => 30, "HEADING_FONT_COLOR" => "000000", "HEADING_BG_COLOR" => "FFFFFF", "HEADING_BG_OPACITY" => 20, "ANNOUNCEMENT_SHOW" => "Y", "ANNOUNCEMENT" => GetMessage("DEMO_ADV_3_ANNOUNCEMENT"), "ANNOUNCEMENT_FONT_SIZE" => "14", "ANNOUNCEMENT_FONT_COLOR" => "000000", "ANNOUNCEMENT_BG_COLOR" => "FFFFFF", "ANNOUNCEMENT_BG_OPACITY" => "100", "ANNOUNCEMENT_MOBILE_HIDE" => "N", "BUTTON" => "N", "ANIMATION" => "N", "OVERLAY" => "N")))), "TEMPLATE_FILES" => array(0 => array(), 1 => array("IMG" => array("name" => "banner_shoes.jpeg", "type" => "image/jpg", "tmp_name" => $pathToBanner . "/banner_shoes.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/banner_shoes.jpg"), "MODULE_ID" => "advertising")), 2 => array("IMG" => array("name" => "banner.jpeg", "type" => "image/jpg", "tmp_name" => $pathToBanner . "/banner.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/banner.jpg"), "MODULE_ID" => "advertising")))), array("CONTRACT_ID" => $contractId, "TYPE_SID" => "PARALLAX", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("DEMO_ADV_SLIDER_NAME"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 200, "FIX_SHOW" => "N", "FIX_CLICK" => "Y", "AD_TYPE" => "template", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "banner2 for " . WIZARD_SITE_ID, "TEMPLATE" => serialize(array("NAME" => "parallax", "MODE" => "N", "PROPS" => array(0 => array("BANNER_NAME" => GetMessage("DEMO_ADV_4_NAME"), "BACKGROUND" => "image", "IMG_FIXED" => "N", "LINK_URL" => WIZARD_SITE_DIR . "about/delivery/", "LINK_TITLE" => "", "LINK_TARGET" => "_self", "PRESET" => "3", "HEADING_SHOW" => "Y", "HEADING" => GetMessage("DEMO_ADV_4_HEADING"), "HEADING_FONT_SIZE" => 30, "HEADING_FONT_COLOR" => "000000", "HEADING_BG_COLOR" => "FFFFFF", "HEADING_BG_OPACITY" => 20, "ANNOUNCEMENT_SHOW" => "Y", "ANNOUNCEMENT" => GetMessage("DEMO_ADV_4_ANNOUNCEMENT"), "ANNOUNCEMENT_FONT_SIZE" => "14", "ANNOUNCEMENT_FONT_COLOR" => "000000", "ANNOUNCEMENT_BG_COLOR" => "FFFFFF", "ANNOUNCEMENT_BG_OPACITY" => "100", "ANNOUNCEMENT_MOBILE_HIDE" => "N", "BUTTON" => "Y", "BUTTON_TEXT" => GetMessage("DEMO_ADV_4_BUTTON"), "BUTTON_FONT_COLOR" => "FFFFFF", "BUTTON_BG_COLOR" => "E6A323", "BUTTON_LINK_URL" => WIZARD_SITE_DIR . "about/delivery/", "BUTTON_LINK_TARGET" => "_self", "OVERLAY" => "N")))), "TEMPLATE_FILES" => array(array("IMG" => array("name" => "banner_parallax.jpeg", "type" => "image/jpg", "tmp_name" => $pathToBanner . "/banner_parallax.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/banner_parallax.jpg"), "MODULE_ID" => "advertising")))));
foreach ($arBanners as $arFields) {
$dbResult = CAdvBanner::GetList($by, $order, array("COMMENTS" => $arFields["COMMENTS"], "COMMENTS_EXACT_MATCH" => "Y"), $is_filtered, "N");
if ($dbResult && $dbResult->Fetch()) {
continue;
}
CAdvBanner::Set($arFields, "", $CHECK_RIGHTS = "N");
}