예제 #1
0
파일: Iblock.php 프로젝트: cjp2600/bim-core
 /**
  * Генерация создания Информационного блока
  *
  * 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;
     }
 }
예제 #2
0
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;
}
예제 #3
0
 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;
 }
예제 #4
0
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;
}
 private function _applyPropertyListTypeValues($id, $values)
 {
     $addValues = array();
     $updateValues = array();
     $useValuesIds = array();
     foreach ($values as $value) {
         $value['PROPERTY_ID'] = $id;
         try {
             $value['ID'] = $this->getReferenceController()->getItemCurrentVersionByReference($value['~reference'])->id;
             $useValuesIds[] = $value['ID'];
             $updateValues[] = $value;
         } catch (\Exception $e) {
             $addValues[] = $value;
         }
     }
     $currentValues = PropertyEnumerationTable::getList(array('filter' => array('=PROPERTY_ID' => $id)))->fetchAll();
     foreach ($currentValues as $value) {
         !in_array($value['ID'], $useValuesIds) && PropertyEnumerationTable::delete(array('ID' => $value['ID'], 'PROPERTY_ID' => $value['PROPERTY_ID']));
     }
     foreach ($addValues as $value) {
         unset($value['ID']);
         unset($value['~reference']);
         $enum = new \CIBlockPropertyEnum();
         $enumElementId = $enum->Add($value);
         if (!$enumElementId) {
             throw new \Exception('Add property list value. Property not save. ' . var_export($value, true));
         }
         $result = PropertyEnumerationTable::update(array('ID' => $enumElementId, 'PROPERTY_ID' => $value['PROPERTY_ID']), $value);
         if (!$result->isSuccess()) {
             throw new \Exception('Add property list value in table. Property not save. ' . var_export($result->getErrorMessages(), true));
         }
         $referenceItem = new ReferenceItem();
         $referenceItem->id = $enumElementId;
         $referenceItem->group = ReferenceController::GROUP_IBLOCK_PROPERTY_LIST_VALUES;
         $referenceItem->reference = $value['~reference'];
         $this->getReferenceController()->registerItem($referenceItem);
     }
     foreach ($updateValues as $value) {
         $vId = $value['ID'];
         unset($value['ID']);
         unset($value['~reference']);
         $result = PropertyEnumerationTable::update(array('ID' => $vId, 'PROPERTY_ID' => $value['PROPERTY_ID']), $value);
         if (!$result->isSuccess()) {
             throw new \Exception('Update property list value. Property not save. ' . var_export($result->getErrorMessages(), true));
         }
     }
 }
예제 #6
0
/**
 * Тип свойства - список
 * По коду и значению свойства получить id этого значения
 * В случае отсутствия, значение будет создано и будет возвращен его id
 *
 * <code>
 * $propertyCountryValue = getPropertyEnumValueId($IBLOCK_ID, 'COUNTRIES', 'Япония');
 * $be = new CIBlockElement;
 * $be->Add(array(
 *    "ACTIVE" => 'Y',
 *    "IBLOCK_ID" => $IBLOCK_ID,
 *    "NAME" => $name,
 *    "PROPERTY_VALUES" => array(
 *       'COUNTRIES' => $propertyCountryValue,
 *    )
 *  );
 * </code>
 * @param $IBLOCK_ID int id инфоблока, в котором находится данное свойство
 * @param $prop string код свойства
 * @param $value string значение свойства
 * @return bool|int ID значения свойства или false, если не удалось найти свойство с таким кодом или не удалось создать запись с данным значением
 */
