Example #1
0
 public static function getMap()
 {
     $arMap = parent::getMap();
     foreach (static::$arAlias as $code => $alias) {
         $arMap[$alias] = new ExpressionField($alias, '%s', [$code], []);
     }
     return $arMap;
 }
Example #2
0
 protected function setPropertyValues()
 {
     $values = [];
     $arValues = \Bitrix\Iblock\PropertyEnumerationTable::getList(['filter' => ['PROPERTY_ID' => \Xpage\Helper::array_pluck($this->properties, 'PROPERTY_ID')], 'select' => ['ID', 'VALUE', 'PROPERTY_ID'], 'order' => ['SEOFILTER_PROPERTY_TABLE.SORT' => 'ASC'], 'runtime' => [new \Bitrix\Main\Entity\ReferenceField('SEOFILTER_PROPERTY_TABLE', '\\Xpage\\Seofilter\\Property', ['=this.PROPERTY_ID' => 'ref.PROPERTY_ID'])]])->fetchAll();
     foreach ($arValues as $value) {
         $values[$value['PROPERTY_ID']][] = ['VALUE_ID' => $value['ID'], 'VALUE' => $this->valueModifier->modify($value['VALUE'])];
     }
     $this->values = $values;
 }
Example #3
0
 private static function compileTemplate($template, $sectionId, $propertyValues)
 {
     $section = SectionTable::getList(['filter' => ['ID' => $sectionId]])->fetch();
     $search = ['#SECTION_NAME#'];
     $replace = [strtolower($section['NAME'])];
     $obPropertiesValues = PropertyEnumerationTable::getList(['order' => ['SEOFILTER_PROPERTY_TABLE.SORT' => 'ASC'], 'select' => ['ID', 'VALUE', 'VALUE_ALT' => 'VALUE_ALT_TABLE.VALUE'], 'filter' => ['ID' => array_values($propertyValues)], 'runtime' => [new \Bitrix\Main\Entity\ReferenceField('VALUE_ALT_TABLE', '\\Xpage\\Seofilter\\PropertyValueAlt', ['this.ID' => 'ref.ENUM_ID']), new \Bitrix\Main\Entity\ReferenceField('SEOFILTER_PROPERTY_TABLE', '\\Xpage\\Seofilter\\Property', ['this.PROPERTY_ID' => 'ref.PROPERTY_ID'])]]);
     $arPropertyValues = [];
     while ($arPropertyValue = $obPropertiesValues->fetch()) {
         $arPropertyValue['VALUE'] = $arPropertyValue['VALUE_ALT'] ?: strtolower($arPropertyValue['VALUE']);
         $arPropertyValues[] = $arPropertyValue;
     }
     $strPropertyValues = implode(" ", \Xpage\Helper::array_pluck($arPropertyValues, 'VALUE'));
     $search[] = "#PROPERTY_VALUES#";
     $replace[] = $strPropertyValues;
     $compiledTemplate = preg_replace('/#.+#/', '', str_replace($search, $replace, $template));
     return \Xpage\Helper::ucfirst($compiledTemplate);
 }
Example #4
0
 public function build($config)
 {
     $config->addField(self::id, ['type' => new IntType(), 'args' => [self::value => new NonNullType(new StringType()), self::id => new NonNullType(new IntType()), self::xmlId => new NonNullType(new StringType())], 'resolve' => function ($parent, $args, ResolveInfo $info) {
         $arFilter = [];
         foreach (self::$arFields as $code) {
             if ($args[$code]) {
                 $arFilter[$code] = $args[$code];
             }
         }
         $arSelect = Tools::getSelectByResolveInfo($info);
         $GLOBALS['APPLICATION']->RestartBuffer();
         $dbRes = PropertyEnumerationTable::getList(['filter' => [], 'select' => $arSelect]);
         while ($arItem = $dbRes->fetch()) {
             \CPL::pr($arItem);
         }
         die;
     }]);
 }
