public static function ShowPanel($IBLOCK_ID=0, $ELEMENT_ID=0, $SECTION_ID="", $type="news", $bGetIcons=false, $componentName="", $arLabels=array()) { /** @global CMain $APPLICATION */ global $APPLICATION; /** @global CUser $USER */ global $USER; if (($USER->IsAuthorized() || $APPLICATION->ShowPanel===true) && $APPLICATION->ShowPanel!==false) { if (CModule::IncludeModule("iblock") && strlen($type) > 0) { $arButtons = CIBlock::GetPanelButtons($IBLOCK_ID, $ELEMENT_ID, $SECTION_ID, array( "LABELS" => $arLabels, )); $mode = $APPLICATION->GetPublicShowMode(); if($bGetIcons) { return CIBlock::GetComponentMenu($mode, $arButtons); } else { CIBlock::AddPanelButtons($mode, $componentName, $arButtons); } } } return null; }
function ShowPanel($IBLOCK_ID = 0, $ELEMENT_ID = 0, $SECTION_ID = "", $type = "news", $bGetIcons = false, $componentName = "", $arLabels = array()) { global $APPLICATION, $USER; if (!(($USER->IsAuthorized() || $APPLICATION->ShowPanel === true) && $APPLICATION->ShowPanel !== false)) { return; } if (!CModule::IncludeModule("iblock") || !strlen($type)) { return; } $arButtons = CIBlock::GetPanelButtons($IBLOCK_ID, $ELEMENT_ID, $SECTION_ID, array("LABELS" => $arLabels)); $mode = $APPLICATION->GetPublicShowMode(); if ($bGetIcons) { return CIBlock::GetComponentMenu($mode, $arButtons); } else { CIBlock::AddPanelButtons($mode, $componentName, $arButtons); } }
) { $arReturnUrl = array( "add_element" => CIBlock::GetArrayByID($arResult["IBLOCK_ID"], "DETAIL_PAGE_URL"), "delete_element" => ( empty($arResult["SECTION_URL"])? $arResult["LIST_PAGE_URL"]: $arResult["SECTION_URL"] ), ); $arButtons = CIBlock::GetPanelButtons( $arResult["IBLOCK_ID"], $arResult["ID"], $arResult["IBLOCK_SECTION_ID"], Array( "RETURN_URL" => $arReturnUrl, "SECTION_BUTTONS" => false, ) ); if($APPLICATION->GetShowIncludeAreas()) $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); if($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array( 'ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_element"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_element"]["ACTION"], 'COMPONENT_NAME' => $this->GetName(), );
$rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]); $arSection = $rsSection->GetNext(); $UrlDeleteSectionButton = $arSection["SECTION_PAGE_URL"]; } if (empty($UrlDeleteSectionButton)) { $url_template = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "LIST_PAGE_URL"); $arIBlock = CIBlock::GetArrayByID($arParams["IBLOCK_ID"]); $arIBlock["IBLOCK_CODE"] = $arIBlock["CODE"]; $UrlDeleteSectionButton = CIBlock::ReplaceDetailURL($url_template, $arIBlock, true, false); } $arReturnUrl = array("add_section" => strlen($arParams["SECTION_URL"]) ? $arParams["SECTION_URL"] : CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "SECTION_PAGE_URL"), "delete_section" => $UrlDeleteSectionButton); $buttonParams = array('RETURN_URL' => $arReturnUrl, 'CATALOG' => true); if (isset($arResult['USE_CATALOG_BUTTONS'])) { $buttonParams['USE_CATALOG_BUTTONS'] = $arResult['USE_CATALOG_BUTTONS']; } $arButtons = CIBlock::GetPanelButtons($arParams["IBLOCK_ID"], 0, $arResult["ID"], $buttonParams); unset($buttonParams); if ($APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } if (is_array($arButtons["intranet"]) && is_object($INTRANET_TOOLBAR) && $arParams["INTRANET_TOOLBAR"] !== "N") { $APPLICATION->AddHeadScript('/bitrix/js/main/utils.js'); foreach ($arButtons["intranet"] as $arButton) { $INTRANET_TOOLBAR->AddButton($arButton); } } if ($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array('ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_section"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_section"]["ACTION"], 'COMPONENT_NAME' => $this->GetName()); } } }
if (Loader::includeModule("iblock")) { $UrlDeleteSectionButton = ""; if ($arResult["IBLOCK_SECTION_ID"] > 0) { $rsSection = CIBlockSection::GetList(array(), array("=ID" => $arResult["IBLOCK_SECTION_ID"]), false, array("SECTION_PAGE_URL")); $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]); $arSection = $rsSection->GetNext(); $UrlDeleteSectionButton = $arSection["SECTION_PAGE_URL"]; } if (empty($UrlDeleteSectionButton)) { $url_template = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "LIST_PAGE_URL"); $arIBlock = CIBlock::GetArrayByID($arParams["IBLOCK_ID"]); $arIBlock["IBLOCK_CODE"] = $arIBlock["CODE"]; $UrlDeleteSectionButton = CIBlock::ReplaceDetailURL($url_template, $arIBlock, true, false); } $arReturnUrl = array("add_section" => strlen($arParams["SECTION_URL"]) ? $arParams["SECTION_URL"] : CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "SECTION_PAGE_URL"), "delete_section" => $UrlDeleteSectionButton); $arButtons = CIBlock::GetPanelButtons($arParams["IBLOCK_ID"], 0, $arResult["ID"], array("RETURN_URL" => $arReturnUrl, "CATALOG" => true)); if ($APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } if (is_array($arButtons["intranet"]) && is_object($INTRANET_TOOLBAR) && $arParams["INTRANET_TOOLBAR"] !== "N") { $APPLICATION->AddHeadScript('/bitrix/js/main/utils.js'); foreach ($arButtons["intranet"] as $arButton) { $INTRANET_TOOLBAR->AddButton($arButton); } } if ($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array('ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_section"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_section"]["ACTION"], 'COMPONENT_NAME' => $this->GetName()); } } } }
CUtil::InitJSCore(); if( $arResult["IBLOCK_ID"] && $USER->IsAuthorized() && ( $APPLICATION->GetShowIncludeAreas() || ( is_object($GLOBALS["INTRANET_TOOLBAR"]) && $arParams["INTRANET_TOOLBAR"]!=="N" ) ) && CModule::IncludeModule("iblock") ) { $arButtons = CIBlock::GetPanelButtons($arResult["IBLOCK_ID"], 0, $arParams["SECTION_ID"], array("SECTION_BUTTONS"=>false)); if($APPLICATION->GetShowIncludeAreas()) $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); if( is_array($arButtons["intranet"]) && is_object($GLOBALS["INTRANET_TOOLBAR"]) && $arParams["INTRANET_TOOLBAR"]!=="N" ) { $APPLICATION->AddHeadScript('/bitrix/js/main/utils.js'); foreach($arButtons["intranet"] as $arButton) $GLOBALS["INTRANET_TOOLBAR"]->AddButton($arButton); } }
} if ($arParams["ID"]) { $filter["ID"] = $arParams["ID"]; } $rsItems = \CIBlockElement::GetList( false, $filter, false, false, $select ); while ($item = $rsItems->GetNext()) { $arButtons = CIBlock::GetPanelButtons( $item["IBLOCK_ID"], $item["ID"], 0, array("SECTION_BUTTONS"=>false, "SESSID"=>false) ); $item["EDIT_LINK"] = $arButtons["edit"]["edit_element"]["ACTION_URL"]; $item["DELETE_LINK"] = $arButtons["edit"]["delete_element"]["ACTION_URL"]; if ($item["PREVIEW_PICTURE"]) { if ($arParams["RESIZE_PREVIEW_PICTURE"] === "Y") { $item["PREVIEW_PICTURE"] = \imageResize(array("WIDTH" => $arParams["RESIZE_WIDTH"], "HEIGHT" => $arParams["RESIZE_HEIGHT"], "MODE" => "cut"), \CFile::GetPath($item["PREVIEW_PICTURE"])); } else { $item["PREVIEW_PICTURE"] = \CFile::GetPath($item["PREVIEW_PICTURE"]); } } if ($arParams["SHOW_DATE"] === "Y") { $item["DATE"]["DAY"] = FormatDate('d', MakeTimeStamp($item["DATE_ACTIVE_FROM"])); $item["DATE"]["MONTH"] = FormatDate('F', MakeTimeStamp($item["DATE_ACTIVE_FROM"]));
$APPLICATION->GetShowIncludeAreas() || $arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]]) ) { if (Loader::includeModule('iblock')) { $arReturnUrl = array( "add_element" => CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "DETAIL_PAGE_URL"), "delete_element" => ( isset($arResult["SECTION"])? $arResult["SECTION"]["SECTION_PAGE_URL"]: $arResult["LIST_PAGE_URL"] ), ); $arButtons = CIBlock::GetPanelButtons($arResult["IBLOCK_ID"], $arResult["ID"], $arResult["IBLOCK_SECTION_ID"], Array("RETURN_URL" => $arReturnUrl, "CATALOG"=>true)); if($APPLICATION->GetShowIncludeAreas()) $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); if($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array( 'ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_element"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_element"]["ACTION"], 'COMPONENT_NAME' => $this->GetName(), ); } } } }
if ($this->__page == 'index') { ob_start(); $APPLICATION->IncludeComponent("bitrix:idea.search", "", array(), $component); $arResult["ACTIONS"]["SEARCH"] = array("HTML" => ob_get_contents()); ob_end_clean(); } //Can Add Idea if ($USER->IsAuthorized()) { $arBlog = CBlog::GetByUrl($arParams["BLOG_URL"]); if (CBlog::GetBlogUserPostPerms($arBlog["ID"], $USER->GetID()) >= BLOG_PERMS_PREMODERATE) { $arResult["ACTIONS"]["ADD_IDEA"] = array("ICON" => "btn-new section-add", "TEXT" => GetMessage("IDEA_ADD_IDEA_TITLE"), "LINK" => $arResult["~PATH_TO_POST_ADD"]); } } //Can Add category if ($USER->IsAuthorized() && $arParams["IBLOCK_CATEGORIES"] > 0 && CIBlock::GetPermission($arParams["IBLOCK_CATEGORIES"], $USER->GetID()) >= "W") { $arButtons = CIBlock::GetPanelButtons($arParams["IBLOCK_CATEGORIES"], 0, 0, array("SESSID" => false)); $arResult["ACTIONS"]["ADD_IDEA_CATEGORY"] = array("ICON" => "btn-new section-add", "TEXT" => GetMessage("IDEA_ADD_IDEA_CATEGORY_TITLE"), "LINK" => $arButtons["edit"]["add_section"]["ACTION"]); } //Menu if ($USER->IsAuthorized()) { $arResult["ACTIONS"]["MENU"] = array("TEXT" => GetMessage("IDEA_MENU_TITLE"), "MENU" => array()); //Own ideas $arResult["ACTIONS"]["MENU"]["MENU"][] = array("TEXT" => GetMessage("IDEA_MY_IDEA_TITLE"), "ONCLICK" => "top.window.location.href='" . $arResult["~PATH_TO_USER_IDEAS"] . "';"); $arResult["ACTIONS"]["MENU"]["MENU"][] = array("SEPARATOR" => true); //Own subscribes $arResult["ACTIONS"]["MENU"]["MENU"][] = array("TEXT" => GetMessage("IDEA_MY_SUBSCRIBE_TITLE"), "ONCLICK" => "top.window.location.href='" . $arResult["~PATH_TO_USER_SUBSCRIBE"] . "';"); } //Top part of sidebar Wrapper $this->SetViewTarget("sidebar", 1); echo '<div class="sidebar-block idea-detail-info"> <b class="r2"></b>
/** * Get items for view. * @return mixed[] array('ID' => array(), 'ID' => array(), ...) */ protected function getItems() { if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) { return array(); } $elementIterator = CIBlockElement::GetList(array(), $this->filter, false, false, $this->selectFields); $elementIterator->SetUrlTemplates($this->arParams["DETAIL_URL"]); $defaultMeasure = $this->data['DEFAULT_MEASURE']; $items = array(); while ($elementObj = $elementIterator->GetNextElement()) { $item = $elementObj->GetFields(); $item['ID'] = (int) $item['ID']; $item['ACTIVE_FROM'] = $item['DATE_ACTIVE_FROM']; $item['ACTIVE_TO'] = $item['DATE_ACTIVE_TO']; $buttons = CIBlock::GetPanelButtons($item["IBLOCK_ID"], $item["ID"], 0, array("SECTION_BUTTONS" => false, "SESSID" => false, "CATALOG" => true)); $item["EDIT_LINK"] = $buttons["edit"]["edit_element"]["ACTION_URL"]; $item["DELETE_LINK"] = $buttons["edit"]["delete_element"]["ACTION_URL"]; // Inherited Properties $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($item["IBLOCK_ID"], $item["ID"]); $item["IPROPERTY_VALUES"] = $ipropValues->getValues(); $item["PREVIEW_PICTURE"] = 0 < $item["PREVIEW_PICTURE"] ? CFile::GetFileArray($item["PREVIEW_PICTURE"]) : false; if ($item["PREVIEW_PICTURE"]) { $item["PREVIEW_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"]; if ($item["PREVIEW_PICTURE"]["ALT"] == "") { $item["PREVIEW_PICTURE"]["ALT"] = $item["NAME"]; } $item["PREVIEW_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"]; if ($item["PREVIEW_PICTURE"]["TITLE"] == "") { $item["PREVIEW_PICTURE"]["TITLE"] = $item["NAME"]; } } $item["DETAIL_PICTURE"] = 0 < $item["DETAIL_PICTURE"] ? CFile::GetFileArray($item["DETAIL_PICTURE"]) : false; if ($item["DETAIL_PICTURE"]) { $item["DETAIL_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"]; if ($item["DETAIL_PICTURE"]["ALT"] == "") { $item["DETAIL_PICTURE"]["ALT"] = $item["NAME"]; } $item["DETAIL_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"]; if ($item["DETAIL_PICTURE"]["TITLE"] == "") { $item["DETAIL_PICTURE"]["TITLE"] = $item["NAME"]; } } $itemIblockId = (int) $item['IBLOCK_ID']; $needItemProperties = isset($this->arParams['PROPERTY_CODE'][$itemIblockId]) && !empty($this->arParams['PROPERTY_CODE'][$itemIblockId]) || isset($this->arParams['ADDITIONAL_PICT_PROP'][$itemIblockId]) || isset($this->arParams['LABEL_PROP'][$itemIblockId]); $item["PROPERTIES"] = array(); $item["DISPLAY_PROPERTIES"] = array(); if ($needItemProperties) { $item["PROPERTIES"] = $elementObj->getProperties(); CCatalogDiscount::SetProductPropertiesCache($item['ID'], $item["PROPERTIES"]); } if (isset($this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']])) { $properties = $this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']]; foreach ($properties as $propertyName) { if (!isset($item["PROPERTIES"][$propertyName])) { continue; } $prop =& $item["PROPERTIES"][$propertyName]; $boolArr = is_array($prop["VALUE"]); if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) { $item["DISPLAY_PROPERTIES"][$propertyName] = CIBlockFormatProperties::GetDisplayValue($item, $prop, "catalog_out"); } } } $item["PRODUCT_PROPERTIES"] = array(); $item['PRODUCT_PROPERTIES_FILL'] = array(); if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']])) { $item["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($item['IBLOCK_ID'], $item["ID"], $this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']], $item["PROPERTIES"]); if (!empty($item["PRODUCT_PROPERTIES"])) { $item['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($item['PRODUCT_PROPERTIES']); } } if (!isset($item["CATALOG_MEASURE_RATIO"])) { $item["CATALOG_MEASURE_RATIO"] = 1; } if (!isset($item['CATALOG_MEASURE'])) { $item['CATALOG_MEASURE'] = 0; } $item['CATALOG_MEASURE'] = intval($item['CATALOG_MEASURE']); if (0 > $item['CATALOG_MEASURE']) { $item['CATALOG_MEASURE'] = 0; } if (!isset($item['CATALOG_MEASURE_NAME'])) { $item['CATALOG_MEASURE_NAME'] = ''; } $item['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS']; $item['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS']; $items[$item['ID']] = $item; } return $items; }
/** * Add to page buttons for edit elements and sections of info-block */ protected function setEditButtons() { global $APPLICATION; if (!$APPLICATION->GetShowIncludeAreas() || $this->showEditButtons === false) { return false; } $buttons = \CIBlock::GetPanelButtons($this->arParams['IBLOCK_ID'], $this->arResult['ID'], $this->arParams['SECTION_ID'], []); $this->addIncludeAreaIcons(\CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $buttons)); if (is_array($buttons['intranet'])) { Asset::getInstance()->addJs(BX_ROOT . '/js/main/utils.js'); foreach ($buttons['intranet'] as $button) { $this->addEditButton($button); } } }
$this->IncludeComponentTemplate(); } if ($arResult['SECTIONS_COUNT'] > 0 || isset($arResult['SECTION'])) { if ($USER->IsAuthorized() && $APPLICATION->GetShowIncludeAreas() && \Bitrix\Main\Loader::includeModule('iblock')) { $UrlDeleteSectionButton = ''; if (isset($arResult['SECTION']) && $arResult['SECTION']['IBLOCK_SECTION_ID'] > 0) { $rsSection = CIBlockSection::GetList(array(), array('=ID' => $arResult['SECTION']['IBLOCK_SECTION_ID']), false, array('SECTION_PAGE_URL')); $rsSection->SetUrlTemplates('', $arParams['SECTION_URL']); $arSection = $rsSection->GetNext(); $UrlDeleteSectionButton = $arSection['SECTION_PAGE_URL']; } if (empty($UrlDeleteSectionButton)) { $url_template = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'LIST_PAGE_URL'); $arIBlock = CIBlock::GetArrayByID($arParams['IBLOCK_ID']); $arIBlock['IBLOCK_CODE'] = $arIBlock['CODE']; $UrlDeleteSectionButton = CIBlock::ReplaceDetailURL($url_template, $arIBlock, true, false); } $arReturnUrl = array('add_section' => '' != $arParams['SECTION_URL'] ? $arParams['SECTION_URL'] : CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'SECTION_PAGE_URL'), 'add_element' => '' != $arParams['SECTION_URL'] ? $arParams['SECTION_URL'] : CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'SECTION_PAGE_URL'), 'delete_section' => $UrlDeleteSectionButton); $arButtons = CIBlock::GetPanelButtons($arParams['IBLOCK_ID'], 0, $arResult['SECTION']['ID'], array('RETURN_URL' => $arReturnUrl, 'CATALOG' => true)); $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } if ($arParams['ADD_SECTIONS_CHAIN'] && isset($arResult['SECTION']) && is_array($arResult['SECTION']['PATH'])) { foreach ($arResult['SECTION']['PATH'] as $arPath) { if (isset($arPath['IPROPERTY_VALUES']['SECTION_PAGE_TITLE']) && $arPath['IPROPERTY_VALUES']['SECTION_PAGE_TITLE'] != '') { $APPLICATION->AddChainItem($arPath['IPROPERTY_VALUES']['SECTION_PAGE_TITLE'], $arPath['~SECTION_PAGE_URL']); } else { $APPLICATION->AddChainItem($arPath['NAME'], $arPath['~SECTION_PAGE_URL']); } } } }
/** * Отображает кнопки управления компонентом в публичной части в режиме редактирования */ protected function showPanelButtons() { $buttons = \CIBlock::GetPanelButtons($this->arResult['IBLOCK']['ID'], 0, 0, ['SECTION_BUTTONS' => $this->arParams['ADD_PANEL_SECTION_BUTTONS'] == 'Y']); global $APPLICATION; if ($this->arParams['SHOW_PANEL_BUTTONS'] == 'Y' && $APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(\CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $buttons)); } }
foreach ($arResult['SECTIONS'] as $keySection => $valSection) { $strPlayList .= "\r\n\t\t\t{\r\n\t\t\t\tId: '" . $keySection . "',\r\n\t\t\t\tName: '" . __CIBlockTV::Prepare($valSection['NAME']) . "',\r\n\t\t\t\tDepth: '" . intval($valSection['DEPTH_LEVEL']) . "',\r\n\t\t\t\tItems:\r\n\t\t\t\t["; $j = 0; foreach ($valSection['ELEMENTS'] as $keyElement => $ValElement) { if (!$ValElement['PREVIEW_PICTURE']) { $ValElement['PREVIEW_PICTURE'] = $PathToComponent . '/images/default_small.png'; } if (!$ValElement['DETAIL_PICTURE']) { $ValElement['DETAIL_PICTURE'] = $PathToComponent . '/images/default_big.png'; } if (!$FirstItem) { $FirstItem = $ValElement; $FirstItem['JS_SECTION'] = $i; $FirstItem['JS_ITEM'] = 0; } $arButtons = CIBlock::GetPanelButtons($ValElement["IBLOCK_ID"], $ValElement["ID"], $valSection["ID"], array("SECTION_BUTTONS" => false)); $strPlayList .= "\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tId: " . $keyElement . ",\r\n\t\t\t\t\t\tName: '" . __CIBlockTV::Prepare($ValElement['NAME']) . "',\r\n\t\t\t\t\t\tDescription: '" . __CIBlockTV::Prepare($ValElement['PREVIEW_TEXT']) . "',\r\n\t\t\t\t\t\tSmallImage: '" . $ValElement['PREVIEW_PICTURE'] . "',\r\n\t\t\t\t\t\tBigImage: '" . $ValElement['DETAIL_PICTURE'] . "',\r\n\t\t\t\t\t\tDuration: '" . __CIBlockTV::Prepare($ValElement['DURATION']) . "',\r\n\t\t\t\t\t\tFile: '" . __CIBlockTV::Prepare($ValElement['FILE']) . "',\r\n\t\t\t\t\t\tSize: '" . $ValElement['FILE_SIZE'] . "',\r\n\t\t\t\t\t\tType: '" . $ValElement['TYPE'] . "',\r\n\t\t\t\t\t\tAction: '" . CUtil::JSEscape($arButtons["edit"]["edit_element"]["ACTION"]) . "'\r\n\t\t\t\t\t}" . (++$j < count($valSection['ELEMENTS']) ? ',' : ''); } $strPlayList .= ' ] }' . (++$i < count($arResult['SECTIONS']) ? ',' : ''); } $strPlayList .= ' ];'; if ($arParams["STAT_EVENT"] || $arParams["SHOW_COUNTER_EVENT"]) { foreach ($arResult["RAW_FILES"] as $path => $arFile) { $strPlayList .= "\njsPublicTVCollector.files['" . __CIBlockTV::Prepare($path) . "'] = " . $arFile["ID"] . ";\n"; } } $arResult['LIST'] = $strPlayList; $arResult['FIRST_ITEM'] = $FirstItem;
if(is_array($arItem["PREVIEW_PICTURE"])) $arItem["PICTURE"] = $arItem["PREVIEW_PICTURE"]; elseif(is_array($arItem["DETAIL_PICTURE"])) $arItem["PICTURE"] = $arItem["DETAIL_PICTURE"]; $arSection["ITEMS"][]=$arItem; } $arResult["SECTIONS"][]=$arSection; if(count($arResult["SECTIONS"])>=$arParams["SECTION_COUNT"]) break; } //echo "<pre>",htmlspecialcharsbx(print_r($arResult,true)),"</pre>"; $this->SetResultCacheKeys(array( )); $this->IncludeComponentTemplate(); } if( $USER->IsAuthorized() && $APPLICATION->GetShowIncludeAreas() && CModule::IncludeModule("iblock") ) { $arButtons = CIBlock::GetPanelButtons($arParams["IBLOCK_ID"], 0, 0); foreach($arButtons as $mode => $ar) unset($arButtons[$mode]["add_element"]); $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } ?>
$arResItems["EDIT_LINK"] = '/bitrix/admin/iblock_element_edit.php?ID=' . $arResItems["ID"] . '&type=' . $arParams["IBLOCK_TYPE"] . '&lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $arParams["IBLOCK_ID"] . '&find_section_section=' . $arResItems["IBLOCK_SECTION_ID"] . '&bxpublic=Y&from_module=iblock'; $urlDelete = CIBlock::GetAdminElementListLink($arParams["IBLOCK_ID"], array('action' => 'delete')); $urlDelete .= '&' . bitrix_sessid_get(); $urlDelete .= '&ID=' . (preg_match('/^iblock_list_admin\\.php/', $urlDelete) ? "E" : "") . $arResItems["ID"]; $urlDelete = "/bitrix/admin/" . $urlDelete; $arResItems['DELETE_LINK'] = $urlDelete; $arResult['ITEMS'][] = $arResItems; } if (count($arResult['ITEMS']) <= 0) { $this->AbortResultCache(); @define("ERROR_404", "Y"); return; } //include template $this->IncludeComponentTemplate(); } if ($USER->IsAuthorized()) { if ($APPLICATION->GetShowIncludeAreas() || $arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { if (CModule::IncludeModule("iblock")) { $arButtons = CIBlock::GetPanelButtons($arParams["IBLOCK_ID"], 0, $arParams["SECTION_ID"]); foreach ($arButtons as $key => $arButton) { unset($arButtons[$key]['add_section']); unset($arButtons[$key]['edit_section']); unset($arButtons[$key]['delete_section']); } if ($APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } } } }
/** * Get items for view. * @return mixed[] array('ID' => array(), 'ID' => array(), ...) */ protected function getItems() { if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) { return array(); } $this->separateItemsByIblock(); $defaultMeasure = $this->data['DEFAULT_MEASURE']; $items = array(); foreach (array_keys($this->arParams['SHOW_PRODUCTS']) as $iblock) { $this->linkItems = array(); if (empty($this->iblockItems[$iblock])) { continue; } $filter = $this->filter; $filter['IBLOCK_ID'] = $iblock; $filter['ID'] = $this->iblockItems[$iblock]; $elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $this->selectFields); $elementIterator->SetUrlTemplates($this->arParams['DETAIL_URL']); while ($element = $elementIterator->GetNext()) { $element['ID'] = (int) $element['ID']; $element['ACTIVE_FROM'] = $element['DATE_ACTIVE_FROM']; $element['ACTIVE_TO'] = $element['DATE_ACTIVE_TO']; $buttons = CIBlock::GetPanelButtons($element['IBLOCK_ID'], $element['ID'], 0, array("SECTION_BUTTONS" => false, "SESSID" => false, "CATALOG" => true)); $element['EDIT_LINK'] = $buttons['edit']['edit_element']['ACTION_URL']; $element['DELETE_LINK'] = $buttons['edit']['delete_element']['ACTION_URL']; $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($element["IBLOCK_ID"], $element["ID"]); $element["IPROPERTY_VALUES"] = $ipropValues->getValues(); $element["PREVIEW_PICTURE"] = $element["PREVIEW_PICTURE"] > 0 ? CFile::GetFileArray($element["PREVIEW_PICTURE"]) : false; if ($element["PREVIEW_PICTURE"]) { $element["PREVIEW_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"]; if ($element["PREVIEW_PICTURE"]["ALT"] == "") { $element["PREVIEW_PICTURE"]["ALT"] = $element["NAME"]; } $element["PREVIEW_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"]; if ($element["PREVIEW_PICTURE"]["TITLE"] == "") { $element["PREVIEW_PICTURE"]["TITLE"] = $element["NAME"]; } } $element["DETAIL_PICTURE"] = $element["DETAIL_PICTURE"] > 0 ? CFile::GetFileArray($element["DETAIL_PICTURE"]) : false; if ($element["DETAIL_PICTURE"]) { $element["DETAIL_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"]; if ($element["DETAIL_PICTURE"]["ALT"] == "") { $element["DETAIL_PICTURE"]["ALT"] = $element["NAME"]; } $element["DETAIL_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"]; if ($element["DETAIL_PICTURE"]["TITLE"] == "") { $element["DETAIL_PICTURE"]["TITLE"] = $element["NAME"]; } } $element["PROPERTIES"] = array(); $element["DISPLAY_PROPERTIES"] = array(); $element["PRODUCT_PROPERTIES"] = array(); $element['PRODUCT_PROPERTIES_FILL'] = array(); if (!isset($element["CATALOG_MEASURE_RATIO"])) { $element["CATALOG_MEASURE_RATIO"] = 1; } if (!isset($element['CATALOG_MEASURE'])) { $element['CATALOG_MEASURE'] = 0; } $element['CATALOG_MEASURE'] = (int) $element['CATALOG_MEASURE']; if ($element['CATALOG_MEASURE'] < 0) { $element['CATALOG_MEASURE'] = 0; } if (!isset($element['CATALOG_MEASURE_NAME'])) { $element['CATALOG_MEASURE_NAME'] = ''; } $element['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS']; $element['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS']; $items[$element['ID']] = $element; $this->linkItems[$element['ID']] =& $items[$element['ID']]; } unset($element, $elementIterator); $propFilter = array('ID' => $this->iblockItems[$iblock], 'IBLOCK_ID' => $iblock); CIBlockElement::GetPropertyValuesArray($this->linkItems, $iblock, $propFilter); unset($propFilter); foreach ($this->linkItems as &$element) { CCatalogDiscount::SetProductPropertiesCache($element['ID'], $element['PROPERTIES']); if (isset($this->arParams['PROPERTY_CODE'][$iblock])) { $properties = $this->arParams['PROPERTY_CODE'][$iblock]; foreach ($properties as $propertyName) { if (!isset($element['PROPERTIES'][$propertyName])) { continue; } $prop =& $element['PROPERTIES'][$propertyName]; $boolArr = is_array($prop["VALUE"]); if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) { $element['DISPLAY_PROPERTIES'][$propertyName] = CIBlockFormatProperties::GetDisplayValue($element, $prop, 'catalog_out'); } unset($prop); } } if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$iblock])) { $element["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($element['IBLOCK_ID'], $element["ID"], $this->arParams['CART_PROPERTIES'][$iblock], $element["PROPERTIES"]); if (!empty($element["PRODUCT_PROPERTIES"])) { $element['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($element['PRODUCT_PROPERTIES']); } } } unset($element, $this->linkItems); } unset($iblock); unset($elementKey); return $items; }
$APPLICATION->GetShowIncludeAreas() || $arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]]) ) { if(CModule::IncludeModule("iblock")) { $url_template = CIBlock::GetArrayByID($arResult["IBLOCK_ID"], "LIST_PAGE_URL"); $arIBlock = CIBlock::GetArrayByID($arResult["IBLOCK_ID"]); $arIBlock["IBLOCK_CODE"] = $arIBlock["CODE"]; $UrlDeleteSectionButton = CIBlock::ReplaceDetailURL($url_template, $arIBlock, true, false); $arButtons = CIBlock::GetPanelButtons( $arResult["IBLOCK_ID"], 0, $arResult["ID"], array("RETURN_URL" => array( "delete_section" => $UrlDeleteSectionButton, )) ); foreach($arButtons as $mode => $ar) unset($arButtons[$mode]["add_section"]); if($APPLICATION->GetShowIncludeAreas()) $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); if($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array( 'ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_section"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_section"]["ACTION"], 'COMPONENT_NAME' => $this->GetName(),
/** * @return string */ public function getEditAreaId() { $this->uniqCounter++; $code = $this->infoblock()->getMnemocode(); $id = $this->id(); $this->editAreaId = "bx_tao_entity_{$code}_{$id}_{$this->uniqCounter}"; if (!empty($id)) { $buttons = \CIBlock::GetPanelButtons($this->infoblock()->getId(), $id, 0, array("SECTION_BUTTONS" => false, "SESSID" => false)); $editUrl = $buttons["edit"]["edit_element"]["ACTION_URL"]; $deleteUrl = $buttons["edit"]["delete_element"]["ACTION_URL"] . '&' . bitrix_sessid_get(); $messages = $this->infoblock()->messages(); $editTitle = isset($messages['ELEMENT_EDIT']) ? $messages['ELEMENT_EDIT'] : 'Редактировать'; $deleteTitle = isset($messages['ELEMENT_DELETE']) ? $messages['ELEMENT_DELETE'] : 'Удалить'; $editPopup = \TAO::app()->getPopupLink(array('URL' => $editUrl, "PARAMS" => array('width' => 780, 'height' => 500))); $btn = array('URL' => "javascript:{$editPopup}", 'TITLE' => $editTitle, 'ICON' => 'bx-context-toolbar-edit-icon'); \TAO::app()->SetEditArea($this->editAreaId, array($btn)); $btn = array('URL' => 'javascript:if(confirm(\'' . \CUtil::JSEscape("{$deleteTitle}?") . '\')) jsUtils.Redirect([], \'' . \CUtil::JSEscape($deleteUrl) . '\');', 'TITLE' => $deleteTitle, 'ICON' => 'bx-context-toolbar-delete-icon'); \TAO::app()->SetEditArea($this->editAreaId, array($btn)); } return $this->editAreaId; }
$arMeasureMap = array(); $intKey = 0; $arElementLink = array(); $rsElements = CIBlockElement::GetList($arSort, $arrFilter, false, array("nTopCount" => $arParams["ELEMENT_COUNT"]), $arSelect); $rsElements->SetUrlTemplates($arParams["DETAIL_URL"]); while($arItem = $rsElements->GetNext()) { $arItem['ID'] = intval($arItem['ID']); $arItem['ACTIVE_FROM'] = $arItem['DATE_ACTIVE_FROM']; $arItem['ACTIVE_TO'] = $arItem['DATE_ACTIVE_TO']; $arButtons = CIBlock::GetPanelButtons( $arItem["IBLOCK_ID"], $arItem["ID"], $arItem["IBLOCK_SECTION_ID"], array("SECTION_BUTTONS"=>false, "SESSID"=>false, "CATALOG"=>true) ); $arItem["EDIT_LINK"] = $arButtons["edit"]["edit_element"]["ACTION_URL"]; $arItem["DELETE_LINK"] = $arButtons["edit"]["delete_element"]["ACTION_URL"]; $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($arItem["IBLOCK_ID"], $arItem["ID"]); $arItem["IPROPERTY_VALUES"] = $ipropValues->getValues(); $arItem["PREVIEW_PICTURE"] = (0 < $arItem["PREVIEW_PICTURE"] ? CFile::GetFileArray($arItem["PREVIEW_PICTURE"]) : false); if ($arItem["PREVIEW_PICTURE"]) { $arItem["PREVIEW_PICTURE"]["ALT"] = $arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"]; if ($arItem["PREVIEW_PICTURE"]["ALT"] == "") $arItem["PREVIEW_PICTURE"]["ALT"] = $arItem["NAME"]; $arItem["PREVIEW_PICTURE"]["TITLE"] = $arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
//detail url $arResult['SECTIONS'][$arRes['ID']]['SECTION_PAGE_URL'] = htmlspecialcharsbx(str_replace( array("#SERVER_NAME#", "#SITE_DIR#", "#IBLOCK_ID#", "#SECTION_ID#", "#ELEMENT_ID#"), array(SITE_SERVER_NAME, SITE_DIR, $arParams["IBLOCK_ID"], $arRes["ID"], ""), (strlen($arParams["SECTION_URL"])>0?$arParams["SECTION_URL"]:$arRes["SECTION_PAGE_URL"]) )); } //no sections to display if(count($arResult['SECTIONS'])<=0) { $this->AbortResultCache(); @define("ERROR_404", "Y"); return false; } $this->SetResultCacheKeys(array( )); //include template $this->IncludeComponentTemplate(); } //add buttons common if($USER->IsAuthorized()) { $arButtons = CIBlock::GetPanelButtons($arParams['IBLOCK_ID'], 0, $arParams['SECTION_ID']); if($APPLICATION->GetShowIncludeAreas()) $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu("configure", $arButtons)); CIBlock::AddPanelButtons($APPLICATION->GetPublicShowMode(), $this->GetName(), array("intranet"=>$arButtons["intranet"])); } ?>
foreach ($arResult["CATEGORY"] as $arCategory) { if ($index > 0) { $arResult["ITEMS"][$index - 1]["IS_PARENT"] = $arCategory["DEPTH_LEVEL"] > $previousDepthLevel; } $previousDepthLevel = $arCategory["DEPTH_LEVEL"]; //Make only 2d level %TODO% //if($arCategory["DEPTH_LEVEL"]>2) // $arCategory["DEPTH_LEVEL"] = 2; $ItemLink = $arCategory["DEPTH_LEVEL"] == 1 ? $arParams["PATH_TO_CATEGORY_1"] : $arParams["PATH_TO_CATEGORY_2"]; $arSequence = CIdeaManagment::getInstance()->Idea()->GetCategorySequence($arCategory["CODE"]); if (!$arSequence) { $arSequence = ""; } $ItemLink = str_replace(array("#category_1#", "#category_2#"), $arSequence, $ItemLink); $ItemLink = str_replace("//", "/", $ItemLink); $arButtons = CIBlock::GetPanelButtons($arCategory["IBLOCK_ID"], 0, $arCategory["ID"], array("SESSID" => false)); $arResult["ITEMS"][$index] = array("ID" => $arCategory["ID"], "DEPTH_LEVEL" => $arCategory["DEPTH_LEVEL"], "IS_PARENT" => false, "TEXT" => trim($arCategory["NAME"]), "LINK" => $ItemLink, "SELECTED" => "", "EDIT_LINK" => $arButtons["edit"]["edit_section"], "DELETE_LINK" => $arButtons["edit"]["delete_section"]); $index++; } if (array_key_exists("SELECTED_CATEGORY", $arParams) && strlen($arParams["SELECTED_CATEGORY"]) > 0) { $arSelected = $arResult["CATEGORY"][$arParams["SELECTED_CATEGORY"]]; if ($arSelected) { foreach ($arResult["ITEMS"] as $key => $Item) { if ($arSelected["ID"] == $Item["ID"]) { $arResult["ITEMS"][$key]["SELECTED"] = true; break; } } } } $this->IncludeComponentTemplate();
{ $arItem["DETAIL_PICTURE"]["ALT"] = $arItem["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"]; if ($arItem["DETAIL_PICTURE"]["ALT"] == "") $arItem["DETAIL_PICTURE"]["ALT"] = $arItem["NAME"]; $arItem["DETAIL_PICTURE"]["TITLE"] = $arItem["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"]; if ($arItem["DETAIL_PICTURE"]["TITLE"] == "") $arItem["DETAIL_PICTURE"]["TITLE"] = $arItem["NAME"]; } } $arResult["ITEMS"][]=$arItem; $arResult["LAST_ITEM_IBLOCK_ID"]=$arItem["IBLOCK_ID"]; } $this->SetResultCacheKeys(array( "LAST_ITEM_IBLOCK_ID", )); $this->IncludeComponentTemplate(); } if( $arResult["LAST_ITEM_IBLOCK_ID"] > 0 && $USER->IsAuthorized() && $APPLICATION->GetShowIncludeAreas() && CModule::IncludeModule("iblock") ) { $arButtons = CIBlock::GetPanelButtons($arResult["LAST_ITEM_IBLOCK_ID"], 0, 0, array("SECTION_BUTTONS"=>false)); $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } ?>
if ($arParams["SET_STATUS_404"] === "Y") { CHTTP::SetStatus("404 Not Found"); } } } /************************************************************************* Any actions without cache (if there was some to display) *************************************************************************/ if (isset($arResult["ID"])) { $arTitleOptions = null; if (CModule::IncludeModule("iblock")) { CIBlockElement::CounterInc($arResult["ID"]); if ($USER->IsAuthorized()) { if ($APPLICATION->GetShowIncludeAreas() || $arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arReturnUrl = array("add_element" => CIBlock::GetArrayByID($arResult["IBLOCK_ID"], "DETAIL_PAGE_URL"), "delete_element" => isset($arResult["SECTION"]) ? $arResult["SECTION"]["SECTION_PAGE_URL"] : $arResult["LIST_PAGE_URL"]); $arButtons = CIBlock::GetPanelButtons($arResult["IBLOCK_ID"], $arResult["ID"], $arResult["IBLOCK_SECTION_ID"], array("RETURN_URL" => $arReturnUrl)); if ($APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } if ($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array('ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_element"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_element"]["ACTION"], 'COMPONENT_NAME' => $this->GetName()); } } } } if (isset($arResult["PROPERTIES"][$arParams["META_KEYWORDS"]])) { $val = $arResult["PROPERTIES"][$arParams["META_KEYWORDS"]]["VALUE"]; if (is_array($val)) { $val = implode(" ", $val); } $APPLICATION->SetPageProperty("keywords", $val);
/** * @return string */ public function getEditAreaId() { $this->uniqCounter++; $code = $this->getMnemocode(); $this->editAreaId = "bx_tao_iblockj_{$code}_{$this->uniqCounter}"; $buttons = \CIBlock::GetPanelButtons($this->getId(), 0, 0, array("SECTION_BUTTONS" => false, "SESSID" => false)); $addUrl = $buttons["edit"]["add_element"]["ACTION_URL"]; $messages = $this->messages(); $addTitle = isset($messages['ELEMENT_ADD']) ? $messages['ELEMENT_ADD'] : 'Добавить'; $addPopup = \TAO::app()->getPopupLink(array('URL' => $addUrl, "PARAMS" => array('width' => 780, 'height' => 500))); $btn = array('URL' => "javascript:{$addPopup}", 'TITLE' => $addTitle, 'ICON' => 'bx-context-toolbar-add-icon'); \TAO::app()->SetEditArea($this->editAreaId, array($btn)); return $this->editAreaId; }