function getPropertyEnumValueId($IBLOCK_ID, $prop, $value)
{
    $property = CIBlockProperty::GetByID($prop, $IBLOCK_ID)->Fetch();
    if (!$property) {
        return false;
    }
    $ar_enum_list = CIBlockProperty::GetPropertyEnum($prop, array("SORT" => "asc"), array("IBLOCK_ID" => $IBLOCK_ID, 'VALUE' => $value))->Fetch();
    if (!$ar_enum_list) {
        $ibpenum = new CIBlockPropertyEnum();
        if ($PropID = $ibpenum->Add(array('PROPERTY_ID' => $property['ID'], 'VALUE' => $value))) {
            $ar_enum_list['ID'] = $PropID;
        } else {
            return false;
        }
    }
    return $ar_enum_list['ID'];
}
예제 #7
0
 /**
  * Генерация создания
  *
  * 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;
     }
 }
예제 #8
0
 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;
 }
예제 #9
0
 /**
  * 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;
 }
예제 #10
0
파일: Enum.php 프로젝트: marvin255/bxar
 /**
  * Возвращает список всех вариантов для указанного свойства
  * @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];
 }
예제 #11
0
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;
}
예제 #12
0
 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;
 }
예제 #13
0
	/**
	 * [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;
	}
예제 #14
0
 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;
    }
예제 #16
0
파일: index.php 프로젝트: dayAlone/MyQube
		});
	});
</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')), "\\'");
    }
예제 #17
0
                                $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);
예제 #18
0
<?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'];
예제 #19
0
<?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);
}
// командировка
예제 #20
0
파일: cml2.php 프로젝트: nycmic/bittest
 function exportElementProperties($arElement, $PROPERTY_MAP)
 {
     if ($this->bExtended) {
         $this->ExportPropertyValue("CML2_ACTIVE", $arElement["ACTIVE"] == "Y" ? "true" : "false");
         $this->ExportPropertyValue("CML2_CODE", $arElement["CODE"]);
         $this->ExportPropertyValue("CML2_SORT", intval($arElement["SORT"]));
         $this->ExportPropertyValue("CML2_ACTIVE_FROM", CDatabase::FormatDate($arElement["ACTIVE_FROM"], CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"));
         $this->ExportPropertyValue("CML2_ACTIVE_TO", CDatabase::FormatDate($arElement["ACTIVE_TO"], CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"));
         $this->ExportPropertyValue("CML2_PREVIEW_TEXT", $arElement["PREVIEW_TEXT"], $arElement["PREVIEW_TEXT_TYPE"]);
         $this->ExportPropertyValue("CML2_DETAIL_TEXT", $arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT_TYPE"]);
         $this->ExportPropertyValue("CML2_PREVIEW_PICTURE", $this->ExportFile($arElement["PREVIEW_PICTURE"]));
     }
     $arPropOrder = array("sort" => "asc", "id" => "asc", "enum_sort" => "asc", "value_id" => "asc");
     $rsProps = CIBlockElement::GetProperty($this->arIBlock["ID"], $arElement["ID"], $arPropOrder, array("ACTIVE" => "Y"));
     $arProps = array();
     while ($arProp = $rsProps->Fetch()) {
         $pid = $arProp["ID"];
         if (!array_key_exists($pid, $arProps)) {
             $arProps[$pid] = array("PROPERTY_TYPE" => $arProp["PROPERTY_TYPE"], "LINK_IBLOCK_ID" => $arProp["LINK_IBLOCK_ID"], "VALUES" => array());
         }
         if ($arProp["PROPERTY_TYPE"] == "L") {
             $arProps[$pid]["VALUES"][] = array("VALUE" => $arProp["VALUE_ENUM"], "DESCRIPTION" => $arProp["DESCRIPTION"], "VALUE_ENUM_ID" => $arProp["VALUE"]);
         } else {
             $arProps[$pid]["VALUES"][] = array("VALUE" => $arProp["VALUE"], "DESCRIPTION" => $arProp["DESCRIPTION"], "VALUE_ENUM_ID" => $arProp["VALUE_ENUM_ID"]);
         }
     }
     foreach ($arProps as $pid => $arProp) {
         $bEmpty = true;
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTE") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_PROPERTY_VALUES") . ">\n");
         }
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_NAME") . ">" . htmlspecialcharsbx($PROPERTY_MAP["~" . $pid]) . "</" . GetMessage("IBLOCK_XML2_NAME") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($PROPERTY_MAP[$pid]) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
         }
         foreach ($arProp["VALUES"] as $arValue) {
             $value = $arValue["VALUE"];
             if (is_array($value) || strlen($value)) {
                 $bEmpty = false;
                 $bSerialized = false;
                 if ($this->bExtended) {
                     if ($arProp["PROPERTY_TYPE"] == "L") {
                         $value = CIBlockPropertyEnum::GetByID($arValue["VALUE_ENUM_ID"]);
                         $value = $value["XML_ID"];
                     } elseif ($arProp["PROPERTY_TYPE"] == "F") {
                         $value = $this->ExportFile($value);
                     } elseif ($arProp["PROPERTY_TYPE"] == "G") {
                         $value = $this->GetSectionXML_ID($arProp["LINK_IBLOCK_ID"], $value);
                     } elseif ($arProp["PROPERTY_TYPE"] == "E") {
                         $value = $this->GetElementXML_ID($arProp["LINK_IBLOCK_ID"], $value);
                     }
                     if (is_array($value) && $arProp["PROPERTY_TYPE"] !== "F") {
                         $bSerialized = true;
                         $value = serialize($value);
                     }
                 }
                 fwrite($this->fp, $this->formatXMLNode(6, GetMessage("IBLOCK_XML2_VALUE"), $value));
                 if ($this->bExtended) {
                     fwrite($this->fp, "\t\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_PROPERTY_VALUE") . ">\n");
                     if ($bSerialized) {
                         fwrite($this->fp, "\t\t\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_SERIALIZED") . ">true</" . GetMessage("IBLOCK_XML2_SERIALIZED") . ">\n");
                     }
                     fwrite($this->fp, $this->formatXMLNode(7, GetMessage("IBLOCK_XML2_VALUE"), $value));
                     fwrite($this->fp, "\t\t\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_DESCRIPTION") . ">" . htmlspecialcharsbx($arValue["DESCRIPTION"]) . "</" . GetMessage("IBLOCK_XML2_DESCRIPTION") . ">\n");
                     fwrite($this->fp, "\t\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_PROPERTY_VALUE") . ">\n");
                 }
             }
         }
         if ($bEmpty) {
             fwrite($this->fp, "\t\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_VALUE") . "></" . GetMessage("IBLOCK_XML2_VALUE") . ">\n");
         }
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTE") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_PROPERTY_VALUES") . ">\n");
         }
     }
 }
예제 #21
0
 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;
 }
예제 #22
0
 /**
  * <p>Метод устанавливает значения перечислений свойства типа "список". Метод динамичный.</p>
  *
  *
  * @param int $ID  Код свойства.
  *
  * @param array $arVALUES  Массив всех значений в формате Array("код существующего
  * значения"=&gt;"массив полей значения", ..., "массив полей нового
  * значения", ...). Где массив полей имеет вид: Array("VALUE"=&gt;"значение"[,
  * "SORT"=&gt;"порядок сортировки"][, "DEF"=&gt;"является значением по
  * умолчанию (Y|N)"][, "XML_ID"=&gt;"внешний код"]).
  *
  * @param bool $bForceDelete = true Если принимает значение <i>true</i>, то удаляются варианты значений, у
  * которых <i>VALUE</i> пустой. Значение <i>false</i> позволяет сохранить
  * значения, использованные хотя бы у одного элемента.
  * Необязательный параметр.
  *
  * @return mixed 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * $cnt = 0;<br>$ar_all_values = Array();<br>$db_enum_list = CIBlockProperty::GetPropertyEnum($PROP_ID, Array('SORT'=&gt;'ASC'));<br>while($ar_enum = $db_enum_list-&gt;Fetch())<br>{<br>	$cnt++;<br>	$ar_all_values[$ar_enum['ID']] = Array('SORT'=&gt;$cnt, 'VALUE'=&gt;$ar_enum['VALUE']);<br>}<br>$CIBlockProp = new CIBlockProperty;
  * $CIBlockProp-&gt;UpdateEnum($PROP_ID, $ar_all_values); ?&gt;
  * </pre>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/iblock/fields.php#fiblockpropertyenum">Поля значений
  * свойства типа "список</a><a
  * href="http://dev.1c-bitrix.ru/api_help/main/reference/ceventmessage/index.php#flds">" </a> </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/index.php">CIBlockPropetyEnum</a>::<a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/update.php">Update()</a> </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/index.php">CIBlockPropetyEnum</a>::<a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/add.php">Add()</a> </li> </ul> <a
  * name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockproperty/updateenum.php
  * @author Bitrix
  */
 public function UpdateEnum($ID, $arVALUES, $bForceDelete = true)
 {
     global $DB, $CACHE_MANAGER;
     $ID = IntVal($ID);
     if (!is_array($arVALUES) || empty($arVALUES) && $bForceDelete) {
         CIBlockPropertyEnum::DeleteByPropertyID($ID);
         return true;
     }
     $ar_XML_ID = array();
     $db_res = $this->GetPropertyEnum($ID);
     while ($res = $db_res->Fetch()) {
         $ar_XML_ID[$res["XML_ID"]] = $res["ID"];
     }
     $sqlWhere = "";
     if (!$bForceDelete) {
         $rsProp = CIBlockProperty::GetByID($ID);
         if ($arProp = $rsProp->Fetch()) {
             if ($arProp["VERSION"] == 1) {
                 $sqlWhere = "AND NOT EXISTS (\n\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\tFROM b_iblock_element_property\n\t\t\t\t\t\tWHERE b_iblock_element_property.IBLOCK_PROPERTY_ID = b_iblock_property_enum.PROPERTY_ID\n\t\t\t\t\t\tAND b_iblock_element_property.VALUE_ENUM = b_iblock_property_enum.ID\n\t\t\t\t\t)";
             } elseif ($arProp["MULTIPLE"] == "N") {
                 $sqlWhere = "AND NOT EXISTS (\n\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\tFROM b_iblock_element_prop_s" . $arProp["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE b_iblock_element_prop_s" . $arProp["IBLOCK_ID"] . ".PROPERTY_" . $arProp["ID"] . " = b_iblock_property_enum.ID\n\t\t\t\t\t)";
             } else {
                 $sqlWhere = "AND NOT EXISTS (\n\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\tFROM b_iblock_element_prop_m" . $arProp["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE b_iblock_element_prop_m" . $arProp["IBLOCK_ID"] . ".IBLOCK_PROPERTY_ID = b_iblock_property_enum.PROPERTY_ID\n\t\t\t\t\t\tAND b_iblock_element_prop_m" . $arProp["IBLOCK_ID"] . ".VALUE_ENUM = b_iblock_property_enum.ID\n\t\t\t\t\t)";
             }
         }
     }
     $db_res = $this->GetPropertyEnum($ID);
     while ($res = $db_res->Fetch()) {
         $VALUE = $arVALUES[$res["ID"]];
         $VAL = is_array($VALUE) ? $VALUE["VALUE"] : $VALUE;
         unset($arVALUES[$res["ID"]]);
         if (strlen($VAL) <= 0) {
             unset($ar_XML_ID[$res["XML_ID"]]);
             $strSql = "\n\t\t\t\t\tDELETE FROM b_iblock_property_enum\n\t\t\t\t\tWHERE ID=" . $res["ID"] . "\n\t\t\t\t\t" . $sqlWhere . "\n\t\t\t\t";
             $DB->Query($strSql);
         } else {
             $DEF = "";
             $SORT = 0;
             $XML_ID = "";
             if (is_array($VALUE)) {
                 if (array_key_exists("DEF", $VALUE)) {
                     $DEF = $VALUE["DEF"] == "Y" ? "Y" : "N";
                 }
                 if (array_key_exists("SORT", $VALUE)) {
                     $SORT = intval($VALUE["SORT"]);
                 }
                 if ($SORT < 0) {
                     $SORT = 0;
                 }
                 if (array_key_exists("XML_ID", $VALUE) && strlen($VALUE["XML_ID"])) {
                     $XML_ID = substr($VALUE["XML_ID"], 0, 200);
                 } elseif (array_key_exists("EXTERNAL_ID", $VALUE) && strlen($VALUE["EXTERNAL_ID"])) {
                     $XML_ID = substr($VALUE["EXTERNAL_ID"], 0, 200);
                 }
             }
             if ($XML_ID) {
                 unset($ar_XML_ID[$res["XML_ID"]]);
                 if (array_key_exists($XML_ID, $ar_XML_ID)) {
                     $XML_ID = md5(uniqid(""));
                 }
                 $ar_XML_ID[$XML_ID] = $res["ID"];
             }
             $strSql = "\n\t\t\t\t\tUPDATE b_iblock_property_enum\n\t\t\t\t\tSET\n\t\t\t\t\t\t" . ($DEF ? " DEF = '" . $DEF . "', " : "") . "\n\t\t\t\t\t\t" . ($SORT ? " SORT = " . $SORT . ", " : "") . "\n\t\t\t\t\t\t" . ($XML_ID ? " XML_ID = '" . $DB->ForSQL($XML_ID, 200) . "', " : "") . "\n\t\t\t\t\t\tVALUE = '" . $DB->ForSQL($VAL, 255) . "'\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tID = " . $res["ID"] . "\n\t\t\t\t";
             $DB->Query($strSql);
         }
     }
     foreach ($arVALUES as $id => $VALUE) {
         $VAL = is_array($VALUE) ? $VALUE["VALUE"] : $VALUE;
         if (strlen($id) > 0 && strlen($VAL) > 0) {
             $DEF = "";
             $SORT = 0;
             $XML_ID = "";
             if (is_array($VALUE)) {
                 if (array_key_exists("DEF", $VALUE)) {
                     $DEF = $VALUE["DEF"] == "Y" ? "Y" : "N";
                 }
                 if (array_key_exists("SORT", $VALUE)) {
                     $SORT = intval($VALUE["SORT"]);
                 }
                 if ($SORT < 0) {
                     $SORT = 0;
                 }
                 if (array_key_exists("XML_ID", $VALUE) && strlen($VALUE["XML_ID"])) {
                     $XML_ID = substr($VALUE["XML_ID"], 0, 200);
                 } elseif (array_key_exists("EXTERNAL_ID", $VALUE) && strlen($VALUE["EXTERNAL_ID"])) {
                     $XML_ID = substr($VALUE["EXTERNAL_ID"], 0, 200);
                 }
             }
             if ($XML_ID) {
                 if (array_key_exists($XML_ID, $ar_XML_ID)) {
                     $XML_ID = md5(uniqid("", true));
                 }
                 $ar_XML_ID[$XML_ID] = 0;
             } else {
                 $XML_ID = md5(uniqid("", true));
                 $ar_XML_ID[$XML_ID] = 0;
             }
             $strSql = "\n\t\t\t\t\tINSERT INTO b_iblock_property_enum\n\t\t\t\t\t(\n\t\t\t\t\t\tPROPERTY_ID\n\t\t\t\t\t\t" . ($DEF ? ",DEF" : "") . "\n\t\t\t\t\t\t" . ($SORT ? ",SORT" : "") . "\n\t\t\t\t\t\t,VALUE\n\t\t\t\t\t\t,XML_ID\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t" . $ID . "\n\t\t\t\t\t\t" . ($DEF ? ",'" . $DEF . "'" : "") . "\n\t\t\t\t\t\t" . ($SORT ? "," . $SORT . "" : "") . "\n\t\t\t\t\t\t,'" . $DB->ForSQL($VAL, 255) . "'\n\t\t\t\t\t\t,'" . $DB->ForSQL($XML_ID, 200) . "'\n\t\t\t\t\t)\n\t\t\t\t";
             $DB->Query($strSql);
         }
     }
     if (CACHED_b_iblock_property_enum !== false) {
         $CACHE_MANAGER->CleanDir("b_iblock_property_enum");
     }
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $CACHE_MANAGER->ClearByTag("iblock_property_enum_" . $ID);
     }
     return true;
 }
예제 #23
0
         }
         $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])) {
         $arRes[$i] = CFile::MakeFileArray($arRes[$i]);
     } else {
         $arRes[$i] = CFile::MakeFileArray($io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"] . $PATH2IMAGE_FILES . '/' . $arRes[$i]));
     }
     if (!is_array($arRes[$i]) || !array_key_exists("tmp_name", $arRes[$i])) {
         $arRes[$i] = '';
예제 #24
0
 case "iblock":
     if (substr($arItem["ITEM_ID"], 0, 1) === "G") {
         if (file_exists($abs_path . "socialnetwork_group.gif")) {
             $file = "socialnetwork_group.gif";
         }
     } elseif (CModule::IncludeModule('iblock')) {
         if (!array_key_exists($arItem["PARAM2"], $arIBlocks)) {
             $arIBlocks[$arItem["PARAM2"]] = CIBlock::GetArrayByID($arItem["PARAM2"]);
         }
         //section /element
         if (substr($arItem["ITEM_ID"], 0, 1) !== "S") {
             //Try to find gif by element proprety value xml id
             $rsElement = CIBlockElement::GetList(array(), array("=ID" => $arItem["ITEM_ID"], "IBLOCK_ID" => $arItem["PARAM2"]), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "CODE", "XML_ID", "PROPERTY_DOC_TYPE"));
             $arElement = $rsElement->Fetch();
             if ($arElement && strlen($arElement["PROPERTY_DOC_TYPE_ENUM_ID"]) > 0) {
                 $arEnum = CIBlockPropertyEnum::GetByID($arElement["PROPERTY_DOC_TYPE_ENUM_ID"]);
                 if ($arEnum && $arEnum["XML_ID"]) {
                     if (file_exists($abs_path . "iblock_doc_type_" . strtolower($arEnum["XML_ID"]) . ".gif")) {
                         $file = "iblock_doc_type_" . strtolower($arEnum["XML_ID"]) . ".gif";
                     }
                 }
             }
             // add chain items if iblock (task, calendar event, library document)
             $element_type = false;
             if ($arElement) {
                 if ($arElement["IBLOCK_ID"] == $arParams["TASKS_USER_IBLOCK_ID"]) {
                     $element_type = "tasks";
                 } elseif ($arElement["IBLOCK_ID"] == $arParams["CALENDAR_USER_IBLOCK_ID"]) {
                     $element_type = "calendar";
                 } elseif ($arElement["IBLOCK_ID"] == $arParams["FILES_USER_IBLOCK_ID"]) {
                     $element_type = "files";
예제 #25
0
 /**
  * @param bool|array $arOrder
  * @param array $arFilter
  * @return array
  */
 function GetProperties($arOrder = false, $arFilter = array())
 {
     if ($arOrder === false) {
         $arOrder = array("sort" => "asc", "id" => "asc", "enum_sort" => "asc", "value_id" => "asc");
     }
     if (count($arFilter) == 0 && is_array($this->props)) {
         $arAllProps = array();
         foreach ($this->props as $arProp) {
             if (strlen(trim($arProp["CODE"])) > 0) {
                 $PIND = $arProp["CODE"];
             } else {
                 $PIND = $arProp["ID"];
             }
             $arProp["VALUE"] = $this->fields["PROPERTY_" . $arProp["ID"]];
             $arProp["DESCRIPTION"] = $this->fields["DESCRIPTION_" . $arProp["ID"]];
             if ($arProp["MULTIPLE"] == "N") {
                 if ($arProp["PROPERTY_TYPE"] == "L") {
                     $arProp["VALUE_ENUM_ID"] = $val = $arProp["VALUE"];
                     $arEnum = CIBlockPropertyEnum::GetByID($val);
                     if ($arEnum !== false) {
                         $arProp["~VALUE"] = $arEnum["VALUE"];
                         if (is_array($arProp["VALUE"]) || preg_match("/[;&<>\"]/", $arProp["VALUE"])) {
                             $arProp["VALUE"] = htmlspecialcharsex($arEnum["VALUE"]);
                         } else {
                             $arProp["VALUE"] = $arEnum["VALUE"];
                         }
                         $arProp["VALUE_ENUM"] = $arProp["VALUE"];
                         $arProp["VALUE_XML_ID"] = htmlspecialcharsex($arEnum["XML_ID"]);
                         $arProp["VALUE_SORT"] = $arEnum["SORT"];
                     } else {
                         $arProp["~VALUE"] = "";
                         $arProp["VALUE"] = "";
                     }
                 } elseif (is_array($arProp["VALUE"]) || strlen($arProp["VALUE"])) {
                     if ($arProp["PROPERTY_TYPE"] == "N") {
                         $arProp["VALUE"] = htmlspecialcharsex(CIBlock::NumberFormat($arProp["VALUE"]));
                     }
                     $arProp["~VALUE"] = $this->fields["~PROPERTY_" . $arProp["ID"]];
                     $arProp["~DESCRIPTION"] = $this->fields["~DESCRIPTION_" . $arProp["ID"]];
                 } else {
                     $arProp["VALUE"] = $arProp["~VALUE"] = "";
                     $arProp["DESCRIPTION"] = $arProp["~DESCRIPTION"] = "";
                 }
             } else {
                 $arList = $arProp["VALUE"];
                 $arListTilda = $this->fields["~PROPERTY_" . $arProp["ID"]];
                 if ($arProp["PROPERTY_TYPE"] == "L") {
                     $arProp["~VALUE"] = $arProp["VALUE"] = $arProp["VALUE_ENUM_ID"] = false;
                     $arProp["VALUE_XML_ID"] = false;
                     foreach ($arList as $key => $val) {
                         if (strlen($val) > 0) {
                             $arEnum = CIBlockPropertyEnum::GetByID($key);
                             if ($arEnum !== false) {
                                 $xml_id = htmlspecialcharsex($arEnum["XML_ID"]);
                                 $sort = $arEnum["SORT"];
                             } else {
                                 $xml_id = false;
                                 $sort = false;
                             }
                             if (is_array($arProp["VALUE"])) {
                                 $arProp["VALUE_ENUM_ID"][] = $key;
                                 $arProp["~VALUE"][] = $val;
                                 if (is_array($val) || preg_match("/[;&<>\"]/", $val)) {
                                     $arProp["VALUE"][] = htmlspecialcharsex($val);
                                 } else {
                                     $arProp["VALUE"][] = $val;
                                 }
                                 $arProp["VALUE_XML_ID"][] = $xml_id;
                                 $arProp["VALUE_SORT"][] = $sort;
                             } else {
                                 $arProp["VALUE_ENUM_ID"] = array($key);
                                 $arProp["~VALUE"] = array($val);
                                 if (is_array($val) || preg_match("/[;&<>\"]/", $val)) {
                                     $arProp["VALUE"] = array(htmlspecialcharsex($val));
                                 } else {
                                     $arProp["VALUE"] = array($val);
                                 }
                                 $arProp["VALUE_XML_ID"] = array($xml_id);
                                 $arProp["VALUE_SORT"] = array($sort);
                             }
                         }
                     }
                     $arProp["VALUE_ENUM"] = $arProp["VALUE"];
                 } else {
                     $arDesc = $arProp["DESCRIPTION"];
                     $arDescTilda = $this->fields["~DESCRIPTION_" . $arProp["ID"]];
                     $arProp["~VALUE"] = $arProp["VALUE"] = false;
                     $arProp["~DESCRIPTION"] = $arProp["DESCRIPTION"] = false;
                     foreach ($arList as $key => $val) {
                         if (is_array($val) || strlen($val) > 0) {
                             if (is_array($arProp["VALUE"])) {
                                 $arProp["~VALUE"][] = $arListTilda[$key];
                                 if ($arProp["PROPERTY_TYPE"] == "N") {
                                     $val = htmlspecialcharsex(CIBlock::NumberFormat($val));
                                 }
                                 $arProp["VALUE"][] = $val;
                                 $arProp["~DESCRIPTION"][] = $arDescTilda[$key];
                                 $arProp["DESCRIPTION"][] = $arDesc[$key];
                             } else {
                                 $arProp["~VALUE"] = array($arListTilda[$key]);
                                 if ($arProp["PROPERTY_TYPE"] == "N") {
                                     $val = htmlspecialcharsex(CIBlock::NumberFormat($val));
                                 }
                                 $arProp["VALUE"] = array($val);
                                 $arProp["~DESCRIPTION"] = array($arDescTilda[$key]);
                                 $arProp["DESCRIPTION"] = array($arDesc[$key]);
                             }
                         }
                     }
                 }
             }
             $arAllProps[$PIND] = $arProp;
         }
         return $arAllProps;
     }
     if (array_key_exists("ID", $arFilter) && !is_numeric(substr($arFilter["ID"], 0, 1))) {
         $arFilter["CODE"] = $arFilter["ID"];
         unset($arFilter["ID"]);
     }
     if (!array_key_exists("ACTIVE", $arFilter)) {
         $arFilter["ACTIVE"] = "Y";
     }
     $props = CIBlockElement::GetProperty($this->fields["IBLOCK_ID"], $this->fields["ID"], $arOrder, $arFilter);
     $arAllProps = array();
     while ($arProp = $props->Fetch()) {
         if (strlen(trim($arProp["CODE"])) > 0) {
             $PIND = $arProp["CODE"];
         } else {
             $PIND = $arProp["ID"];
         }
         if ($arProp["PROPERTY_TYPE"] == "L") {
             $arProp["VALUE_ENUM_ID"] = $arProp["VALUE"];
             $arProp["VALUE"] = $arProp["VALUE_ENUM"];
         }
         if (is_array($arProp["VALUE"]) || strlen($arProp["VALUE"]) > 0) {
             $arProp["~VALUE"] = $arProp["VALUE"];
             if (is_array($arProp["VALUE"]) || preg_match("/[;&<>\"]/", $arProp["VALUE"])) {
                 $arProp["VALUE"] = htmlspecialcharsex($arProp["VALUE"]);
             }
             $arProp["~DESCRIPTION"] = $arProp["DESCRIPTION"];
             if (preg_match("/[;&<>\"]/", $arProp["DESCRIPTION"])) {
                 $arProp["DESCRIPTION"] = htmlspecialcharsex($arProp["DESCRIPTION"]);
             }
         } else {
             $arProp["VALUE"] = $arProp["~VALUE"] = "";
             $arProp["DESCRIPTION"] = $arProp["~DESCRIPTION"] = "";
         }
         if ($arProp["MULTIPLE"] == "Y") {
             if (array_key_exists($PIND, $arAllProps)) {
                 $arTemp =& $arAllProps[$PIND];
                 if ($arProp["VALUE"] !== "") {
                     if (is_array($arTemp["VALUE"])) {
                         $arTemp["VALUE"][] = $arProp["VALUE"];
                         $arTemp["~VALUE"][] = $arProp["~VALUE"];
                         $arTemp["DESCRIPTION"][] = $arProp["DESCRIPTION"];
                         $arTemp["~DESCRIPTION"][] = $arProp["~DESCRIPTION"];
                         $arTemp["PROPERTY_VALUE_ID"][] = $arProp["PROPERTY_VALUE_ID"];
                         if ($arProp["PROPERTY_TYPE"] == "L") {
                             $arTemp["VALUE_ENUM_ID"][] = $arProp["VALUE_ENUM_ID"];
                             $arTemp["VALUE_ENUM"][] = $arProp["VALUE_ENUM"];
                             $arTemp["VALUE_XML_ID"][] = $arProp["VALUE_XML_ID"];
                             //$arTemp["VALUE_SORT"][] = $arProp["VALUE_SORT"];
                         }
                     } else {
                         $arTemp["VALUE"] = array($arProp["VALUE"]);
                         $arTemp["~VALUE"] = array($arProp["~VALUE"]);
                         $arTemp["DESCRIPTION"] = array($arProp["DESCRIPTION"]);
                         $arTemp["~DESCRIPTION"] = array($arProp["~DESCRIPTION"]);
                         $arTemp["PROPERTY_VALUE_ID"] = array($arProp["PROPERTY_VALUE_ID"]);
                         if ($arProp["PROPERTY_TYPE"] == "L") {
                             $arTemp["VALUE_ENUM_ID"] = array($arProp["VALUE_ENUM_ID"]);
                             $arTemp["VALUE_ENUM"] = array($arProp["VALUE_ENUM"]);
                             $arTemp["VALUE_XML_ID"] = array($arProp["VALUE_XML_ID"]);
                             $arTemp["VALUE_SORT"] = array($arProp["VALUE_SORT"]);
                         }
                     }
                 }
             } else {
                 $arProp["~NAME"] = $arProp["NAME"];
                 if (preg_match("/[;&<>\"]/", $arProp["NAME"])) {
                     $arProp["NAME"] = htmlspecialcharsex($arProp["NAME"]);
                 }
                 $arProp["~DEFAULT_VALUE"] = $arProp["DEFAULT_VALUE"];
                 if (is_array($arProp["DEFAULT_VALUE"]) || preg_match("/[;&<>\"]/", $arProp["DEFAULT_VALUE"])) {
                     $arProp["DEFAULT_VALUE"] = htmlspecialcharsex($arProp["DEFAULT_VALUE"]);
                 }
                 if ($arProp["VALUE"] !== "") {
                     $arProp["VALUE"] = array($arProp["VALUE"]);
                     $arProp["~VALUE"] = array($arProp["~VALUE"]);
                     $arProp["DESCRIPTION"] = array($arProp["DESCRIPTION"]);
                     $arProp["~DESCRIPTION"] = array($arProp["~DESCRIPTION"]);
                     $arProp["PROPERTY_VALUE_ID"] = array($arProp["PROPERTY_VALUE_ID"]);
                     if ($arProp["PROPERTY_TYPE"] == "L") {
                         $arProp["VALUE_ENUM_ID"] = array($arProp["VALUE_ENUM_ID"]);
                         $arProp["VALUE_ENUM"] = array($arProp["VALUE_ENUM"]);
                         $arProp["VALUE_XML_ID"] = array($arProp["VALUE_XML_ID"]);
                         $arProp["VALUE_SORT"] = array($arProp["VALUE_SORT"]);
                     }
                 } else {
                     $arProp["VALUE"] = false;
                     $arProp["~VALUE"] = false;
                     $arProp["DESCRIPTION"] = false;
                     $arProp["~DESCRIPTION"] = false;
                     $arProp["PROPERTY_VALUE_ID"] = false;
                     if ($arProp["PROPERTY_TYPE"] == "L") {
                         $arProp["VALUE_ENUM_ID"] = false;
                         $arProp["VALUE_ENUM"] = false;
                         $arProp["VALUE_XML_ID"] = false;
                         $arProp["VALUE_SORT"] = false;
                     }
                 }
                 $arAllProps[$PIND] = $arProp;
             }
         } else {
             $arProp["~NAME"] = $arProp["NAME"];
             if (preg_match("/[;&<>\"]/", $arProp["NAME"])) {
                 $arProp["NAME"] = htmlspecialcharsex($arProp["NAME"]);
             }
             $arProp["~DEFAULT_VALUE"] = $arProp["DEFAULT_VALUE"];
             if (is_array($arProp["DEFAULT_VALUE"]) || preg_match("/[;&<>\"]/", $arProp["DEFAULT_VALUE"])) {
                 $arProp["DEFAULT_VALUE"] = htmlspecialcharsex($arProp["DEFAULT_VALUE"]);
             }
             $arAllProps[$PIND] = $arProp;
         }
     }
     return $arAllProps;
 }
예제 #26
0
	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;
		}
	}
예제 #27
0
 public function fillItemValues(&$resultItem, $arProperty, $flag = null)
 {
     static $cache = array();
     if (is_array($arProperty)) {
         if (isset($arProperty["PRICE"])) {
             return null;
         }
         $key = $arProperty["VALUE"];
         $PROPERTY_TYPE = $arProperty["PROPERTY_TYPE"];
         $PROPERTY_USER_TYPE = $arProperty["USER_TYPE"];
         $PROPERTY_ID = $arProperty["ID"];
     } else {
         $key = $arProperty;
         $PROPERTY_TYPE = $resultItem["PROPERTY_TYPE"];
         $PROPERTY_USER_TYPE = $resultItem["USER_TYPE"];
         $PROPERTY_ID = $resultItem["ID"];
         $arProperty = $resultItem;
     }
     if ($PROPERTY_TYPE == "F") {
         return null;
     } elseif ($PROPERTY_TYPE == "N") {
         $convertKey = (double) $key;
         if (strlen($key) <= 0) {
             return null;
         }
         if (!isset($resultItem["VALUES"]["MIN"]) || !array_key_exists("VALUE", $resultItem["VALUES"]["MIN"]) || doubleval($resultItem["VALUES"]["MIN"]["VALUE"]) > $convertKey) {
             $resultItem["VALUES"]["MIN"]["VALUE"] = preg_replace("/\\.0+\$/", "", $key);
         }
         if (!isset($resultItem["VALUES"]["MAX"]) || !array_key_exists("VALUE", $resultItem["VALUES"]["MAX"]) || doubleval($resultItem["VALUES"]["MAX"]["VALUE"]) < $convertKey) {
             $resultItem["VALUES"]["MAX"]["VALUE"] = preg_replace("/\\.0+\$/", "", $key);
         }
         return null;
     } elseif ($arProperty["DISPLAY_TYPE"] == "U") {
         $date = substr($key, 0, 10);
         if (!$date) {
             return null;
         }
         $timestamp = MakeTimeStamp($date, "YYYY-MM-DD");
         if (!$timestamp) {
             return null;
         }
         if (!isset($resultItem["VALUES"]["MIN"]) || !array_key_exists("VALUE", $resultItem["VALUES"]["MIN"]) || $resultItem["VALUES"]["MIN"]["VALUE"] > $timestamp) {
             $resultItem["VALUES"]["MIN"]["VALUE"] = $timestamp;
         }
         if (!isset($resultItem["VALUES"]["MAX"]) || !array_key_exists("VALUE", $resultItem["VALUES"]["MAX"]) || $resultItem["VALUES"]["MAX"]["VALUE"] < $timestamp) {
             $resultItem["VALUES"]["MAX"]["VALUE"] = $timestamp;
         }
         return null;
     } elseif ($PROPERTY_TYPE == "E" && $key <= 0) {
         return null;
     } elseif ($PROPERTY_TYPE == "G" && $key <= 0) {
         return null;
     } elseif (strlen($key) <= 0) {
         return null;
     }
     $arUserType = array();
     if ($PROPERTY_USER_TYPE != "") {
         $arUserType = CIBlockProperty::GetUserType($PROPERTY_USER_TYPE);
         if (isset($arUserType["GetExtendedValue"])) {
             $PROPERTY_TYPE = "Ux";
         } elseif (isset($arUserType["GetPublicViewHTML"])) {
             $PROPERTY_TYPE = "U";
         }
     }
     if ($PROPERTY_USER_TYPE === "DateTime") {
         $key = call_user_func_array($arUserType["GetPublicViewHTML"], array($arProperty, array("VALUE" => $key), array("MODE" => "SIMPLE_TEXT", "DATETIME_FORMAT" => "SHORT")));
         $PROPERTY_TYPE = "S";
     }
     $htmlKey = htmlspecialcharsbx($key);
     if (isset($resultItem["VALUES"][$htmlKey])) {
         return $htmlKey;
     }
     $file_id = null;
     $url_id = null;
     switch ($PROPERTY_TYPE) {
         case "L":
             $enum = CIBlockPropertyEnum::GetByID($key);
             if ($enum) {
                 $value = $enum["VALUE"];
                 $sort = $enum["SORT"];
                 $url_id = toLower($enum["XML_ID"]);
             } else {
                 return null;
             }
             break;
         case "E":
             if (!isset($cache[$PROPERTY_TYPE][$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", "CODE"));
                 $cache[$PROPERTY_TYPE][$key] = $rsLink->Fetch();
             }
             $value = $cache[$PROPERTY_TYPE][$key]["NAME"];
             $sort = $cache[$PROPERTY_TYPE][$key]["SORT"];
             if ($cache[$PROPERTY_TYPE][$key]["CODE"]) {
                 $url_id = toLower($cache[$PROPERTY_TYPE][$key]["CODE"]);
             } else {
                 $url_id = toLower($value);
             }
             break;
         case "G":
             if (!isset($cache[$PROPERTY_TYPE][$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", "CODE"));
                 $cache[$PROPERTY_TYPE][$key] = $rsLink->Fetch();
                 $cache[$PROPERTY_TYPE][$key]['DEPTH_NAME'] = str_repeat(".", $cache[$PROPERTY_TYPE][$key]["DEPTH_LEVEL"]) . $cache[$PROPERTY_TYPE][$key]["NAME"];
             }
             $value = $cache[$PROPERTY_TYPE][$key]['DEPTH_NAME'];
             $sort = $cache[$PROPERTY_TYPE][$key]["LEFT_MARGIN"];
             if ($cache[$PROPERTY_TYPE][$key]["CODE"]) {
                 $url_id = toLower($cache[$PROPERTY_TYPE][$key]["CODE"]);
             } else {
                 $url_id = toLower($value);
             }
             break;
         case "U":
             if (!isset($cache[$PROPERTY_ID])) {
                 $cache[$PROPERTY_ID] = array();
             }
             if (!isset($cache[$PROPERTY_ID][$key])) {
                 $cache[$PROPERTY_ID][$key] = call_user_func_array($arUserType["GetPublicViewHTML"], array($arProperty, array("VALUE" => $key), array("MODE" => "SIMPLE_TEXT")));
             }
             $value = $cache[$PROPERTY_ID][$key];
             $sort = 0;
             $url_id = toLower($value);
             break;
         case "Ux":
             if (!isset($cache[$PROPERTY_ID])) {
                 $cache[$PROPERTY_ID] = array();
             }
             if (!isset($cache[$PROPERTY_ID][$key])) {
                 $cache[$PROPERTY_ID][$key] = call_user_func_array($arUserType["GetExtendedValue"], array($arProperty, array("VALUE" => $key)));
             }
             $value = $cache[$PROPERTY_ID][$key]['VALUE'];
             $file_id = $cache[$PROPERTY_ID][$key]['FILE_ID'];
             $sort = isset($cache[$PROPERTY_ID][$key]['SORT']) ? $cache[$PROPERTY_ID][$key]['SORT'] : 0;
             $url_id = toLower($cache[$PROPERTY_ID][$key]['UF_XML_ID']);
             break;
         default:
             $value = $key;
             $sort = 0;
             $url_id = toLower($value);
             break;
     }
     $keyCrc = abs(crc32($htmlKey));
     $safeValue = htmlspecialcharsex($value);
     $sort = (int) $sort;
     $filterPropertyID = $this->SAFE_FILTER_NAME . '_' . $PROPERTY_ID;
     $filterPropertyIDKey = $filterPropertyID . '_' . $keyCrc;
     $resultItem["VALUES"][$htmlKey] = array("CONTROL_ID" => $filterPropertyIDKey, "CONTROL_NAME" => $filterPropertyIDKey, "CONTROL_NAME_ALT" => $filterPropertyID, "HTML_VALUE_ALT" => $keyCrc, "HTML_VALUE" => "Y", "VALUE" => $safeValue, "SORT" => $sort, "UPPER" => ToUpper($safeValue), "FLAG" => $flag);
     if ($file_id) {
         $resultItem["VALUES"][$htmlKey]['FILE'] = CFile::GetFileArray($file_id);
     }
     if ($url_id) {
         $resultItem["VALUES"][$htmlKey]['URL_ID'] = $url_id;
     }
     return $htmlKey;
 }
예제 #28
0
 public static function GetProperty($IBLOCK_ID, $ELEMENT_ID, $by = "sort", $order = "asc", $arFilter = array())
 {
     global $DB;
     if (is_array($by)) {
         if ($order != "asc") {
             $arFilter = $order;
         }
         $arOrder = $by;
     } else {
         $arOrder = false;
     }
     $IBLOCK_ID = intval($IBLOCK_ID);
     $ELEMENT_ID = intval($ELEMENT_ID);
     $VERSION = CIBlockElement::GetIBVersion($IBLOCK_ID);
     $strSqlSearch = "";
     foreach ($arFilter as $key => $val) {
         switch (strtoupper($key)) {
             case "ACTIVE":
                 if ($val == "Y" || $val == "N") {
                     $strSqlSearch .= "AND BP.ACTIVE='" . $val . "'\n";
                 }
                 break;
             case "SEARCHABLE":
                 if ($val == "Y" || $val == "N") {
                     $strSqlSearch .= "AND BP.SEARCHABLE='" . $val . "'\n";
                 }
                 break;
             case "NAME":
                 if (strlen($val) > 0) {
                     $strSqlSearch .= "AND " . CIBLock::_Upper("BP.NAME") . " LIKE " . CIBlock::_Upper("'" . $DB->ForSql($val) . "'") . "\n";
                 }
                 break;
             case "ID":
                 if (is_array($val)) {
                     if (!empty($val)) {
                         $strSqlSearch .= "AND BP.ID in (" . implode(", ", array_map("intval", $val)) . ")\n";
                     }
                 } elseif (strlen($val) > 0) {
                     $strSqlSearch .= "AND BP.ID=" . IntVal($val) . "\n";
                 }
                 break;
             case "PROPERTY_TYPE":
                 if (strlen($val) > 0) {
                     $strSqlSearch .= "AND BP.PROPERTY_TYPE='" . $DB->ForSql($val) . "'\n";
                 }
                 break;
             case "CODE":
                 if (strlen($val) > 0) {
                     $strSqlSearch .= "AND " . CIBLock::_Upper("BP.CODE") . " LIKE " . CIBLock::_Upper("'" . $DB->ForSql($val) . "'") . "\n";
                 }
                 break;
             case "EMPTY":
                 if (strlen($val) > 0) {
                     if ($val == "Y") {
                         $strSqlSearch .= "AND BEP.ID IS NULL\n";
                     } elseif ($VERSION != 2) {
                         $strSqlSearch .= "AND BEP.ID IS NOT NULL\n";
                     }
                 }
                 break;
         }
     }
     $arSqlOrder = array();
     if ($arOrder) {
         foreach ($arOrder as $by => $order) {
             $order = strtolower($order);
             if ($order != "desc") {
                 $order = "asc";
             }
             $by = strtolower($by);
             if ($by == "sort") {
                 $arSqlOrder["BP.SORT"] = $order;
             } elseif ($by == "id") {
                 $arSqlOrder["BP.ID"] = $order;
             } elseif ($by == "name") {
                 $arSqlOrder["BP.NAME"] = $order;
             } elseif ($by == "active") {
                 $arSqlOrder["BP.ACTIVE"] = $order;
             } elseif ($by == "value_id") {
                 $arSqlOrder["BEP.ID"] = $order;
             } elseif ($by == "enum_sort") {
                 $arSqlOrder["BEPE.SORT"] = $order;
             } else {
                 $arSqlOrder["BP.SORT"] = $order;
             }
         }
     } else {
         if ($by == "id") {
             $arSqlOrder["BP.ID"] = "asc";
         } elseif ($by == "name") {
             $arSqlOrder["BP.NAME"] = "asc";
         } elseif ($by == "active") {
             $arSqlOrder["BP.ACTIVE"] = "asc";
         } elseif ($by == "value_id") {
             $arSqlOrder["BEP.ID"] = $order;
         } elseif ($by == "enum_sort") {
             $arSqlOrder["BEPE.SORT"] = $order;
         } else {
             $arSqlOrder["BP.SORT"] = "asc";
             $by = "sort";
         }
         if ($order != "desc") {
             $arSqlOrder["BP.SORT"] = "asc";
             $arSqlOrder["BP.ID"] = "asc";
             $arSqlOrder["BEPE.SORT"] = "asc";
             $arSqlOrder["BEP.ID"] = "asc";
             $order = "asc";
         } else {
             $arSqlOrder["BP.SORT"] = "desc";
             $arSqlOrder["BP.ID"] = "desc";
             $arSqlOrder["BEPE.SORT"] = "desc";
             $arSqlOrder["BEP.ID"] = "desc";
         }
     }
     $strSqlOrder = "";
     foreach ($arSqlOrder as $key => $val) {
         $strSqlOrder .= ", " . $key . " " . $val;
     }
     if ($strSqlOrder != "") {
         $strSqlOrder = ' ORDER BY ' . substr($strSqlOrder, 1);
     }
     if ($VERSION == 2) {
         $strTable = "b_iblock_element_prop_m" . $IBLOCK_ID;
     } else {
         $strTable = "b_iblock_element_property";
     }
     $strSql = "\n\t\t\tSELECT BP.*, BEP.ID as PROPERTY_VALUE_ID, BEP.VALUE, BEP.DESCRIPTION, BEPE.VALUE VALUE_ENUM, BEPE.XML_ID VALUE_XML_ID, BEPE.SORT VALUE_SORT\n\t\t\tFROM b_iblock B\n\t\t\t\tINNER JOIN b_iblock_property BP ON B.ID=BP.IBLOCK_ID\n\t\t\t\tLEFT JOIN " . $strTable . " BEP ON (BP.ID = BEP.IBLOCK_PROPERTY_ID AND BEP.IBLOCK_ELEMENT_ID = " . $ELEMENT_ID . ")\n\t\t\t\tLEFT JOIN b_iblock_property_enum BEPE ON (BP.PROPERTY_TYPE = 'L' AND BEPE.ID=BEP.VALUE_ENUM AND BEPE.PROPERTY_ID=BP.ID)\n\t\t\tWHERE B.ID = " . $IBLOCK_ID . "\n\t\t\t\t" . $strSqlSearch . "\n\t\t\t" . $strSqlOrder;
     if ($VERSION == 2) {
         $result = array();
         $arElements = array();
         $rs = $DB->Query($strSql);
         while ($ar = $rs->Fetch()) {
             if ($ar["VERSION"] == 2 && $ar["MULTIPLE"] == "N") {
                 if (!array_key_exists($ELEMENT_ID, $arElements)) {
                     $strSql = "\n\t\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\t\tFROM b_iblock_element_prop_s" . $ar["IBLOCK_ID"] . "\n\t\t\t\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ELEMENT_ID . "\n\t\t\t\t\t\t";
                     $rs2 = $DB->Query($strSql);
                     $arElements[$ELEMENT_ID] = $rs2->Fetch();
                 }
                 if (!isset($arFilter["EMPTY"]) || $arFilter["EMPTY"] == "Y" || strlen($arElements[$ELEMENT_ID]["PROPERTY_" . $ar["ID"]]) > 0) {
                     $val = $arElements[$ELEMENT_ID]["PROPERTY_" . $ar["ID"]];
                     $ar["PROPERTY_VALUE_ID"] = $ELEMENT_ID . ":" . $ar["ID"];
                     if ($ar["PROPERTY_TYPE"] == "L" && intval($val) > 0) {
                         $arEnum = CIBlockPropertyEnum::GetByID($val);
                         if ($arEnum !== false) {
                             $ar["VALUE_ENUM"] = $arEnum["VALUE"];
                             $ar["VALUE_XML_ID"] = $arEnum["XML_ID"];
                             $ar["VALUE_SORT"] = $arEnum["SORT"];
                         }
                     } else {
                         $ar["VALUE_ENUM"] = "";
                     }
                     if ($ar["PROPERTY_TYPE"] == "N" && strlen($val) > 0) {
                         $val = CIBlock::NumberFormat($val);
                     }
                     $ar["DESCRIPTION"] = $arElements[$ELEMENT_ID]["DESCRIPTION_" . $ar["ID"]];
                     $ar["VALUE"] = $val;
                 } else {
                     continue;
                 }
             }
             if ($arFilter["EMPTY"] == "N" && $ar["PROPERTY_VALUE_ID"] == "") {
                 continue;
             }
             $result[] = $ar;
         }
         $rs = new CIBlockPropertyResult();
         $rs->InitFromArray($result);
     } else {
         $rs = new CIBlockPropertyResult($DB->Query($strSql));
     }
     return $rs;
 }
예제 #29
0
								<?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>
예제 #30
0
 function Fetch()
 {
     /** @global CCacheManager $CACHE_MANAGER */
     global $CACHE_MANAGER;
     /** @global CDatabase $DB */
     global $DB;
     $res = parent::Fetch();
     if (!is_object($this)) {
         return $res;
     }
     $arUpdate = array();
     if ($res) {
         if (is_array($this->arIBlockLongProps)) {
             foreach ($res as $k => $v) {
                 if (preg_match("#^ALIAS_(\\d+)_(.*)\$#", $k, $match)) {
                     $res[$this->arIBlockLongProps[$match[1]] . $match[2]] = $v;
                     unset($res[$k]);
                 }
             }
         }
         if (isset($res["IBLOCK_ID"]) && defined("BX_COMP_MANAGED_CACHE") && $res["IBLOCK_ID"] != $this->_LAST_IBLOCK_ID) {
             CIBlock::registerWithTagCache($res["IBLOCK_ID"]);
             $this->_LAST_IBLOCK_ID = $res["IBLOCK_ID"];
         }
         if (isset($res["ID"]) && $res["ID"] != "" && is_array($this->arIBlockMultProps)) {
             foreach ($this->arIBlockMultProps as $field_name => $db_prop) {
                 if (array_key_exists($field_name, $res)) {
                     if (is_object($res[$field_name])) {
                         $res[$field_name] = $res[$field_name]->load();
                     }
                     if (preg_match("/(_VALUE)\$/", $field_name)) {
                         $descr_name = preg_replace("/(_VALUE)\$/", "_DESCRIPTION", $field_name);
                     } else {
                         $descr_name = preg_replace("/^(PROPERTY_)/", "DESCRIPTION_", $field_name);
                     }
                     if (strlen($res[$field_name]) <= 0) {
                         $strSql = "\n\t\t\t\t\t\t\t\tSELECT VALUE,DESCRIPTION\n\t\t\t\t\t\t\t\tFROM b_iblock_element_prop_m" . $db_prop["IBLOCK_ID"] . "\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tIBLOCK_ELEMENT_ID = " . intval($res["ID"]) . "\n\t\t\t\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID = " . intval($db_prop["ORIG_ID"]) . "\n\t\t\t\t\t\t\t\tORDER BY ID\n\t\t\t\t\t\t\t";
                         $rs = $DB->Query($strSql);
                         $res[$field_name] = array();
                         $res[$descr_name] = array();
                         while ($ar = $rs->Fetch()) {
                             $res[$field_name][] = $ar["VALUE"];
                             $res[$descr_name][] = $ar["DESCRIPTION"];
                         }
                         $arUpdate["b_iblock_element_prop_s" . $db_prop["IBLOCK_ID"]]["PROPERTY_" . $db_prop["ORIG_ID"]] = serialize(array("VALUE" => $res[$field_name], "DESCRIPTION" => $res[$descr_name]));
                     } else {
                         $tmp = unserialize($res[$field_name]);
                         $res[$field_name] = $tmp["VALUE"];
                         $res[$descr_name] = $tmp["DESCRIPTION"];
                     }
                     if (is_array($res[$field_name]) && $db_prop["PROPERTY_TYPE"] == "L") {
                         $arTemp = array();
                         foreach ($res[$field_name] as $key => $val) {
                             $arEnum = CIBlockPropertyEnum::GetByID($val);
                             if ($arEnum !== false) {
                                 $arTemp[$val] = $arEnum["VALUE"];
                             }
                         }
                         $res[$field_name] = $arTemp;
                     }
                 }
             }
             foreach ($arUpdate as $strTable => $arFields) {
                 $strUpdate = $DB->PrepareUpdate($strTable, $arFields);
                 if ($strUpdate != "") {
                     $strSql = "UPDATE " . $strTable . " SET " . $strUpdate . " WHERE IBLOCK_ELEMENT_ID = " . intval($res["ID"]);
                     $DB->QueryBind($strSql, $arFields);
                 }
             }
         }
         if (is_array($this->arIBlockConvProps)) {
             foreach ($this->arIBlockConvProps as $strFieldName => $arCallback) {
                 if (is_array($res[$strFieldName])) {
                     foreach ($res[$strFieldName] as $key => $value) {
                         $arValue = call_user_func_array($arCallback["ConvertFromDB"], array($arCallback["PROPERTY"], array("VALUE" => $value, "DESCRIPTION" => "")));
                         $res[$strFieldName][$key] = $arValue["VALUE"];
                     }
                 } else {
                     $arValue = call_user_func_array($arCallback["ConvertFromDB"], array($arCallback["PROPERTY"], array("VALUE" => $res[$strFieldName], "DESCRIPTION" => "")));
                     $res[$strFieldName] = $arValue["VALUE"];
                 }
             }
         }
         if (is_array($this->arIBlockNumProps)) {
             foreach ($this->arIBlockNumProps as $field_name => $db_prop) {
                 if (strlen($res[$field_name]) > 0) {
                     $res[$field_name] = htmlspecialcharsex(CIBlock::NumberFormat($res[$field_name]));
                 }
             }
         }
         if (isset($res["UC_ID"])) {
             $res["CREATED_BY_FORMATTED"] = CUser::FormatName($this->nameTemplate, array("NAME" => $res["UC_NAME"], "LAST_NAME" => $res["UC_LAST_NAME"], "SECOND_NAME" => $res["UC_SECOND_NAME"], "EMAIL" => $res["UC_EMAIL"], "ID" => $res["UC_ID"], "LOGIN" => $res["UC_LOGIN"]), true, false);
             unset($res["UC_NAME"]);
             unset($res["UC_LAST_NAME"]);
             unset($res["UC_SECOND_NAME"]);
             unset($res["UC_EMAIL"]);
             unset($res["UC_ID"]);
             unset($res["UC_LOGIN"]);
         }
     } elseif (defined("BX_COMP_MANAGED_CACHE") && $this->_LAST_IBLOCK_ID == "" && count($this->_FILTER_IBLOCK_ID)) {
         foreach ($this->_FILTER_IBLOCK_ID as $iblock_id => $t) {
             CIBlock::registerWithTagCache($iblock_id);
         }
     }
     return $res;
 }