本文整理汇总了PHP中CIBlockPropertyEnum::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPropertyEnum::GetList方法的具体用法?PHP CIBlockPropertyEnum::GetList怎么用?PHP CIBlockPropertyEnum::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockPropertyEnum
的用法示例。
在下文中一共展示了CIBlockPropertyEnum::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getPropertiesEx
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;
}
示例2: generateAddCode
/**
* Генерация создания Информационного блока
*
* 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;
}
}
示例3: storeResult
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;
}
示例4: generateAddCode
/**
* Генерация создания
*
* 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;
}
}
示例5: getItemsFlagsIds
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;
}
示例6: getEnumItemList
/**
* 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;
}
示例7: addElementReview
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;
}
示例8: getById
/**
* Возвращает список всех вариантов для указанного свойства
* @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];
}
示例9: GetFilterData
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;
}
示例10: getPropertyIblock
/**
* [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;
}
示例11: findCode
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;
}
}
示例12: GetEditFormHTML
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;
}
示例13: fillItemValues
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);
//.........这里部分代码省略.........
示例14: GetMessage
?>
</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
}
示例15: array
<?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();