function _getPropertiesEx($arParams) { $arFilter = array(); $arProperties = array(); $arPropListIds = array(); if (notEmpty($arParams["type"])) { $arFilter["PROPERTY_TYPE"] = $arParams["type"]; } if (notEmpty($arParams["iblock_id"])) { $arFilter["IBLOCK_ID"] = iblock($arParams["iblock_id"]); } $resProperties = \CIBlockProperty::GetList(array(), $arFilter); while ($arProperty = $resProperties->Fetch()) { $arProperties[$arProperty["CODE"]] = $arProperty; if ($arProperty["PROPERTY_TYPE"] == "L") { $arPropListIds[] = $arProperty["ID"]; } } // В фильтр CIBlockPropertyEnum::GetList() нельзя передать // PROPERTY_ID в виде массива ID, поэтому перебираем // каждое свойство в цикле foreach ($arPropListIds as $propListId) { $resPropValues = \CIBlockPropertyEnum::GetList(array('SORT' => 'ASC', 'VALUE' => 'ASC'), array('PROPERTY_ID' => $propListId)); while ($arPropValue = $resPropValues->Fetch()) { $arProperties[$arPropValue["PROPERTY_CODE"]]["VALUES"][$arPropValue["XML_ID"]] = $arPropValue["ID"]; } } return $arProperties; }
/** * Генерация создания Информационного блока * * generateAddCode * @param array $IblockCode * @return bool|string */ public function generateAddCode($IblockCode) { $return = array(); $iblockObject = $this->iblock->GetList(array(), array('CODE' => $IblockCode, 'CHECK_PERMISSIONS' => 'N')); if ($item = $iblockObject->Fetch()) { # Установка групп пользователей $this->setUserGroupId($item['ID'], $item); $item['FIELDS'] = \CIBlock::GetFields($item['ID']); Helper::unsetFields(array('ID'), $item); if ($return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Add', array($item))) { $IblockProperty = new \CIBlockProperty(); $iblockPropertyQuery = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $item['CODE'])); while ($iblockProperty = $iblockPropertyQuery->Fetch()) { Helper::unsetFields(array('ID'), $iblockProperty); $iblockProperty['IBLOCK_CODE'] = $item['CODE']; $propertyQuery = \CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $iblockProperty['IBLOCK_ID'], "CODE" => $iblockProperty['CODE'])); while ($propertyValues = $propertyQuery->Fetch()) { Helper::unsetFields(array('ID', 'PROPERTY_ID'), $propertyValues); $iblockProperty['VALUES'][] = $propertyValues; } if (!is_null($iblockProperty['LINK_IBLOCK_ID'])) { $linkedIBlock = $this->iblock->GetList(array(), array('ID' => $iblockProperty['LINK_IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'))->Fetch(); $iblockProperty['LINK_IBLOCK_CODE'] = $linkedIBlock['CODE']; } $return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($iblockProperty)); } return implode(PHP_EOL, $return); } else { return false; } } else { return false; } }
function storeResult($arResult, $arParams) { $iblock = CIBlock::GetList( array(), array( 'TYPE' => $arParams['IBLOCK_TYPE'], 'CODE' => $arParams['IBLOCK_CODE'], ) ); $iblock = $iblock->Fetch(); $el = new CIBlockElement; $props = array(); foreach ($arResult['FIELDS_LIST'] as $arField) { if ($arField['FIELD_TYPE'] == 'TEXT' || $arField['FIELD_TYPE'] == 'NUMBER') { $props[$arField['CODE']] = array( 'VALUE' => $arResult['POST_DATA']['~'.$arField['CODE']], ); } elseif ($arField['FIELD_TYPE'] == 'TEXTAREA') { $props[$arField['CODE']] = array( 'VALUE' => array( 'TYPE' => 'text', 'TEXT' => $arResult['POST_DATA']['~'.$arField['CODE']], ), ); } elseif ($arField['FIELD_TYPE'] == 'LIST') { $propEnum = CIBlockPropertyEnum::GetList( array(), array( 'XML_ID' => $arResult['POST_DATA']['~'.$arField['CODE']], 'CODE' => $arField['CODE'], 'IBLOCK_ID' => $iblock['ID'], ) ); $propEnum = $propEnum->Fetch(); if ( ! $propEnum) return false; $props[$arField['CODE']] = array( 'VALUE' => $propEnum['ID'], ); } } $res = $el->Add(array( 'IBLOCK_TYPE' => $arParams['IBLOCK_TYPE'], 'IBLOCK_ID' => $iblock['ID'], 'ACTIVE' => 'Y', 'PROPERTY_VALUES' => $props, 'ACTIVE_FROM' => ConvertTimeStamp(time()+CTimeZone::GetOffset(), 'FULL'), 'NAME' => 'Form result', # !!! NEED TO REPLACE TO DEFAULT VALUE )); if (!$res) { return array( 'MESSAGE' => $el->LAST_ERROR, ); } return true; }
/** * Генерация создания * * generateAddCode * @param array $IblockTypeId * @return bool|string */ public function generateAddCode($IblockTypeId) { $iBlock = new \CIBlock(); $CIblockType = new \CIBlockType(); $lang = new \CLanguage(); $return = array(); $dbIblockType = $CIblockType->GetByID($IblockTypeId); if ($arIblockType = $dbIblockType->GetNext()) { $Iblock = new \CIBlock(); $dbIblock = $Iblock->GetList(array(), array('TYPE' => $IblockTypeId, 'CHECK_PERMISSIONS' => 'N')); while ($arIblock = $dbIblock->GetNext()) { $IblockProperty = new \CIBlockProperty(); $dbIblockProperty = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $arIblock['CODE'], 'CHECK_PERMISSIONS' => 'N')); while ($arIblockProperty = $dbIblockProperty->GetNext()) { $dbPropertyValues = \CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $arIblockProperty['IBLOCK_ID'], "CODE" => $arIblockProperty['CODE'])); while ($arPropertyValues = $dbPropertyValues->Fetch()) { $arIblockProperty['VALUES'][$arPropertyValues['ID']] = $arPropertyValues; } Helper::unsetFields(array('ID', '~ID', 'IBLOCK_ID', '~IBLOCK_ID'), $arIblockProperty); $arIblockProperty['IBLOCK_CODE'] = $arIblock['CODE']; foreach ($arIblockProperty as $k => $v) { if (strstr($k, "~") || is_null($v)) { unset($arIblockProperty[$k]); } } if (isset($arIblockProperty['LINK_IBLOCK_ID'])) { $res = $iBlock->GetList(array(), array("ID" => $arIblockProperty['LINK_IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N')); if ($ar_res = $res->GetNext()) { unset($arIblockProperty['LINK_IBLOCK_ID']); $arIblockProperty['LINK_IBLOCK_CODE'] = $ar_res['CODE']; } } $return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($arIblockProperty)); } foreach ($arIblock as $k => $v) { if (strstr($k, "~") || $k == 'ID') { unset($arIblock[$k]); } } $return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Add', array($arIblock)); } foreach ($arIblockType as $k => $v) { if (strstr($k, "~") || is_null($v)) { unset($arIblockType[$k]); } } $rsLang = $lang->GetList($by = "lid", $order = "desc"); while ($arLang = $rsLang->Fetch()) { $arTypeLang = $CIblockType->GetByIDLang($IblockTypeId, $arLang['LID']); $arIblockType["LANG"][$arLang['LID']] = array('NAME' => $arTypeLang['NAME'], 'SECTION_NAME' => $arTypeLang['SECTION_NAME'], 'ELEMENT_NAME' => $arTypeLang['ELEMENT_NAME']); } $return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockTypeIntegrate', 'Add', array($arIblockType)); $return = array_reverse($return); return implode(PHP_EOL, $return); } else { return false; } }
static function getItemsFlagsIds($code, $iblockId = IBLOCK_CATALOG) { $flagsIds = array(); $flagsDb = \CIBlockPropertyEnum::GetList(array('id' => 'asc'), array('IBLOCK_ID' => $iblockId, 'CODE' => $code)); while ($flags = $flagsDb->GetNext()) { $flagsIds[$flags['XML_ID']] = $flags['ID']; } return $flagsIds; }
/** * getEnumItemList * @param $iblockId * @param $iblockPropId * @return array */ private function getEnumItemList($iblockId, $iblockPropId) { $result = array(); $propEnumDbRes = \CIBlockPropertyEnum::GetList(array('SORT' => 'ASC'), array('IBLOCK_ID' => $iblockId, 'PROPERTY_ID' => $iblockPropId)); if ($propEnumDbRes !== false && $propEnumDbRes->SelectedRowsCount()) { $index = 0; while ($propEnum = $propEnumDbRes->Fetch()) { $result[$index] = array('ID' => $index, 'VALUE' => $propEnum['VALUE'], 'XML_ID' => $propEnum['XML_ID'], 'SORT' => $propEnum['SORT'], 'DEF' => $propEnum['DEF']); $index++; } } return $result; }
function addElementReview($arResult, $ID_SECTION, $IBLOCK_ID) { CModule::IncludeModule('iblock'); $property_enums = CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("IBLOCK_ID" => $IBLOCK_ID, "CODE" => "RATING", "VALUE" => $arResult['RATING'])); while ($rating = $property_enums->GetNext()) { $arRating = $rating["ID"]; } $current_date = dateActiveFrom(date('d.m.Y')); $NAME = $current_date . ' ' . $arResult['NAME']; $arFields = array("ACTIVE" => "N", "IBLOCK_ID" => $IBLOCK_ID, "IBLOCK_SECTION_ID" => $ID_SECTION, "NAME" => $NAME, "DETAIL_TEXT" => "Описание элемента", "PROPERTY_VALUES" => array("NAME" => $arResult['NAME'], "EMAIL" => $arResult['EMAIL'], "RATING" => array('VALUE' => $arRating), "BENEFITS" => $arResult['BENEFITS'], "DISADVANTAGES" => $arResult['DISADVANTAGES'], "COMMENT" => $arResult['COMMENT'])); $oElement = new CIBlockElement(); $idElement = $oElement->Add($arFields, false, false, true); return $idElement; }
/** * Возвращает список всех вариантов для указанного свойства * @param int $propertyId * @return array */ public static function getById($id) { if (!isset(self::$_items[$id])) { if (!\CModule::IncludeModule('iblock')) { throw new \bxar\Exception('Iblock module is not installed'); } self::$_items[$id] = array(); $res = \CIBlockPropertyEnum::GetList(array('SORT' => 'ASC', 'VALUE' => 'ASC'), array('PROPERTY_ID' => $id)); while ($ob = $res->GetNext()) { self::$_items[$id][] = $ob; } } return self::$_items[$id]; }
private function GetFilterData($IBLOCK_ID, $arFields = array()) { $filter_name = $this->sk_filter_name; global ${$filter_name}; $arPROPERTIES = array(); foreach ($arFields as $i => $PROP_ID) { $arSort = array(); $arFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $IBLOCK_ID); if (intval($PROP_ID) > 0) { $arFilter["ID"] = $PROP_ID; } else { $arFilter["CODE"] = $PROP_ID; } $properties = CIBlockProperty::GetList($arSort, $arFilter); while ($prop_fields = $properties->GetNext()) { switch ($prop_fields["PROPERTY_TYPE"]) { case "L": $PROP_ENUM_VALUES = array(); $arPropSort = array("value" => "asc"); $arPropFilter = array("PROPERTY_ID" => $prop_fields["ID"], "IBLOCK_ID" => $IBLOCK_ID); $prop_enums = CIBlockPropertyEnum::GetList($arPropSort, $arPropFilter); while ($enum_fields = $prop_enums->GetNext()) { $PROP_ENUM_VALUES[] = $enum_fields; } $prop_fields["VALUES"] = $PROP_ENUM_VALUES; break; case "E": $PROP_ENUM_VALUES = array(); $arPropSort = array("NAME" => "asc"); $arPropFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $prop_fields["LINK_IBLOCK_ID"]); $arSelFields = array("IBLOCK_ID", "ID", "NAME", "PROPERTY_*"); $db_vals = CIBlockElement::GetList($arPropSort, $arPropFilter, false, false, $arSelFields); while ($obElement = $db_vals->GetNextElement()) { $tmp = array(); $tmp = $obElement->GetFields(); $tmp["PROPERTIES"] = $obElement->GetProperties(); $PROP_ENUM_VALUES[$tmp["ID"]] = $tmp; } $prop_fields["VALUES"] = $PROP_ENUM_VALUES; break; } $arPROPERTIES[$prop_fields["ID"]] = $prop_fields; } } // // print_r( $arPROPERTIES ); return $arPROPERTIES; }
/** * [getPropertyIblock description] * @return array all products on iblock */ protected function getPropertyIblock(){ if (!CModule::IncludeModule("iblock")): return false; endif; $properties = CIBlockProperty::GetList(Array("sort"=>"asc", "name"=>"asc"), Array("ACTIVE"=>"Y", "IBLOCK_ID"=>$this->getIblockId())); while ($prop_fields = $properties->GetNext()) { if ($prop_fields["PROPERTY_TYPE"] == "L"): $property_enums = CIBlockPropertyEnum::GetList(Array("DEF"=>"DESC", "SORT"=>"ASC"), Array("IBLOCK_ID"=>$this->getIblockId(), "CODE"=>$prop_fields["CODE"])); while($enum_fields = $property_enums->GetNext()) { $prop_fields["ENUM_LIST"][] = $enum_fields; } endif; $arProperties[] = $prop_fields; } return $arProperties; }
function findCode($id, $val) { if (CModule::IncludeModule("iblock")) { $properties = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", 'ID' => $id)); while ($prop_fields = $properties->GetNext()) { $temp['CODE'] = $prop_fields['CODE']; if ($prop_fields['PROPERTY_TYPE'] == 'L') { $property_enums = CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("CODE" => $prop_fields['CODE'], 'ID' => $val)); while ($enum_fields = $property_enums->GetNext()) { $temp['VALUE'] = $enum_fields["VALUE"]; } } } return $temp; } else { return false; } }
function GetEditFormHTML($arUserField, $arHtmlControl) { $return = ''; if (CModule::IncludeModule("iblock")) { $resdb = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array("ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_CATALOG, 'PROPERTY_ID' => PROPERTY_ID_TORGOVAYA_MARKA)); $arPropertyListValue = array(); while ($res = $resdb->fetch()) { $arPropertyListValue[$res['ID']] = $res['VALUE']; } if (count($arPropertyListValue) > 0) { ob_start(); ?> <select name="<?php echo $arUserField["FIELD_NAME"]; ?> "> <option value=""></option> <?php foreach ($arPropertyListValue as $ID => $NAME) { ?> <option value="<?php echo $ID; ?> " <?php if ($ID == $arUserField["VALUE"]) { echo 'selected'; } ?> ><?php echo $NAME; ?> </option> <?php } ?> </select> <?php $return = ob_get_contents(); ob_end_clean(); } } return $return; }
public function fillItemValues(&$resultItem, $arProperty) { static $cacheL = array(); static $cacheE = array(); static $cacheG = array(); if(is_array($arProperty)) { if(isset($arProperty["PRICE"])) { return null; } $key = $arProperty["VALUE"]; $PROPERTY_TYPE = $arProperty["PROPERTY_TYPE"]; $PROPERTY_ID = $arProperty["ID"]; } else { $key = $arProperty; $PROPERTY_TYPE = $resultItem["PROPERTY_TYPE"]; $PROPERTY_ID = $resultItem["ID"]; } if($PROPERTY_TYPE == "F") { return null; } elseif($PROPERTY_TYPE == "N") { if(!isset($resultItem["VALUES"]["MIN"]) || !array_key_exists("VALUE", $resultItem["VALUES"]["MIN"]) || doubleval($resultItem["VALUES"]["MIN"]["VALUE"]) > doubleval($key)) $resultItem["VALUES"]["MIN"]["VALUE"] = $key; if(!isset($resultItem["VALUES"]["MAX"]) || !array_key_exists("VALUE", $resultItem["VALUES"]["MAX"]) || doubleval($resultItem["VALUES"]["MAX"]["VALUE"]) < doubleval($key)) $resultItem["VALUES"]["MAX"]["VALUE"] = $key; return null; } elseif($PROPERTY_TYPE == "E" && $key <= 0) { return null; } elseif($PROPERTY_TYPE == "G" && $key <= 0) { return null; } elseif(strlen($key) <= 0) { return null; } switch($PROPERTY_TYPE) { case "L": if(!isset($cacheL[$PROPERTY_ID])) { $cacheL[$PROPERTY_ID] = array(); $rsEnum = CIBlockPropertyEnum::GetList(array("SORT"=>"ASC", "VALUE"=>"ASC"), array("PROPERTY_ID" => $PROPERTY_ID)); while ($enum = $rsEnum->Fetch()) $cacheL[$PROPERTY_ID][$enum["ID"]] = $enum; } $sort = $cacheL[$PROPERTY_ID][$key]["SORT"]; $value = $cacheL[$PROPERTY_ID][$key]["VALUE"]; break; case "E": if(!isset($cacheE[$key])) { $arLinkFilter = array ( "ID" => $key, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y", ); $rsLink = CIBlockElement::GetList(array(), $arLinkFilter, false, false, array("ID","IBLOCK_ID","NAME","SORT")); $cacheE[$key] = $rsLink->Fetch(); } $value = $cacheE[$key]["NAME"]; $sort = $cacheE[$key]["SORT"]; break; case "G": if(!isset($cacheG[$key])) { $arLinkFilter = array ( "ID" => $key, "GLOBAL_ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", ); $rsLink = CIBlockSection::GetList(array(), $arLinkFilter, false, array("ID","IBLOCK_ID","NAME","LEFT_MARGIN","DEPTH_LEVEL")); $cacheG[$key] = $rsLink->Fetch(); } $value = str_repeat(".", $cacheG["DEPTH_LEVEL"]).$cacheG[$key]["NAME"]; $sort = $cacheG[$key]["LEFT_MARGIN"]; break; default: $value = $key; $sort = 0; break; } $key = htmlspecialcharsbx($key); $value = htmlspecialcharsex($value); $sort = intval($sort); $resultItem["VALUES"][$key] = array( "CONTROL_ID" => htmlspecialcharsbx($this->FILTER_NAME."_".$PROPERTY_ID."_".abs(crc32($key))), "CONTROL_NAME" => htmlspecialcharsbx($this->FILTER_NAME."_".$PROPERTY_ID."_".abs(crc32($key))), "HTML_VALUE" => "Y", "VALUE" => $value, "SORT" => $sort, "UPPER" => ToUpper($value), ); return $key; }
?> </td> </tr> <tr valign="bottom"> <td> <div style="font-size:14px;font-weight:bold;padding-bottom:8px"><label for="ABSENCE_TYPE"><?php echo GetMessage("INTR_ABSENCE_TYPE"); ?> </label></div> <select name="ABSENCE_TYPE" id="absence_type" style="width:100%;font-size:14px;border:1px #c8c8c8 solid;"> <option value="0"><?php echo GetMessage("INTR_ABSENCE_NO_TYPE"); ?> </option> <?php $property_enums = CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("IBLOCK_ID" => $iblockID, "CODE" => "ABSENCE_TYPE")); while ($enum_fields = $property_enums->Fetch()) { ?> <option value="<?php echo $enum_fields["ID"]; ?> " <?php if (isset($_POST['ABSENCE_TYPE']) && $_POST['ABSENCE_TYPE'] == $enum_fields["ID"] || isset($arElement["PROPERTY_ABSENCE_TYPE_ENUM_ID"]) && $arElement["PROPERTY_ABSENCE_TYPE_ENUM_ID"] == $enum_fields["ID"]) { echo "selected"; } ?> ><?php echo $enum_fields["VALUE"]; ?> </option><?php }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== TRUE) { die; } $arResult["CLUB_LIST"] = Club::getListModerator(); $property_enums = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => IB_CLUB_ID, "CODE" => "KIND_CLUB")); while ($enum_fields = $property_enums->GetNext()) { $arResult["KIND_CLUB_LIST"][] = $enum_fields; } $property_enums = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => IB_CLUB_ID, "CODE" => "MUSIC")); while ($enum_fields = $property_enums->GetNext()) { $arResult["MUSIC_LIST"][] = $enum_fields; } $this->IncludeComponentTemplate();
function OnAfterUserAdd($arUser) { if ($arUser['ID'] > 0 && is_array($arUser['UF_DEPARTMENT']) && $arUser['UF_DEPARTMENT'][0] && $arUser['ACTIVE'] == 'Y' && !defined('INTR_SKIP_EVENT_ADD') && ($IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_state_history', ''))) { static $ACCEPTED_ENUM_ID = null; if (null == $ACCEPTED_ENUM_ID) { $dbRes = CIBlockPropertyEnum::GetList(array('id' => 'asc'), array('IBLOCK_ID' => $IBLOCK_ID, 'CODE' => 'STATE', 'XML_ID' => 'ACCEPTED')); if ($arRes = $dbRes->Fetch()) { $ACCEPTED_ENUM_ID = $arRes['ID']; } } $arFields = array('IBLOCK_ID' => $IBLOCK_ID, 'NAME' => GetMessage('INTR_HIRED') . ' - ' . trim($arUser['LAST_NAME'] . ' ' . $arUser['NAME']), 'ACTIVE' => 'Y', 'DATE_ACTIVE_FROM' => ConvertTimeStamp(), 'PREVIEW_TEXT' => GetMessage('INTR_HIRED'), 'PROPERTY_VALUES' => array('USER' => $arUser['ID'], 'DEPARTMENT' => $arUser['UF_DEPARTMENT'], 'POST' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : $arUser['PERSONAL_PROFESSION'], 'STATE' => $ACCEPTED_ENUM_ID)); $obIB = new CIBlockElement(); $obIB->Add($arFields); if (!IsModuleInstalled('bitrix24')) { CIntranetNotify::NewUserMessage($arUser['ID']); } } }
public static function GetControls($strControlID = false) { $arControlList = array(); $arIBlockList = array(); $rsIBlocks = CCatalog::GetList(array(), array(), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID')); while ($arIBlock = $rsIBlocks->Fetch()) { $arIBlock['IBLOCK_ID'] = (int)$arIBlock['IBLOCK_ID']; $arIBlock['PRODUCT_IBLOCK_ID'] = (int)$arIBlock['PRODUCT_IBLOCK_ID']; if ($arIBlock['IBLOCK_ID'] > 0) $arIBlockList[$arIBlock['IBLOCK_ID']] = true; if ($arIBlock['PRODUCT_IBLOCK_ID'] > 0) $arIBlockList[$arIBlock['PRODUCT_IBLOCK_ID']] = true; } unset($arIBlock, $rsIBlocks); if (!empty($arIBlockList)) { $arIBlockList = array_keys($arIBlockList); sort($arIBlockList); foreach ($arIBlockList as &$intIBlockID) { $strName = CIBlock::GetArrayByID($intIBlockID, 'NAME'); if (false !== $strName) { $boolSep = true; $rsProps = CIBlockProperty::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('IBLOCK_ID' => $intIBlockID)); while ($arProp = $rsProps->Fetch()) { if ('CML2_LINK' == $arProp['XML_ID'] || 'F' == $arProp['PROPERTY_TYPE']) continue; if ('L' == $arProp['PROPERTY_TYPE']) { $arProp['VALUES'] = array(); $rsPropEnums = CIBlockPropertyEnum::GetList(array('DEF' => 'DESC', 'SORT' => 'ASC'), array('PROPERTY_ID' => $arProp['ID'])); while ($arPropEnum = $rsPropEnums->Fetch()) { $arProp['VALUES'][] = $arPropEnum; } if (empty($arProp['VALUES'])) continue; } $strFieldType = ''; $arLogic = array(); $arValue = array(); $arPhpValue = ''; $boolUserType = false; if (isset($arProp['USER_TYPE']) && !empty($arProp['USER_TYPE'])) { switch ($arProp['USER_TYPE']) { case 'DateTime': $strFieldType = 'datetime'; $arLogic = static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ, BT_COND_LOGIC_GR, BT_COND_LOGIC_LS, BT_COND_LOGIC_EGR, BT_COND_LOGIC_ELS)); $arValue = array( 'type' => 'datetime', 'format' => 'datetime' ); $boolUserType = true; break; default: $boolUserType = false; break; } } if (!$boolUserType) { switch ($arProp['PROPERTY_TYPE']) { case 'N': $strFieldType = 'double'; $arLogic = static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ, BT_COND_LOGIC_GR, BT_COND_LOGIC_LS, BT_COND_LOGIC_EGR, BT_COND_LOGIC_ELS)); $arValue = array('type' => 'input'); break; case 'S': $strFieldType = 'text'; $arLogic = static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ, BT_COND_LOGIC_CONT, BT_COND_LOGIC_NOT_CONT)); $arValue = array('type' => 'input'); break; case 'L': $strFieldType = 'int'; $arLogic = static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)); $arValue = array( 'type' => 'select', 'values' => array() ); foreach ($arProp['VALUES'] as &$arOnePropValue) { $arValue['values'][$arOnePropValue['ID']] = $arOnePropValue['VALUE']; } if (isset($arOnePropValue)) unset($arOnePropValue); break; $arPhpValue = array('VALIDATE' => 'list'); case 'E': $strFieldType = 'int'; $arLogic = static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)); $arValue = array( 'type' => 'popup', 'popup_url' => '/bitrix/admin/iblock_element_search.php', 'popup_params' => array( 'lang' => LANGUAGE_ID, 'IBLOCK_ID' => $arProp['LINK_IBLOCK_ID'], 'discount' => 'Y' ), 'param_id' => 'n' ); $arPhpValue = array('VALIDATE' => 'element'); break; case 'G': $strFieldType = 'int'; $arLogic = static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)); $arValue = array( 'type' => 'popup', 'popup_url' => '/bitrix/admin/cat_section_search.php', 'popup_params' => array( 'lang' => LANGUAGE_ID, 'IBLOCK_ID' => $arProp['LINK_IBLOCK_ID'], 'discount' => 'Y' ), 'param_id' => 'n' ); $arPhpValue = array('VALIDATE' => 'section'); break; } } $arControlList["CondIBProp:".$intIBlockID.':'.$arProp['ID']] = array( "ID" => "CondIBProp:".$intIBlockID.':'.$arProp['ID'], "IBLOCK_ID" => $intIBlockID, "FIELD" => "PROPERTY_".$arProp['ID']."_VALUE", "FIELD_TYPE" => $strFieldType, 'MULTIPLE' => 'Y', 'GROUP' => 'N', 'SEP' => ($boolSep ? 'Y' : 'N'), 'SEP_LABEL' => ($boolSep ? str_replace(array('#ID#', '#NAME#'), array($intIBlockID, $strName), Loc::getMessage('BT_MOD_CATALOG_COND_CMP_CATALOG_PROP_LABEL')) : ''), 'LABEL' => $arProp['NAME'], 'PREFIX' => str_replace(array('#NAME#', '#IBLOCK_ID#', '#IBLOCK_NAME#'), array($arProp['NAME'], $intIBlockID, $strName), Loc::getMessage('BT_MOD_CATALOG_COND_CMP_CATALOG_ONE_PROP_PREFIX')), 'LOGIC' => $arLogic, 'JS_VALUE' => $arValue, 'PHP_VALUE' => $arPhpValue ); $boolSep = false; } } } if (isset($intIBlockID)) unset($intIBlockID); unset($arIBlockList); } if ($strControlID === false) { return $arControlList; } elseif (isset($arControlList[$strControlID])) { return $arControlList[$strControlID]; } else { return false; } }
}); }); </script> <?php if (date("N", time()) == 1) { $monday = date("j.n.Y", strtotime(date("j.n.Y", time()) . " Monday")); } else { $monday = date("j.n.Y", strtotime(date("j.n.Y", time()) . " last Monday")); } $start_date = $_GET["s"] ? $_GET["s"] : $monday; $end_date = $_GET["e"] ? $_GET["e"] : date("j.n.Y", strtotime(date("j.n.Y", time()) . " next Sunday")); $nextWeek = date("j.n.Y", strtotime("1." . date("n.Y", strtotime($start_date)))); $myID = CUser::GetID(); CModule::IncludeModule("iblock"); $arSelect = array("ID", "IBLOCK_ID", "*"); $property_enums = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => 2, "XML_ID" => "FOR_USERS")); while ($enum_fields = $property_enums->GetNext()) { $enums_id[] = $enum_fields["ID"]; } if (empty($_GET["filter"])) { if (date("U", strtotime($start_date)) < date("U", strtotime(date("j.n.Y", time())))) { $start_date = date("j.n.Y", strtotime(date("j.n.Y", time()) . " Monday")); } $arFilter = array("IBLOCK_ID" => 2, array("LOGIC" => "OR", array("IBLOCK_ID" => 2, "PROPERTY_ANC_ID" => $myID)), array("LOGIC" => "AND", array(">=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'")), array("<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'")))); } elseif (substr($_GET["filter"], 0, 4) == "next") { $arFilter = array("IBLOCK_ID" => 2, ">=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'"), "<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'")); } elseif (substr($_GET["filter"], 0, 4) == "prev") { $arFilter = array("IBLOCK_ID" => 2, "<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'")); if (!empty($_GET["s"])) { $arFilter[">=PROPERTY_START_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'"); }
<?php CModule::IncludeModule("iblock"); if (!empty($_POST['template_color_submit']) && strlen($_POST['template_color_theme']) > 0) { $arSelect = array("ID", "IBLOCK_ID", "NAME", "PROPERTY_COLOR"); $arFilter = array("IBLOCK_CODE" => "color_theme", "CODE" => "template_color_theme"); $res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect); while ($ob = $res->GetNextElement()) { $arFields = $ob->GetFields(); $element_id = $arFields['ID']; $iblock_id = $arFields['IBLOCK_ID']; $arProps = $ob->GetProperties(); } $property_enums = CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("IBLOCK_ID" => $iblock_id, "CODE" => "COLOR")); while ($enum_fields = $property_enums->GetNext()) { if ($enum_fields['XML_ID'] == $_POST['template_color_theme']) { $property_enum_id = intval($enum_fields['ID']); } } if ($element_id > 0 && $property_enum_id > 0) { CIBlockElement::SetPropertyValuesEx($element_id, false, array('COLOR' => $property_enum_id)); } } $arSelect = array("ID", "IBLOCK_ID", "NAME", "PROPERTY_COLOR"); $arFilter = array("IBLOCK_CODE" => "color_theme", "CODE" => "template_color_theme"); $res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect); while ($ob = $res->GetNextElement()) { $arProps = $ob->GetProperties(); } if (strlen($arProps['COLOR']['VALUE_XML_ID']) > 0) { $template_color_theme = $arProps['COLOR']['VALUE_XML_ID'];
function fillDefaultPropertyValues(&$arElement, $iblockProperties) { if (isset($arElement["PROPERTY_VALUES"])) { $elementProperties =& $arElement["PROPERTY_VALUES"]; foreach ($iblockProperties as $PID => $property) { if (!array_key_exists($PID, $elementProperties)) { if ($property["PROPERTY_TYPE"] == "L") { $enumDefaults = CIBlockPropertyEnum::GetList(array(), array("PROPERTY_ID" => $PID, "DEF" => "Y")); $i = 0; while ($enum = $enumDefaults->Fetch()) { $elementProperties[$PID]["n" . $i] = $enum["ID"]; $i++; } } elseif (is_array($property["DEFAULT_VALUE"]) || strlen($property["DEFAULT_VALUE"]) > 0) { $elementProperties[$PID]["n0"] = array("VALUE" => $property["DEFAULT_VALUE"], "DESCRIPTION" => ""); } } } } }
protected function getIBlocksProperties($iblockId) { $arResult = array(); $properties = \CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $iblockId)); while ($prop_fields = $properties->GetNext()) { foreach ($prop_fields as $sFieldName => $sValue) { if (!in_array($sFieldName, $this->arRequiredProps)) { unset($prop_fields[$sFieldName]); } } if ($prop_fields["PROPERTY_TYPE"] == "L") { $prop_fields['VALUES'] = array(); $property_enums = \CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("IBLOCK_ID" => $iblockId, "CODE" => $prop_fields['CODE'])); while ($enum_fields = $property_enums->GetNext()) { foreach ($enum_fields as $sEnumFieldName => $sValue) { if (!in_array($sEnumFieldName, $this->arRequiredEnumFields)) { unset($enum_fields[$sEnumFieldName]); } } $prop_fields['VALUES'][] = $enum_fields; } } $arResult[$prop_fields['CODE']] = $prop_fields; } return $arResult; }
/** * TODO: Использовать API инфоблока!!! * */ protected function checkEnumIds() { $pid = $this->id(); if (!isset(self::$enumIds[$pid])) { self::$enumIds[$pid] = array(); self::$enumXMLIds[$pid] = array(); $res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $pid, 'CHECK_PERMISSIONS' => 'N')); while ($row = $res->Fetch()) { $id = $row['ID']; $xmlId = $row['XML_ID']; self::$enumIds[$pid][$xmlId] = $id; self::$enumXMLIds[$pid][$id] = $xmlId; } } }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("iblock") || WIZARD_INSTALL_DEMO_DATA === false) { return; } $rsIBlock = CIBlock::GetList(array(), array("CODE" => "absence", "TYPE" => "structure", "SITE_ID" => WIZARD_SITE_ID)); if (!($arIBlock = $rsIBlock->Fetch())) { return; } $absence_IBLOCK_ID = $arIBlock["ID"]; $arAbsenceTypes = array(); $dbTypeRes = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array('IBLOCK_ID' => $absence_IBLOCK_ID, 'PROPERTY_ID' => 'ABSENCE_TYPE')); while ($arTypeValue = $dbTypeRes->GetNext()) { $arAbsenceTypes[$arTypeValue['XML_ID']] = $arTypeValue['ID']; } $arAbsenceUsers = array(12, 43, 84, 95, 118, 138, 166, 188, 210, 240, 276, 305, 379, 403); foreach ($arAbsenceUsers as $absentUserId) { $rsUser = CUser::GetByID($absentUserId); if (!$rsUser->Fetch()) { continue; } $date_from = mktime() - ($absentUserId - 200) / 10 * 60 * 60 * 24; $date_to = $date_from + 30 * 60 * 60 * 24; $arAbsenceUser = array("ACTIVE" => "Y", "IBLOCK_ID" => $absence_IBLOCK_ID, "ACTIVE_FROM" => ConvertTimeStamp($date_from), "ACTIVE_TO" => ConvertTimeStamp($date_to), "NAME" => GetMessage('W_IB_ABSENCE_1_NAME'), "PREVIEW_TEXT" => GetMessage('W_IB_ABSENCE_1_PREV1') . date("Y", $date_from) . GetMessage('W_IB_ABSENCE_1_PREV2'), "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => array("USER" => $absentUserId, "STATE" => GetMessage('W_IB_ABSENCE_1_STATE'), "FINISH_STATE" => GetMessage('W_IB_ABSENCE_1_FINISH'), "ABSENCE_TYPE" => $arAbsenceTypes['VACATION'])); $el = new CIBlockElement(); $el->Add($arAbsenceUser); } // командировка
public static function CheckProductProperties($iblockID, $elementID, $propertiesList, $propertiesValues, $enablePartialList = false) { $propertyTypeSupport = array( 'Y' => array( 'N' => true, 'S' => true, 'L' => true, 'G' => true, 'E' => true ), 'N' => array( 'L' => true, 'E' => true ) ); $iblockID = intval($iblockID); $elementID = intval($elementID); if (0 >= $iblockID || 0 >= $elementID) return 6; $enablePartialList = (true === $enablePartialList); $sortIndex = 1; $result = array(); if (!is_array($propertiesList)) $propertiesList = array(); if (empty($propertiesList)) return $result; $checkProps = array_fill_keys($propertiesList, true); $propCodes = $checkProps; $existProps = array(); $rsProps = CIBlockElement::GetProperty($iblockID, $elementID, 'sort', 'asc', array()); while ($oneProp = $rsProps->Fetch()) { if (!isset($propCodes[$oneProp['CODE']]) && !isset($propCodes[$oneProp['ID']])) continue; $propID = (isset($propCodes[$oneProp['CODE']]) ? $oneProp['CODE'] : $oneProp['ID']); if (!isset($checkProps[$propID])) continue; if (!isset($propertyTypeSupport[$oneProp['MULTIPLE']][$oneProp['PROPERTY_TYPE']])) { return ($oneProp['MULTIPLE'] == 'Y' ? 2 : 3); } if (null !== $oneProp['VALUE']) { $existProps[$propID] = true; } if (!isset($propertiesValues[$propID])) { if ($enablePartialList) { continue; } return 1; } if (!is_scalar($propertiesValues[$propID])) return 5; $propertiesValues[$propID] = (string)$propertiesValues[$propID]; $existValue = ('' != $propertiesValues[$propID]); if (!$existValue) return 1; $userTypeProp = false; $userType = null; if (isset($oneProp['USER_TYPE']) && !empty($oneProp['USER_TYPE'])) { $userTypeDescr = CIBlockProperty::GetUserType($oneProp['USER_TYPE']); if (isset($userTypeDescr['GetPublicViewHTML'])) { $userTypeProp = true; $userType = $userTypeDescr['GetPublicViewHTML']; } } if ($oneProp["MULTIPLE"] == "Y") { if ($userTypeProp) { if ($oneProp["VALUE"] == $propertiesValues[$propID]) { $displayValue = (string)call_user_func_array($userType, array( $oneProp, array('VALUE' => $oneProp['VALUE']), array('MODE' => 'SIMPLE_TEXT') )); $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $displayValue, "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } } else { switch($oneProp["PROPERTY_TYPE"]) { case "S": case "N": if ($oneProp["VALUE"] == $propertiesValues[$propID]) { $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $oneProp["VALUE"], "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } break; case "G": if ($oneProp["VALUE"] == $propertiesValues[$propID]) { $rsSection = CIBlockSection::GetList( array(), array("=ID" => $oneProp["VALUE"]), false, array('ID', 'NAME') ); if($arSection = $rsSection->Fetch()) { $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $arSection["NAME"], "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } } break; case "E": if ($oneProp["VALUE"] == $propertiesValues[$propID]) { $rsElement = CIBlockElement::GetList( array(), array("=ID" => $oneProp["VALUE"]), false, false, array("ID", "NAME") ); if ($arElement = $rsElement->Fetch()) { $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $arElement["NAME"], "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } } break; case "L": if ($oneProp["VALUE"] == $propertiesValues[$propID]) { $rsEnum = CIBlockPropertyEnum::GetList( array(), array( "ID" => $propertiesValues[$propID], "IBLOCK_ID" => $iblockID, "PROPERTY_ID" => $oneProp['ID']) ); if ($arEnum = $rsEnum->Fetch()) { $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $arEnum["VALUE"], "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } } break; } } } else { switch ($oneProp["PROPERTY_TYPE"]) { case "L": if (0 < intval($propertiesValues[$propID])) { $rsEnum = CIBlockPropertyEnum::GetList( array(), array("ID" => $propertiesValues[$propID], "IBLOCK_ID" => $iblockID, "PROPERTY_ID" => $oneProp['ID']) ); if ($arEnum = $rsEnum->Fetch()) { $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $arEnum["VALUE"], "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } } break; case "E": if (0 < intval($propertiesValues[$propID])) { $rsElement = CIBlockElement::GetList( array(), array("=ID" => $propertiesValues[$propID]), false, false, array("ID", "NAME") ); if ($arElement = $rsElement->Fetch()) { $result[] = array( "NAME" => $oneProp["NAME"], "CODE" => $propID, "VALUE" => $arElement["NAME"], "SORT" => $sortIndex++, ); unset($checkProps[$propID]);//mark as found } } break; } } } if ($enablePartialList && !empty($checkProps)) { $nonExistProps = array_keys($checkProps); foreach ($nonExistProps as &$oneCode) { if (!isset($existProps[$oneCode])) unset($checkProps[$oneCode]); } unset($oneCode); } if(!empty($checkProps)) return 4; return $result; }
$category = explode("/", $category[0]); ?> <? $array_empty = array(''); $cat = array(); $category = array_diff($category, $array_empty); foreach($category as $item): array_push($cat ,$item); endforeach; ?> <? //$arr = list_category($cat[count($cat)-1]); /*Получаем значение где(в городе /за городом)*/ $params = $cat[0]; $city = $params; $property_enums = CIBlockPropertyEnum::GetList(Array("DEF"=>"DESC", "SORT"=>"ASC"), Array("IBLOCK_ID"=>2, "XML_ID"=>$params)); if($enum_fields = $property_enums->GetNext()) global $arrFilter; //echo $params; $arrFilter = Array( //"PROPERTY_category"=>$arr[0]['ID'], "PROPERTY_params_VALUE" => $enum_fields['~VALUE'], ); $id_cat = ''; if($cat[count($cat)-1] != 'sportivnye-sekcii-v-surgute') { $arSelect_cat = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PREVIEW_TEXT");//IBLOCK_ID и ID обязательно должны быть указаны, см. описание arSelectFields выше $arFilter_cat = Array("IBLOCK_ID"=>1, "CODE"=>$cat[count($cat)-1], "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y"); $res_cat = CIBlockElement::GetList(Array(), $arFilter_cat, false, false, $arSelect_cat);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.1/isotope.pkgd.min.js"></script> <script> $(document).ready( function() { $('.posts-block').isotope({ itemSelector: '.grid-item', layoutMode: 'masonry', masonry: { columnWidth: 100 } }); }); </script> <?php CModule::IncludeModule("iblock"); $arSelect = array("ID", "IBLOCK_ID", "*"); $property_enums = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => array(1, 2, 3, 7, 8), "XML_ID" => "FOR_GROUPS")); while ($enum_fields = $property_enums->GetNext()) { $enums_id[] = $enum_fields["ID"]; } $arFilter = array("IBLOCK_ID" => array(1, 2, 3, 7, 8), "ACTIVE_DATE" => "Y", "ACTIVE" => "Y"); if ($CurentUser["UF_USER_SUB"]) { $CREATED_BY = $CurentUser["UF_USER_SUB"]; } else { $CREATED_BY = 0; } if ($CurentUser["UF_GROUPS"]) { $PROPERTY_ANC_ID = $CurentUser["UF_GROUPS"]; } else { $PROPERTY_ANC_ID = 0; } if ($_GET["filter"] == "groups") {
if ('' != $arRes[$i]) { if (!isset($arProductCache[$arRes[$i]])) { $rsProducts = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $arSku['PRODUCT_IBLOCK_ID'], '=XML_ID' => $arRes[$i]), false, false, array('ID')); if ($arParentProduct = $rsProducts->Fetch()) { $arProductCache[$arRes[$i]] = $arParentProduct['ID']; } } $arRes[$i] = isset($arProductCache[$arRes[$i]]) ? $arProductCache[$arRes[$i]] : ''; } } elseif ($arIBlockProperty[$cur_prop_id]["PROPERTY_TYPE"] == "L") { $arRes[$i] = trim($arRes[$i]); if ('' !== $arRes[$i]) { $propValueHash = md5($arRes[$i]); if (!isset($arPropertyListCache[$cur_prop_id])) { $arPropertyListCache[$cur_prop_id] = array(); $propEnumRes = CIBlockPropertyEnum::GetList(array('SORT' => 'ASC', 'VALUE' => 'ASC'), array('IBLOCK_ID' => $IBLOCK_ID, 'PROPERTY_ID' => $arIBlockProperty[$cur_prop_id]['ID'])); while ($propEnumValue = $propEnumRes->Fetch()) { $arPropertyListCache[$cur_prop_id][md5($propEnumValue['VALUE'])] = $propEnumValue['ID']; } } if (!isset($arPropertyListCache[$cur_prop_id][$propValueHash])) { $arPropertyListCache[$cur_prop_id][$propValueHash] = CIBlockPropertyEnum::Add(array("PROPERTY_ID" => $arIBlockProperty[$cur_prop_id]['ID'], "VALUE" => $arRes[$i], "TMP_ID" => $tmpid)); } if (isset($arPropertyListCache[$cur_prop_id][$propValueHash])) { $arRes[$i] = $arPropertyListCache[$cur_prop_id][$propValueHash]; } else { $arRes[$i] = ''; } } } elseif ($arIBlockProperty[$cur_prop_id]["PROPERTY_TYPE"] == "F") { if (preg_match("/^(http|https):\\/\\//", $arRes[$i])) {
$fld_html .= '<input type="hidden" name="PROPERTY_' . $arProp["PROP_ID"] . '" id="filter_' . $arProp["PROP_ID"] . '" value="" /></div>'; // Slider settings $arResult["SLIDER"][] = $arSliderSettings; } else { // input type=text $fld_html = '<input type="text" name="PROPERTY_' . $arProp["PROP_ID"] . '" id="fld_' . $arProp["PROP_ID"] . '"/>'; } $arResult["FIELDS"][] = array("FLDNAME" => $arProp["PROP_NAME"], "PROPTYPE" => $arProp["PROP_TYPE"], "FIELDTYPE" => $arProp["FLTFIELD_TYPE"], "FLD_HTML" => $fld_html); } else { $arResult["ERRORS"][] = "У свойства " . $arProp["PROP_ID"] . " нет значений для фильтра"; } } elseif ($arProp["PROP_TYPE"] == "L") { // список $arpropvals = array(); $arFilter = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "CODE" => $arProp["PROP_ID"]); $property_enums = CIBlockPropertyEnum::GetList(array(), $arFilter); while ($enum_fields = $property_enums->GetNext()) { $arpropvals[$enum_fields["ID"]] = $enum_fields["VALUE"]; } if (count($arpropvals) > 0) { asort($arpropvals); $fld_html = ''; if ($arProp["FLTFIELD_TYPE"] == "IR") { foreach ($arpropvals as $key => $value) { if (array_key_exists("PROPERTY_" . $arProp["PROP_ID"], $arrFilterCurParams) && $arrFilterCurParams["PROPERTY_" . $arProp["PROP_ID"]] == $key) { $fld_html .= '<input type="radio" name="PROPERTY_' . $arProp["PROP_ID"] . '" value="' . $key . '" checked="checked"> ' . $value; } else { $fld_html .= '<input type="radio" name="PROPERTY_' . $arProp["PROP_ID"] . '" value="' . $key . '"> ' . $value; } } } elseif ($arProp["FLTFIELD_TYPE"] == "ICH") {
<?php } elseif ($arProp["PROPERTY_TYPE"] == 'L') { ?> <select name="filter_sub_el_property_<?php echo $arProp["ID"]; ?> "> <option value=""><?php echo GetMessage("SPS_VALUE_ANY"); ?> </option> <option value="NOT_REF"><?php echo GetMessage("SPS_A_PROP_NOT_SET"); ?> </option><?php $dbrPEnum = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("PROPERTY_ID" => $arProp["ID"])); while ($arPEnum = $dbrPEnum->GetNext()) { ?> <option value="<?php echo $arPEnum["ID"]; ?> "<?php if ($_REQUEST["filter_sub_el_property_" . $arProp["ID"]] == $arPEnum["ID"]) { echo " selected"; } ?> ><?php echo $arPEnum["VALUE"]; ?> </option>
if (!isset($arIBlockProperty['USER_TYPE_SETTINGS']['TABLE_NAME']) || empty($arIBlockProperty['USER_TYPE_SETTINGS']['TABLE_NAME'])) { continue; } if (null === $boolHighLoad) { $boolHighLoad = CModule::IncludeModule('highloadblock'); } if (!$boolHighLoad) { continue; } } if ('F' == $propertyType) { $arFileProperties[] = $arIBlockProperty; $arFilePropertiesExt[$arIBlockProperty['ID']] = $arIBlockProperty; } elseif ('L' == $propertyType) { $arIBlockProperty['VALUE'] = array(); $dbIBlockPropertyEnum = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("PROPERTY_ID" => $arIBlockProperty["ID"])); while ($arIBlockPropertyEnum = $dbIBlockPropertyEnum->Fetch()) { $arIBlockProperty['VALUE'][] = $arIBlockPropertyEnum; } if (!empty($arIBlockProperty['VALUE'])) { $arResult[] = $arIBlockProperty; } } else { $arIBlockProperty['VALUE'] = array(); $arConvert = array(); if (isset($arIBlockProperty["USER_TYPE_SETTINGS"]["TABLE_NAME"]) && !empty($arIBlockProperty["USER_TYPE_SETTINGS"]["TABLE_NAME"])) { $hlblock = HL\HighloadBlockTable::getList(array('filter' => array('=TABLE_NAME' => $arIBlockProperty['USER_TYPE_SETTINGS']['TABLE_NAME'])))->fetch(); if (!empty($hlblock) && is_array($hlblock)) { $entity = HL\HighloadBlockTable::compileEntity($hlblock); $entity_data_class = $entity->getDataClass(); $fieldsList = $entity_data_class::getEntity()->getFields();