本文整理汇总了PHP中CIBlockSection::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::GetList方法的具体用法?PHP CIBlockSection::GetList怎么用?PHP CIBlockSection::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSection
的用法示例。
在下文中一共展示了CIBlockSection::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rawFindBy
/**
* Получает результат запроса для поиска списка разделов
*
* @param array $filter
* @param array $orderBy
* @param bool $calculateCount
* @param array $selectedFields
*
* @return \CIBlockResult
*/
public function rawFindBy(array $filter = array(), array $orderBy = array('sort' => 'asc'), $calculateCount = false, array $selectedFields = array('*', 'UF_*'))
{
if (!isset($filter['IBLOCK_ID']) && $this->iBlockId) {
$filter['IBLOCK_ID'] = $this->iBlockId;
}
return $this->iBSGateway->GetList($orderBy, $filter, $calculateCount, $selectedFields);
}
示例2: GetSections
public function GetSections($ib, $subsection = false)
{
CModule::IncludeModule("iblock");
if (!is_array($ib) || empty($ib)) {
return array();
}
$arFilter = array("IBLOCK_ID" => $ib);
if (!$subsection) {
$arFilter["DEPTH_LEVEL"] = 1;
}
$dbSection = CIBlockSection::GetList(array("NAME" => "ASC"), $arFilter);
$sections = array();
while ($arSection = $dbSection->Fetch()) {
$sections[$arSection["DEPTH_LEVEL"]][$arSection["ID"]] = array("ID" => $arSection["ID"], "NAME" => "{$arSection["NAME"]} [{$arSection["ID"]}]", "LEVEL" => $arSection["DEPTH_LEVEL"], "PARENT" => $arSection["IBLOCK_SECTION_ID"], "PARENT_1" => $arSection["ID"]);
}
unset($dbSection);
ksort($sections);
foreach ($sections as $depth => &$depthSections) {
if ($depth == 1) {
continue;
}
foreach ($depthSections as $id => &$current) {
$current["NAME"] = implode(" / ", array($sections[$depth - 1][$current["PARENT"]]["NAME"], $current["NAME"]));
$current["PARENT_1"] = $sections[$depth - 1][$current["PARENT"]]["PARENT_1"];
}
}
return $sections;
}
示例3: __get
/**
* Геттер
* @param $var
* @return int
*/
public function __get($var)
{
if (strpos($var, 'printable_') === 0) {
$varName = substr($var, strlen('printable_'));
$param = $this->getParam($varName);
if (!is_array($param) || !isset($param['PROPERTY_TYPE'])) {
return $param;
}
switch ($param['PROPERTY_TYPE']) {
case 'G':
$printable = \CIBlockSection::GetList(array(), array('ID' => $param['VALUE']), false, array("NAME"))->GetNext();
return $printable['NAME'];
default:
$printable = \CIBlockFormatProperties::GetDisplayValue(array('NAME' => ''), $param, "");
return $printable['DISPLAY_VALUE'];
}
} else {
switch ($var) {
case 'id':
case 'ID':
return $this->id;
case 'IBLOCK_ID':
case 'iblockId':
return $this->iblockId;
default:
return $this->getParam($var);
}
}
}
示例4: onBeforeElementAddHandler
static function onBeforeElementAddHandler($arFields)
{
$IBLOCK_ID = Config\Option::get("citfact.replaceurl", "IBLOCK_ID", "");
$SECTION_ID = Config\Option::get("citfact.replaceurl", "SECTION_BREND_ID", "BRENDI");
$CODE_PROP = Config\Option::get("citfact.replaceurl", "PROPERTY_CODE_BRENDI", "BRENDI");
if ($IBLOCK_ID == $arFields["IBLOCK_ID"]) {
$propertyBrand = \CIBlockProperty::GetByID($CODE_PROP, $arFields["IBLOCK_ID"]);
if ($arResultProperty = $propertyBrand->GetNext()) {
$propertyBrandValue = \CIBlockPropertyEnum::GetByID($arFields["PROPERTY_VALUES"][$arResultProperty["ID"]][0]["VALUE"]);
}
$rqParentSection = \CIBlockSection::GetByID($SECTION_ID);
if ($arParentSection = $rqParentSection->GetNext()) {
$arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
// выберет потомков без учета активности
$rqSectChild = \CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
while ($arSectChild = $rqSectChild->GetNext()) {
$arSections[$arSectChild["NAME"]] = $arSectChild["ID"];
}
}
if (array_key_exists($propertyBrandValue["VALUE"], $arSections)) {
$arFields["IBLOCK_SECTION"][] = $arSections[$propertyBrandValue["VALUE"]];
} else {
$arParams = array("replace_space" => "-", "replace_other" => "-");
$trans = \Cutil::translit($propertyBrandValue["VALUE"], "ru", $arParams);
$bs = new \CIBlockSection();
$arFieldsNewSection = array("ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $SECTION_ID, "IBLOCK_ID" => $IBLOCK_ID, "NAME" => $propertyBrandValue["VALUE"], "CODE" => $trans);
$resultAdd = $bs->Add($arFieldsNewSection);
$arFields["IBLOCK_SECTION"][] = $resultAdd;
}
}
return true;
}
示例5: _getIBlockMode
function _getIBlockMode($ib, $object = false, $object_id = false)
{
if ($object === false) {
$arIBlock = CIBlock::GetArrayByID($ib);
if ($arIBlock["WORKFLOW"] == "Y") {
return "WF";
} elseif ($arIBlock["BIZPROC"] == "Y") {
return "BP";
} else {
return "";
}
} else {
$arFilter = array("IBLOCK_ID" => $ib, "SOCNET_GROUP_ID" => false, "CHECK_PERMISSIONS" => "N", "SECTION_ID" => 0);
if ($object == "user") {
$arFilter["CREATED_BY"] = $object_id;
} else {
$arFilter["SOCNET_GROUP_ID"] = $object_id;
}
$arLibrary = array();
$db_res = CIBlockSection::GetList(array(), $arFilter, false, array("ID", "UF_USE_BP"));
if ($db_res && ($arLibrary = $db_res->GetNext())) {
return $arLibrary["UF_USE_BP"] == "N" ? "" : "BP";
} else {
return "";
}
}
}
示例6: _ShowGroupPropertyField
function _ShowGroupPropertyField($name, $property_fields, $values)
{
if (!is_array($values)) {
$values = array();
}
foreach ($values as $key => $value) {
if (is_array($value) && array_key_exists("VALUE", $value)) {
$values[$key] = $value["VALUE"];
}
}
$res = "";
$bWas = false;
$sections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $property_fields["LINK_IBLOCK_ID"]), false, array("ID", "DEPTH_LEVEL", "NAME"));
while ($ar = $sections->GetNext()) {
$res .= '<option value="' . $ar["ID"] . '"';
if (in_array($ar["ID"], $values)) {
$bWas = true;
$res .= ' selected';
}
$res .= '>' . str_repeat(" . ", $ar["DEPTH_LEVEL"] - 1) . $ar["NAME"] . '</option>';
}
echo '<select name="' . $name . '[]" size="' . $property_fields["MULTIPLE_CNT"] . '" ' . ($property_fields["MULTIPLE"] == "Y" ? "multiple" : "") . '>';
echo '<option value=""' . (!$bWas ? ' selected' : '') . '>' . GetMessage("IBLOCK_AT_NOT_SET") . '</option>';
echo $res;
echo '</select>';
}
示例7: addVariants
public function addVariants(&$field, $params)
{
if (!$params["LINK_IBLOCK_ID"]) {
return;
}
$cacheDir = KFilter::$config['CACHE_DIR'] . self::$cacheSubdir;
$obCache = new CPHPCache();
if ($obCache->InitCache(KFilter::$config['CACHE_TIME'], md5($params["LINK_IBLOCK_ID"] . __METHOD__), $cacheDir)) {
$field['VARIANTS'] = $obCache->GetVars();
} elseif ($obCache->StartDataCache()) {
CModule::IncludeModule('iblock');
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($cacheDir);
$CACHE_MANAGER->RegisterTag("iblock_id_" . $params["LINK_IBLOCK_ID"]);
$CACHE_MANAGER->EndTagCache();
$rsSect = CIBlockSection::GetList(array('sort' => 'asc', 'name' => 'asc'), array('IBLOCK_ID' => $params["LINK_IBLOCK_ID"], 'ACTIVE' => 'Y'), false, array('ID', 'NAME'));
while ($arSect = $rsSect->GetNext()) {
$field['VARIANTS'][] = array('ID' => $arSect['ID'], 'NAME' => $arSect['NAME']);
}
$obCache->EndDataCache($field['VARIANTS']);
}
foreach ($field['VARIANTS'] as &$section) {
if ($_REQUEST[$field['NAME']] == $section['ID']) {
$section['SELECTED'] = 'Y';
$res = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $params["LINK_IBLOCK_ID"], "SECTION_ID" => $section['ID']), false, false, array("ID", "IBLOCK_ID"));
$arr = array();
while ($el = $res->GetNext()) {
$arr[] = $el['ID'];
}
$this->filter['PROPERTY_' . $field['PROPERTY']] = $arr;
break;
}
}
}
示例8: getStructure
function getStructure($id, $section=false, $arUf=array()) {
$id = (int)$id;
if (!$id) { return false; }
if ($section) {
$res = CIBlockSection::GetByID($id);
if ( $ar = $res->GetNext() ) {
$res = CIBlockSection::GetList(array(), array('IBLOCK_ID'=>$ar['IBLOCK_ID'], 'ID'=>$ar['ID']), false, $arUf);
} else { return false; }
} else {
$res = CIBlockElement::GetByID($id);
if ( $ar = $res->GetNext() ) {
$res = CIBlockSection::GetList(array(), array('IBLOCK_ID'=>$ar['IBLOCK_ID'], 'ID'=>$ar['IBLOCK_SECTION_ID']), false, $arUf);
} else { return false; }
}
// херню подсунули
if ( !$res->SelectedRowsCount() ) { return false; }
$arSect = $res->GetNext();
$arStructure = array();
$res = CIBlockSection::GetList(array('LEFT_MARGIN'=>'ASC'), array(
'IBLOCK_ID' => $arSect['IBLOCK_ID'],
'<=LEFT_BORDER' => $arSect['LEFT_MARGIN'],
'>=RIGHT_BORDER' => $arSect['RIGHT_MARGIN'],
'<DEPTH_LEVEL' => $arSect['DEPTH_LEVEL'],
), false, $arUf);
while($ar = $res->GetNext()){
$arStructure[] = $ar;
}
$arStructure[] = $arSect;
return $arStructure;
}
示例9: getSectionId
function getSectionId($code)
{
$uf_arresult = CIBlockSection::GetList(array(), array('CODE' => $code), false, array('ID'));
if ($uf_value = $uf_arresult->GetNext()) {
$id = $uf_value['ID'];
}
return $id;
}
示例10: get_sections_menu
function get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL, $SECTION_ID)
{
$arSections = array();
$rsSections = CIBlockSection::GetList(array("left_margin" => "ASC"), array("IBLOCK_ID" => $IBLOCK_ID, "SECTION_ID" => $SECTION_ID), false, array("ID", "IBLOCK_SECTION_ID", "NAME", "LEFT_MARGIN", "RIGHT_MARGIN"));
while ($arSection = $rsSections->Fetch()) {
$arSections[] = array("text" => htmlspecialcharsex($arSection["NAME"]), "url" => "cat_section_admin.php?lang=" . LANGUAGE_ID . "&type=" . $IBLOCK_TYPE_ID . "&IBLOCK_ID=" . $IBLOCK_ID . "&find_section_section=" . $arSection["ID"], "more_url" => array("cat_section_admin.php?IBLOCK_ID=" . $IBLOCK_ID . "&find_section_section=" . $arSection["ID"], "cat_section_edit.php?IBLOCK_ID=" . $IBLOCK_ID . "&find_section_section=" . $arSection["ID"]), "title" => htmlspecialcharsex($arSection["NAME"]), "icon" => "iblock_menu_icon_sections", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_category_" . $IBLOCK_ID . "/" . $arSection["ID"], "module_id" => "catalog", "items" => $arSection["RIGHT_MARGIN"] - $arSection["LEFT_MARGIN"] > 1 ? CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"]) : array());
}
return $arSections;
}
示例11: get_sections_by_iblock_id
function get_sections_by_iblock_id($id)
{
$arSections = array();
$result = CIBlockSection::GetList(array('CREATED' => 'DESC'), array('ACTIVE' => 'Y', 'IBLOCK_ID' => $id));
while ($section = $result->GetNext()) {
$arSections[] = $section;
}
return $arSections;
}
示例12: existsSectionByCode
static function existsSectionByCode($code)
{
$result = false;
$bs = new CIBlockSection();
$ob_section = $bs->GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => self::$IBLOCK_ID, "CODE" => $code), false, array("ID", "CODE"));
if ($ar_section = $ob_section->GetNext()) {
$result = $ar_section["ID"];
}
return $result;
}
示例13: existsSectionByExternalId
static function existsSectionByExternalId($external_id)
{
$result = false;
$bs = new CIBlockSection();
$ob_section = $bs->GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => self::$IBLOCK_ID, "EXTERNAL_ID" => $external_id), false, array("ID"));
if ($ar_section = $ob_section->GetNext()) {
$result = $ar_section["ID"];
}
return $result;
}
示例14: checkDoubleSection
/**
* Verify the existence of duplicate sections.
*
* @param array $fields Section fields.
* @param array $settings Internationalization settings of info block.
* @return bool
*/
protected static function checkDoubleSection(array $fields, $settings)
{
global $APPLICATION;
$sectionModel = new \CIBlockSection();
$rsSection = $sectionModel->GetList([], ['IBLOCK_ID' => $fields['IBLOCK_ID'], 'UF_' . $settings['PROP_CODE_PUBLIC_ID'] => $fields['UF_' . $settings['PROP_CODE_PUBLIC_ID']], 'UF_' . $settings['PROP_CODE_LANG'] => $fields['UF_' . $settings['PROP_CODE_LANG']], '!ID' => $fields['ID']], false, ['ID']);
if ($section = $rsSection->Fetch()) {
$APPLICATION->ThrowException(Loc::getMessage('NOTAMEDIA_I18N_IBLOCK_HANDLER_ELEMENT_ALREADY_EXIST'));
return true;
}
return false;
}
示例15: get_sections_menu
public static function get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL, $SECTION_ID, $arSectionsChain = false)
{
global $adminMenu;
if (false === $arSectionsChain) {
$arSectionsChain = array();
if (isset($_REQUEST['admin_mnu_menu_id'])) {
$menu_id = "menu_catalog_category_" . $IBLOCK_ID . "/";
if (0 == strncmp($_REQUEST['admin_mnu_menu_id'], $menu_id, strlen($menu_id))) {
$rsSections = CIBlockSection::GetNavChain($IBLOCK_ID, substr($_REQUEST['admin_mnu_menu_id'], strlen($menu_id)), array('ID', 'IBLOCK_ID'));
while ($arSection = $rsSections->Fetch()) {
$arSectionsChain[$arSection["ID"]] = $arSection["ID"];
}
}
}
if (isset($_REQUEST["find_section_section"]) && (int) $_REQUEST["find_section_section"] > 0 && isset($_REQUEST["IBLOCK_ID"]) && $_REQUEST["IBLOCK_ID"] == $IBLOCK_ID) {
$rsSections = CIBlockSection::GetNavChain($IBLOCK_ID, $_REQUEST["find_section_section"], array('ID', 'IBLOCK_ID'));
while ($arSection = $rsSections->Fetch()) {
$arSectionsChain[$arSection["ID"]] = $arSection["ID"];
}
}
}
$urlSectionAdminPage = CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('catalog' => null));
$arSections = array();
$rsSections = CIBlockSection::GetList(array("left_margin" => "ASC"), array("IBLOCK_ID" => $IBLOCK_ID, "SECTION_ID" => $SECTION_ID), false, array("ID", "IBLOCK_SECTION_ID", "NAME", "LEFT_MARGIN", "RIGHT_MARGIN"));
$intCount = 0;
$arOtherSectionTmp = array();
$limit = (int) COption::GetOptionInt("iblock", "iblock_menu_max_sections");
while ($arSection = $rsSections->Fetch()) {
if ($limit > 0 && $intCount >= $limit) {
if (empty($arOtherSectionTmp)) {
$arOtherSectionTmp = array("text" => Loc::getMessage("CAT_MENU_ALL_OTH"), "url" => $urlSectionAdminPage . "&find_section_section=" . (int) $arSection["IBLOCK_SECTION_ID"], "more_url" => array(CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null))), "title" => Loc::getMessage("CAT_MENU_ALL_OTH_TITLE"), "icon" => "iblock_menu_icon_sections", "page_icon" => "iblock_page_icon_sections", "skip_chain" => true, "items_id" => "menu_catalog_category_" . $IBLOCK_ID . "/" . $arSection["ID"], "module_id" => "catalog", "items" => array());
CCatalogAdmin::get_other_elements_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $arSection, $arOtherSectionTmp["more_url"]);
} else {
$arOtherSectionTmp['more_url'][] = $urlSectionAdminPage . "&find_section_section=" . (int) $arSection["ID"];
$arOtherSectionTmp['more_url'][] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null));
}
} else {
$arSectionTmp = array("text" => htmlspecialcharsex($arSection["NAME"]), "url" => $urlSectionAdminPage . "&find_section_section=" . $arSection["ID"], "more_url" => array(CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null))), "title" => htmlspecialcharsex($arSection["NAME"]), "icon" => "iblock_menu_icon_sections", "page_icon" => "iblock_page_icon_sections", "skip_chain" => true, "items_id" => "menu_catalog_category_" . $IBLOCK_ID . "/" . $arSection["ID"], "module_id" => "catalog", "dynamic" => $arSection["RIGHT_MARGIN"] - $arSection["LEFT_MARGIN"] > 1, "items" => array());
if (isset($arSectionsChain[$arSection["ID"]])) {
$arSectionTmp["items"] = CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"], $arSectionsChain);
} elseif (method_exists($adminMenu, "IsSectionActive")) {
if ($adminMenu->IsSectionActive("menu_catalog_category_" . $IBLOCK_ID . "/" . $arSection["ID"])) {
$arSectionTmp["items"] = CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"], $arSectionsChain);
}
}
$arSections[] = $arSectionTmp;
}
$intCount++;
}
if (!empty($arOtherSectionTmp)) {
$arSections[] = $arOtherSectionTmp;
}
return $arSections;
}