Example #5
0
 public static function GetPropertyValuesArray(&$result, $iblockID, $filter, $propertyFilter = array())
 {
     $iblockExtVersion = CIBlockElement::GetIBVersion($iblockID) == 2;
     $propertiesList = array();
     $mapCodes = array();
     $userTypesList = array();
     $existList = array();
     $selectListMultiply = array('SORT' => SORT_ASC, 'VALUE' => SORT_STRING);
     $selectAllMultiply = array('PROPERTY_VALUE_ID' => SORT_ASC);
     $propertyListFilter = array('IBLOCK_ID' => $iblockID);
     $propertyID = array();
     if (isset($propertyFilter['ID'])) {
         $propertyID = is_array($propertyFilter['ID']) ? $propertyFilter['ID'] : array($propertyFilter['ID']);
         Collection::normalizeArrayValuesByInt($propertyID);
     }
     if (!empty($propertyID)) {
         $propertyListFilter['@ID'] = $propertyID;
     } elseif (isset($propertyFilter['CODE'])) {
         if (!is_array($propertyFilter['CODE'])) {
             $propertyFilter['CODE'] = array($propertyFilter['CODE']);
         }
         $propertyCodes = array();
         if (!empty($propertyFilter['CODE'])) {
             foreach ($propertyFilter['CODE'] as &$code) {
                 $code = (string) $code;
                 if ($code !== '') {
                     $propertyCodes[] = $code;
                 }
             }
             unset($code);
         }
         if (!empty($propertyCodes)) {
             $propertyListFilter['@CODE'] = $propertyCodes;
         }
         unset($propertyCodes);
     }
     $propertyListFilter['=ACTIVE'] = isset($propertyFilter['ACTIVE']) && ($propertyFilter['ACTIVE'] == 'Y' || $propertyFilter['ACTIVE'] == 'N') ? $propertyFilter['ACTIVE'] : 'Y';
     $propertyID = array();
     $propertyIterator = PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID', 'NAME', 'ACTIVE', 'SORT', 'CODE', 'DEFAULT_VALUE', 'PROPERTY_TYPE', 'ROW_COUNT', 'COL_COUNT', 'LIST_TYPE', 'MULTIPLE', 'XML_ID', 'FILE_TYPE', 'MULTIPLE_CNT', 'LINK_IBLOCK_ID', 'WITH_DESCRIPTION', 'SEARCHABLE', 'FILTRABLE', 'IS_REQUIRED', 'VERSION', 'USER_TYPE', 'USER_TYPE_SETTINGS', 'HINT'), 'filter' => $propertyListFilter, 'order' => array('SORT' => 'ASC', 'ID' => 'ASC')));
     while ($property = $propertyIterator->fetch()) {
         $propertyID[] = (int) $property['ID'];
         $property['CODE'] = trim((string) $property['CODE']);
         if ($property['CODE'] === '') {
             $property['CODE'] = $property['ID'];
         }
         $code = $property['CODE'];
         $property['~NAME'] = $property['NAME'];
         if (preg_match("/[;&<>\"]/", $property['NAME'])) {
             $property['NAME'] = htmlspecialcharsex($property['NAME']);
         }
         if ($property['USER_TYPE']) {
             $userType = CIBlockProperty::GetUserType($property['USER_TYPE']);
             if (isset($userType['ConvertFromDB'])) {
                 $userTypesList[$property['ID']] = $userType;
                 if (array_key_exists("DEFAULT_VALUE", $property)) {
                     $value = array("VALUE" => $property["DEFAULT_VALUE"], "DESCRIPTION" => "");
                     $value = call_user_func_array($userType["ConvertFromDB"], array($property, $value));
                     $property["DEFAULT_VALUE"] = $value["VALUE"];
                 }
             }
         }
         if ($property['USER_TYPE_SETTINGS'] !== '' || $property['USER_TYPE_SETTINGS'] !== null) {
             $property['USER_TYPE_SETTINGS'] = unserialize($property['USER_TYPE_SETTINGS']);
         }
         $property['~DEFAULT_VALUE'] = $property['DEFAULT_VALUE'];
         if (is_array($property['DEFAULT_VALUE']) || preg_match("/[;&<>\"]/", $property['DEFAULT_VALUE'])) {
             $property['DEFAULT_VALUE'] = htmlspecialcharsex($property['DEFAULT_VALUE']);
         }
         if ($property['PROPERTY_TYPE'] == PropertyTable::TYPE_LIST) {
             $existList[] = $property['ID'];
         }
         $mapCodes[$property['ID']] = $code;
         $propertiesList[$code] = $property;
     }
     unset($property, $propertyIterator);
     if (empty($propertiesList)) {
         return;
     }
     if (!empty($existList)) {
         $enumList = array();
         $enumIterator = PropertyEnumerationTable::getList(array('select' => array('ID', 'PROPERTY_ID', 'VALUE', 'SORT', 'XML_ID'), 'filter' => array('PROPERTY_ID' => $existList), 'order' => array('PROPERTY_ID' => 'ASC', 'SORT' => 'ASC', 'VALUE' => 'ASC')));
         while ($enum = $enumIterator->fetch()) {
             if (!isset($enumList[$enum['PROPERTY_ID']])) {
                 $enumList[$enum['PROPERTY_ID']] = array();
             }
             $enumList[$enum['PROPERTY_ID']][$enum['ID']] = array('ID' => $enum['ID'], 'VALUE' => $enum['VALUE'], 'SORT' => $enum['SORT'], 'XML_ID' => $enum['XML_ID']);
         }
         unset($enum, $enumIterator);
     }
     $valuesRes = !empty($propertyID) ? CIBlockElement::GetPropertyValues($iblockID, $filter, true, array('ID' => $propertyID)) : CIBlockElement::GetPropertyValues($iblockID, $filter, true);
     while ($value = $valuesRes->Fetch()) {
         $elementID = $value['IBLOCK_ELEMENT_ID'];
         if (!isset($result[$elementID])) {
             continue;
         }
         $elementValues = array();
         $existDescription = isset($value['DESCRIPTION']);
         foreach ($propertiesList as $code => $property) {
             $existElementDescription = isset($value['DESCRIPTION']) && array_key_exists($property['ID'], $value['DESCRIPTION']);
             $existElementPropertyID = isset($value['PROPERTY_VALUE_ID']) && array_key_exists($property['ID'], $value['PROPERTY_VALUE_ID']);
             $elementValues[$code] = $property;
             $elementValues[$code]['VALUE_ENUM'] = null;
             $elementValues[$code]['VALUE_XML_ID'] = null;
             $elementValues[$code]['VALUE_SORT'] = null;
             $elementValues[$code]['VALUE'] = null;
             if ('Y' === $property['MULTIPLE']) {
                 $elementValues[$code]['PROPERTY_VALUE_ID'] = false;
                 if (!isset($value[$property['ID']]) || empty($value[$property['ID']])) {
                     $elementValues[$code]['DESCRIPTION'] = false;
                     $elementValues[$code]['VALUE'] = false;
                     $elementValues[$code]['~DESCRIPTION'] = false;
                     $elementValues[$code]['~VALUE'] = false;
                     if ('L' == $property['PROPERTY_TYPE']) {
                         $elementValues[$code]['VALUE_ENUM_ID'] = false;
                         $elementValues[$code]['VALUE_ENUM'] = false;
                         $elementValues[$code]['VALUE_XML_ID'] = false;
                         $elementValues[$code]['VALUE_SORT'] = false;
                     }
                 } else {
                     if ($existElementPropertyID) {
                         $elementValues[$code]['PROPERTY_VALUE_ID'] = $value['PROPERTY_VALUE_ID'][$property['ID']];
                     }
                     if (isset($userTypesList[$property['ID']])) {
                         foreach ($value[$property['ID']] as $valueKey => $oneValue) {
                             $raw = call_user_func_array($userTypesList[$property['ID']]['ConvertFromDB'], array($property, array('VALUE' => $oneValue, 'DESCRIPTION' => $existElementDescription ? $value['DESCRIPTION'][$property['ID']][$valueKey] : '')));
                             $value[$property['ID']][$valueKey] = $raw['VALUE'];
                             if (!$existDescription) {
                                 $value['DESCRIPTION'] = array();
                                 $existDescription = true;
                             }
                             if (!$existElementDescription) {
                                 $value['DESCRIPTION'][$property['ID']] = array();
                                 $existElementDescription = true;
                             }
                             $value['DESCRIPTION'][$property['ID']][$valueKey] = (string) $raw['DESCRIPTION'];
                         }
                         if (isset($oneValue)) {
                             unset($oneValue);
                         }
                     }
                     if ('L' == $property['PROPERTY_TYPE']) {
                         if (empty($value[$property['ID']])) {
                             $elementValues[$code]['VALUE_ENUM_ID'] = $value[$property['ID']];
                             $elementValues[$code]['DESCRIPTION'] = $existElementDescription ? $value['DESCRIPTION'][$property['ID']] : array();
                         } else {
                             $selectedValues = array();
                             foreach ($value[$property['ID']] as $listKey => $listValue) {
                                 if (isset($enumList[$property['ID']][$listValue])) {
                                     $selectedValues[$listKey] = $enumList[$property['ID']][$listValue];
                                     $selectedValues[$listKey]['DESCRIPTION'] = $existElementDescription && array_key_exists($listKey, $value['DESCRIPTION'][$property['ID']]) ? $value['DESCRIPTION'][$property['ID']][$listKey] : '';
                                     $selectedValues[$listKey]['PROPERTY_VALUE_ID'] = $existElementPropertyID && array_key_exists($listKey, $value['PROPERTY_VALUE_ID'][$property['ID']]) ? $value['PROPERTY_VALUE_ID'][$property['ID']][$listKey] : '';
                                 }
                             }
                             if (empty($selectedValues)) {
                                 $elementValues[$code]['VALUE_ENUM_ID'] = $value[$property['ID']];
                                 $elementValues[$code]['DESCRIPTION'] = $existElementDescription ? $value['DESCRIPTION'][$property['ID']] : array();
                             } else {
                                 Collection::sortByColumn($selectedValues, $selectListMultiply);
                                 $elementValues[$code]['VALUE_ENUM_ID'] = array();
                                 $elementValues[$code]['VALUE'] = array();
                                 $elementValues[$code]['VALUE_ENUM'] = array();
                                 $elementValues[$code]['VALUE_XML_ID'] = array();
                                 $elementValues[$code]['DESCRIPTION'] = array();
                                 $elementValues[$code]['PROPERTY_VALUE_ID'] = array();
                                 foreach ($selectedValues as $listValue) {
                                     if (!isset($elementValues[$code]['VALUE_SORT'])) {
                                         $elementValues[$code]['VALUE_SORT'] = array($listValue['SORT']);
                                     }
                                     $elementValues[$code]['VALUE_ENUM_ID'][] = $listValue['ID'];
                                     $elementValues[$code]['VALUE'][] = $listValue['VALUE'];
                                     $elementValues[$code]['VALUE_ENUM'][] = $listValue['VALUE'];
                                     $elementValues[$code]['VALUE_XML_ID'][] = $listValue['XML_ID'];
                                     $elementValues[$code]['PROPERTY_VALUE_ID'][] = $listValue['PROPERTY_VALUE_ID'];
                                     $elementValues[$code]['DESCRIPTION'][] = $listValue['DESCRIPTION'];
                                 }
                                 unset($selectedValues);
                             }
                         }
                     } else {
                         if (empty($value[$property['ID']]) || !$existElementPropertyID || isset($userTypesList[$property['ID']])) {
                             $elementValues[$code]['VALUE'] = $value[$property['ID']];
                             $elementValues[$code]['DESCRIPTION'] = $existElementDescription ? $value['DESCRIPTION'][$property['ID']] : array();
                         } else {
                             $selectedValues = array();
                             foreach ($value['PROPERTY_VALUE_ID'][$property['ID']] as $propKey => $propValueID) {
                                 $selectedValues[$propKey] = array('PROPERTY_VALUE_ID' => $propValueID, 'VALUE' => $value[$property['ID']][$propKey]);
                                 if ($existElementDescription) {
                                     $selectedValues[$propKey]['DESCRIPTION'] = $value['DESCRIPTION'][$property['ID']][$propKey];
                                 }
                             }
                             unset($propValueID, $propKey);
                             Collection::sortByColumn($selectedValues, $selectAllMultiply);
                             $elementValues[$code]['PROPERTY_VALUE_ID'] = array();
                             $elementValues[$code]['VALUE'] = array();
                             $elementValues[$code]['DESCRIPTION'] = array();
                             foreach ($selectedValues as &$propValue) {
                                 $elementValues[$code]['PROPERTY_VALUE_ID'][] = $propValue['PROPERTY_VALUE_ID'];
                                 $elementValues[$code]['VALUE'][] = $propValue['VALUE'];
                                 if ($existElementDescription) {
                                     $elementValues[$code]['DESCRIPTION'][] = $propValue['DESCRIPTION'];
                                 }
                             }
                             unset($propValue, $selectedValues);
                         }
                     }
                 }
                 $elementValues[$code]['~VALUE'] = $elementValues[$code]['VALUE'];
                 if (is_array($elementValues[$code]['VALUE'])) {
                     foreach ($elementValues[$code]['VALUE'] as &$oneValue) {
                         $isArr = is_array($oneValue);
                         if ($isArr || '' !== $oneValue && null !== $oneValue) {
                             if ($isArr || preg_match("/[;&<>\"]/", $oneValue)) {
                                 $oneValue = htmlspecialcharsEx($oneValue);
                             }
                         }
                     }
                     if (isset($oneValue)) {
                         unset($oneValue);
                     }
                 } else {
                     if ('' !== $elementValues[$code]['VALUE'] && null !== $elementValues[$code]['VALUE']) {
                         if (preg_match("/[;&<>\"]/", $elementValues[$code]['VALUE'])) {
                             $elementValues[$code]['VALUE'] = htmlspecialcharsEx($elementValues[$code]['VALUE']);
                         }
                     }
                 }
                 $elementValues[$code]['~DESCRIPTION'] = $elementValues[$code]['DESCRIPTION'];
                 if (is_array($elementValues[$code]['DESCRIPTION'])) {
                     foreach ($elementValues[$code]['DESCRIPTION'] as &$oneDescr) {
                         $isArr = is_array($oneDescr);
                         if ($isArr || !$isArr && '' !== $oneDescr && null !== $oneDescr) {
                             if ($isArr || preg_match("/[;&<>\"]/", $oneDescr)) {
                                 $oneDescr = htmlspecialcharsEx($oneDescr);
                             }
                         }
                     }
                     if (isset($oneDescr)) {
                         unset($oneDescr);
                     }
                 } else {
                     if ('' !== $elementValues[$code]['DESCRIPTION'] && null !== $elementValues[$code]['DESCRIPTION']) {
                         if (preg_match("/[;&<>\"]/", $elementValues[$code]['DESCRIPTION'])) {
                             $elementValues[$code]['DESCRIPTION'] = htmlspecialcharsEx($elementValues[$code]['DESCRIPTION']);
                         }
                     }
                 }
             } else {
                 $elementValues[$code]['VALUE_ENUM'] = $iblockExtVersion ? '' : null;
                 $elementValues[$code]['PROPERTY_VALUE_ID'] = $iblockExtVersion ? $elementID . ':' . $property['ID'] : null;
                 if (!isset($value[$property['ID']]) || false === $value[$property['ID']]) {
                     $elementValues[$code]['DESCRIPTION'] = '';
                     $elementValues[$code]['VALUE'] = '';
                     $elementValues[$code]['~DESCRIPTION'] = '';
                     $elementValues[$code]['~VALUE'] = '';
                     if ('L' == $property['PROPERTY_TYPE']) {
                         $elementValues[$code]['VALUE_ENUM_ID'] = null;
                     }
                 } else {
                     if ($existElementPropertyID) {
                         $elementValues[$code]['PROPERTY_VALUE_ID'] = $value['PROPERTY_VALUE_ID'][$property['ID']];
                     }
                     if (isset($userTypesList[$property['ID']])) {
                         $raw = call_user_func_array($userTypesList[$property['ID']]['ConvertFromDB'], array($property, array('VALUE' => $value[$property['ID']], 'DESCRIPTION' => $existElementDescription ? $value['DESCRIPTION'][$property['ID']] : '')));
                         $value[$property['ID']] = $raw['VALUE'];
                         if (!$existDescription) {
                             $value['DESCRIPTION'] = array();
                             $existDescription = true;
                         }
                         $value['DESCRIPTION'][$property['ID']] = (string) $raw['DESCRIPTION'];
                         $existElementDescription = true;
                     }
                     if ('L' == $property['PROPERTY_TYPE']) {
                         $elementValues[$code]['VALUE_ENUM_ID'] = $value[$property['ID']];
                         if (isset($enumList[$property['ID']][$value[$property['ID']]])) {
                             $elementValues[$code]['VALUE'] = $enumList[$property['ID']][$value[$property['ID']]]['VALUE'];
                             $elementValues[$code]['VALUE_ENUM'] = $elementValues[$code]['VALUE'];
                             $elementValues[$code]['VALUE_XML_ID'] = $enumList[$property['ID']][$value[$property['ID']]]['XML_ID'];
                             $elementValues[$code]['VALUE_SORT'] = $enumList[$property['ID']][$value[$property['ID']]]['SORT'];
                         }
                         $elementValues[$code]['DESCRIPTION'] = $existElementDescription ? $value['DESCRIPTION'][$property['ID']] : null;
                     } else {
                         $elementValues[$code]['VALUE'] = $value[$property['ID']];
                         $elementValues[$code]['DESCRIPTION'] = $existElementDescription ? $value['DESCRIPTION'][$property['ID']] : '';
                     }
                 }
                 $elementValues[$code]['~VALUE'] = $elementValues[$code]['VALUE'];
                 $isArr = is_array($elementValues[$code]['VALUE']);
                 if ($isArr || '' !== $elementValues[$code]['VALUE'] && null !== $elementValues[$code]['VALUE']) {
                     if ($isArr || preg_match("/[;&<>\"]/", $elementValues[$code]['VALUE'])) {
                         $elementValues[$code]['VALUE'] = htmlspecialcharsEx($elementValues[$code]['VALUE']);
                     }
                 }
                 $elementValues[$code]['~DESCRIPTION'] = $elementValues[$code]['DESCRIPTION'];
                 $isArr = is_array($elementValues[$code]['DESCRIPTION']);
                 if ($isArr || '' !== $elementValues[$code]['DESCRIPTION'] && null !== $elementValues[$code]['DESCRIPTION']) {
                     if ($isArr || preg_match("/[;&<>\"]/", $elementValues[$code]['DESCRIPTION'])) {
                         $elementValues[$code]['DESCRIPTION'] = htmlspecialcharsEx($elementValues[$code]['DESCRIPTION']);
                     }
                 }
             }
         }
         if (isset($result[$elementID]['PROPERTIES'])) {
             $result[$elementID]['PROPERTIES'] = $elementValues;
         } else {
             $result[$elementID] = $elementValues;
         }
         unset($elementValues);
     }
 }
