本文整理汇总了PHP中CIBlockPropertyEnum::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPropertyEnum::GetByID方法的具体用法?PHP CIBlockPropertyEnum::GetByID怎么用?PHP CIBlockPropertyEnum::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockPropertyEnum
的用法示例。
在下文中一共展示了CIBlockPropertyEnum::GetByID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdatePropertyList
public static function UpdatePropertyList($prop_id, $list)
{
foreach ($list as $id => $arEnum) {
$value = trim($arEnum["VALUE"], " \t\n\r");
if (strlen($value)) {
$dbEnum = CIBlockPropertyEnum::GetByID($id);
if (is_array($dbEnum)) {
$def = isset($arEnum["DEF"]) ? $arEnum["DEF"] : $dbEnum["DEF"];
$sort = intval($arEnum["SORT"]);
if ($dbEnum["VALUE"] != $value || $dbEnum["SORT"] != $sort || $dbEnum["DEF"] != $def) {
$dbEnum["VALUE"] = $value;
$dbEnum["SORT"] = $sort;
$dbEnum["DEF"] = $def;
unset($dbEnum["ID"]);
CIBlockPropertyEnum::Update($id, $dbEnum);
}
} else {
$arEnum["PROPERTY_ID"] = $prop_id;
CIBlockPropertyEnum::Add($arEnum);
}
} else {
CIBlockPropertyEnum::Delete($id);
}
}
}
示例2: onBeforeElementAddHandler
static function onBeforeElementAddHandler($arFields)
{
$IBLOCK_ID = Config\Option::get("citfact.replaceurl", "IBLOCK_ID", "");
$SECTION_ID = Config\Option::get("citfact.replaceurl", "SECTION_BREND_ID", "BRENDI");
$CODE_PROP = Config\Option::get("citfact.replaceurl", "PROPERTY_CODE_BRENDI", "BRENDI");
if ($IBLOCK_ID == $arFields["IBLOCK_ID"]) {
$propertyBrand = \CIBlockProperty::GetByID($CODE_PROP, $arFields["IBLOCK_ID"]);
if ($arResultProperty = $propertyBrand->GetNext()) {
$propertyBrandValue = \CIBlockPropertyEnum::GetByID($arFields["PROPERTY_VALUES"][$arResultProperty["ID"]][0]["VALUE"]);
}
$rqParentSection = \CIBlockSection::GetByID($SECTION_ID);
if ($arParentSection = $rqParentSection->GetNext()) {
$arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
// выберет потомков без учета активности
$rqSectChild = \CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
while ($arSectChild = $rqSectChild->GetNext()) {
$arSections[$arSectChild["NAME"]] = $arSectChild["ID"];
}
}
if (array_key_exists($propertyBrandValue["VALUE"], $arSections)) {
$arFields["IBLOCK_SECTION"][] = $arSections[$propertyBrandValue["VALUE"]];
} else {
$arParams = array("replace_space" => "-", "replace_other" => "-");
$trans = \Cutil::translit($propertyBrandValue["VALUE"], "ru", $arParams);
$bs = new \CIBlockSection();
$arFieldsNewSection = array("ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $SECTION_ID, "IBLOCK_ID" => $IBLOCK_ID, "NAME" => $propertyBrandValue["VALUE"], "CODE" => $trans);
$resultAdd = $bs->Add($arFieldsNewSection);
$arFields["IBLOCK_SECTION"][] = $resultAdd;
}
}
return true;
}
示例3: elseif
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";
示例4: GetProperties
/**
* @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));
}
//.........这里部分代码省略.........
示例5: exportElementProperties
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");
}
}
}
示例6: GetProperty
//.........这里部分代码省略.........
} 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;
}
示例7: Fetch
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)) {
//.........这里部分代码省略.........
示例8: fillItemValues
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":
//.........这里部分代码省略.........
示例9: ExportElements
//.........这里部分代码省略.........
"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;
fwrite($this->fp, "\t\t\t\t\t<".GetMessage("IBLOCK_XML2_PROPERTY_VALUES").">\n");
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");
}
}
示例10: intval
$ar_Debug["FIRST_TO"][] = "\$currentRun : $currentRun";
$propramTOID = intval ( $_REQUEST['programTO'] );
$chId = intval ( $_REQUEST['chassis'] );
$run_at_year = intval ( $_REQUEST['run_at_year'] );
/* get correct value from Enum Type properties */
$d = CIBlockPropertyEnum::GetByID( intval ( $_REQUEST['years_of_work']) );
$years_of_work = $d["XML_ID"] / 12 ;
$cntrct_transport_task = intval ( $_REQUEST["task"]) ;
$cntrct_type = intval ( $_REQUEST["type"] );
$d = CIBlockPropertyEnum::GetByID( intval( $_REQUEST["exclude_washing"]) );
$with_out_washing = ( $d["XML_ID"] == "N" )? true:false ;
if ( $chId > 0 && $run_at_year > 0 && $years_of_work > 0 ){
$discount = floatval($_REQUEST["discount"]);
$params = array ( "CURRENT_RUN" => $currentRun, "WASHING" => $with_out_washing, "RUN_AT_YEAR" => $run_at_year,"YEARS_OF_WORK" => $years_of_work );
try{
$result ["TO"] = GetTO( $propramTOID, $chId, true, $with_out_washing );
calcCostTOWorks( $result ["TO"] );
countTO ( $result["TO"] , $years_of_work * $run_at_year, $currentRun );
calcByTo ( $result , $run_at_year, $years_of_work , $currentRun );
}catch(exception $e){