Example #6
0
 protected function load()
 {
     $enumList = \Bitrix\Iblock\PropertyEnumerationTable::getList(array("select" => array("VALUE"), "filter" => array("=ID" => $this->key)));
     $enum = $enumList->fetch();
     if ($enum) {
         return $enum["VALUE"];
     } else {
         return "";
     }
 }
Example #7
0
 /**
  * Set values for property with type L.
  */
 protected function setEnumValue()
 {
     $enumList = $this->getListByType('L');
     $queryBuilder = new Entity\Query(Iblock\PropertyEnumerationTable::getEntity());
     $queryBuilder->setSelect(array('*'))->setFilter(array('PROPERTY_ID' => $enumList))->setOrder(array());
     $enumListResult = $queryBuilder->exec();
     while ($enum = $enumListResult->fetch()) {
         foreach ($this->iblockProperty as &$field) {
             if ($field['PROPERTY_TYPE'] != 'L') {
                 continue;
             }
             if ($field['ID'] == $enum['PROPERTY_ID']) {
                 $field['VALUE_LIST'][] = $enum;
             }
         }
     }
 }
        }
    } else {
        foreach ($res->getErrorMessages() as $error_message) {
            $message = new CAdminMessage($error_message);
            break;
        }
        $bVarsFromForm = true;
    }
}
// ******************************************************************** //
//                ВЫБОРКА И ПОДГОТОВКА ДАННЫХ ФОРМЫ                     //
// ******************************************************************** //
$allProperties = [];
// выборка данных
if ($ID > 0) {
    $obEnumValues = \Bitrix\Iblock\PropertyEnumerationTable::getList(['select' => ['ID', 'VALUE', 'VALUE_ALT' => 'VALUE_ALT_TABLE.VALUE', 'PROPERTY_NAME' => 'PROPERTY.NAME'], 'filter' => ['PROPERTY_ID' => $ID], 'order' => ['VALUE' => 'ASC'], 'runtime' => [new \Bitrix\Main\Entity\ReferenceField('VALUE_ALT_TABLE', '\\Xpage\\Seofilter\\PropertyValueAlt', ['this.ID' => 'ref.ENUM_ID'])]]);
    $arEnumValues = $obEnumValues->fetchAll();
    $APPLICATION->SetTitle("Замена значений для свойства \"{$arEnumValues[0]['PROPERTY_NAME']}\"");
}
// ******************************************************************** //
//                ВЫВОД ФОРМЫ                                           //
// ******************************************************************** //
// не забудем разделить подготовку данных и вывод
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
// конфигурация административного меню
$aMenu = [["TEXT" => "Список", "TITLE" => "Список", "LINK" => "seofilter_property.php", "ICON" => "btn_list"]];
// создание экземпляра класса административного меню
$context = new CAdminContextMenu($aMenu);
// вывод административного меню
$context->Show();
?>
 private function _getListTypeValues($id)
 {
     $dbRes = PropertyEnumerationTable::getList(array('filter' => array('=PROPERTY_ID' => $id)));
     $items = $dbRes->fetchAll();
     foreach ($items as &$item) {
         try {
             $item['~reference'] = $this->getReferenceController()->getReferenceValue($item['ID'], ReferenceController::GROUP_IBLOCK_PROPERTY_LIST_VALUES);
         } catch (\Exception $e) {
             $referenceItem = new ReferenceItem();
             $referenceItem->id = $item['ID'];
             $referenceItem->group = ReferenceController::GROUP_IBLOCK_PROPERTY_LIST_VALUES;
             $this->getReferenceController()->registerItem($referenceItem);
             $item['~reference'] = $referenceItem->reference;
         }
     }
     return $items;
 }
Example #10
0
 /**
  * @see IblockFinder::getItems()
  *
  * @return array
  *
  * @throws ValueNotFoundException
  * @throws ArgumentException
  */
 protected function getItemsIblockShard()
 {
     $items = [];
     $rsIblocks = IblockTable::query()->setFilter(['ID' => $this->id])->setSelect(['IBLOCK_TYPE_ID', 'CODE'])->exec();
     if ($iblock = $rsIblocks->fetch()) {
         if ($iblock['CODE']) {
             $items['CODE'] = $iblock['CODE'];
         }
         $items['TYPE'] = $iblock['IBLOCK_TYPE_ID'];
     }
     if (empty($items)) {
         throw new ValueNotFoundException('Iblock', 'ID #' . $this->id);
     }
     $propIds = [];
     $rsProps = PropertyTable::query()->setFilter(['IBLOCK_ID' => $this->id])->setSelect(['ID', 'CODE', 'IBLOCK_ID'])->exec();
     while ($prop = $rsProps->fetch()) {
         $propIds[] = $prop['ID'];
         $items['PROPS_ID'][$prop['CODE']] = $prop['ID'];
     }
     if (!empty($propIds)) {
         $rsPropsEnum = PropertyEnumerationTable::query()->setFilter(['PROPERTY_ID' => $propIds])->setSelect(['ID', 'XML_ID', 'PROPERTY_ID', 'PROPERTY_CODE' => 'PROPERTY.CODE'])->exec();
         while ($propEnum = $rsPropsEnum->fetch()) {
             if ($propEnum['PROPERTY_CODE']) {
                 $items['PROPS_ENUM_ID'][$propEnum['PROPERTY_CODE']][$propEnum['XML_ID']] = $propEnum['ID'];
             }
         }
     }
     $this->registerCacheTag('bex_iblock_' . $this->id);
     return $items;
 }
 /**
  * Gets the value of enum
  *
  * @param array $id
  * @return array
  */
 protected function getValueEnum($id)
 {
     if (sizeof($id) <= 0) {
         return array();
     }
     $result = array();
     $queryBuilder = new Entity\Query(Iblock\PropertyEnumerationTable::getEntity());
     $queryBuilder->setSelect(array('*'))->setFilter(array('ID' => $id));
     $enumListResult = $queryBuilder->exec();
     while ($enum = $enumListResult->fetch()) {
         $result[$enum['ID']] = $enum;
     }
     return $result;
 }