本文整理汇总了PHP中CIBlockProperty::GetUserType方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty::GetUserType方法的具体用法?PHP CIBlockProperty::GetUserType怎么用?PHP CIBlockProperty::GetUserType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockProperty
的用法示例。
在下文中一共展示了CIBlockProperty::GetUserType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init
private static function _init()
{
if (count(self::$types) == 0) {
self::$types = array();
//Element fields
self::$types["NAME"] = new CListFieldType("NAME", GetMessage("LISTS_LIST_FIELD_NAME"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["SORT"] = new CListFieldType("SORT", GetMessage("LISTS_LIST_FIELD_SORT"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["ACTIVE_FROM"] = new CListFieldType("ACTIVE_FROM", GetMessage("LISTS_LIST_FIELD_ACTIVE_FROM"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["ACTIVE_TO"] = new CListFieldType("ACTIVE_TO", GetMessage("LISTS_LIST_FIELD_ACTIVE_TO"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["PREVIEW_PICTURE"] = new CListFieldType("PREVIEW_PICTURE", GetMessage("LISTS_LIST_FIELD_PREVIEW_PICTURE"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["PREVIEW_TEXT"] = new CListFieldType("PREVIEW_TEXT", GetMessage("LISTS_LIST_FIELD_PREVIEW_TEXT"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["DETAIL_PICTURE"] = new CListFieldType("DETAIL_PICTURE", GetMessage("LISTS_LIST_FIELD_DETAIL_PICTURE"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["DETAIL_TEXT"] = new CListFieldType("DETAIL_TEXT", GetMessage("LISTS_LIST_FIELD_DETAIL_TEXT"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
self::$types["DATE_CREATE"] = new CListFieldType("DATE_CREATE", GetMessage("LISTS_LIST_FIELD_DATE_CREATE"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
self::$types["CREATED_BY"] = new CListFieldType("CREATED_BY", GetMessage("LISTS_LIST_FIELD_CREATED_BY"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
self::$types["TIMESTAMP_X"] = new CListFieldType("TIMESTAMP_X", GetMessage("LISTS_LIST_FIELD_TIMESTAMP_X"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
self::$types["MODIFIED_BY"] = new CListFieldType("MODIFIED_BY", GetMessage("LISTS_LIST_FIELD_MODIFIED_BY"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
//Property types
self::$types["S"] = new CListFieldType("S", GetMessage("LISTS_LIST_FIELD_S"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
self::$types["N"] = new CListFieldType("N", GetMessage("LISTS_LIST_FIELD_N"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
self::$types["L"] = new CListFieldType("L", GetMessage("LISTS_LIST_FIELD_L"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
self::$types["F"] = new CListFieldType("F", GetMessage("LISTS_LIST_FIELD_F"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
self::$types["G"] = new CListFieldType("G", GetMessage("LISTS_LIST_FIELD_G"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
self::$types["E"] = new CListFieldType("E", GetMessage("LISTS_LIST_FIELD_E"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
//User types
foreach (CIBlockProperty::GetUserType() as $ar) {
if (array_key_exists("GetPublicEditHTML", $ar)) {
self::$types[$ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"]] = new CListFieldType($ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"], $ar["DESCRIPTION"], CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
}
}
}
}
示例2: GetPropsTypesByOperations
public static function GetPropsTypesByOperations($userType = false, $arOperations = array())
{
if (!is_array($arOperations)) {
$arOperations = array(strval($arOperations));
}
$methodByOperation = array('view' => 'GetPublicViewHTML', 'edit' => 'GetPublicEditHTML', 'filter' => 'GetPublicFilterHTML', 'import' => 'GetPublicEditHTML', 'rest' => 'GetPublicEditHTML');
$whiteListByOperation = array('view' => array(), 'edit' => array(), 'filter' => array(), 'import' => array('S:HTML', 'S:Date', 'S:DateTime', 'S:employee', 'N:Sequence'), 'rest' => array('S:HTML', 'S:Date', 'S:DateTime', 'S:employee', 'E:EList', 'N:Sequence'));
$arUserTypeList = CIBlockProperty::GetUserType($userType);
if (!empty($arOperations)) {
foreach ($arUserTypeList as $key => $item) {
$skipNumber = count($arOperations);
$skipCount = 0;
foreach ($arOperations as $operation) {
if (!isset($methodByOperation[$operation]) || !array_key_exists($methodByOperation[$operation], $item) || is_array($whiteListByOperation[$operation]) && count($whiteListByOperation[$operation]) > 0 && !in_array($item['PROPERTY_TYPE'] . ':' . $key, $whiteListByOperation[$operation], true)) {
$skipCount++;
}
}
if ($skipNumber <= $skipCount) {
unset($arUserTypeList[$key]);
}
}
}
return $arUserTypeList;
}
示例3: SetPropertyValuesEx
public static function SetPropertyValuesEx($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $FLAGS = array())
{
//Check input parameters
if (!is_array($PROPERTY_VALUES)) {
return;
}
if (!is_array($FLAGS)) {
$FLAGS = array();
}
//FLAGS - modify function behavior
//NewElement - if present no db values select will be issued
//DoNotValidateLists - if present list values do not validates against metadata tables
global $DB;
$ELEMENT_ID = intval($ELEMENT_ID);
if ($ELEMENT_ID <= 0) {
return;
}
$IBLOCK_ID = intval($IBLOCK_ID);
if ($IBLOCK_ID <= 0) {
$rs = $DB->Query("select IBLOCK_ID from b_iblock_element where ID=" . $ELEMENT_ID);
if ($ar = $rs->Fetch()) {
$IBLOCK_ID = $ar["IBLOCK_ID"];
} else {
return;
}
}
//Get property metadata
static $PROPS_CACHE = array();
if (!array_key_exists($IBLOCK_ID, $PROPS_CACHE)) {
$PROPS_CACHE[$IBLOCK_ID] = array(0 => array());
$rs = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "N", "ACTIVE" => "Y"));
while ($ar = $rs->Fetch()) {
$ar["ConvertToDB"] = false;
if ($ar["USER_TYPE"] != "") {
$arUserType = CIBlockProperty::GetUserType($ar["USER_TYPE"]);
if (array_key_exists("ConvertToDB", $arUserType)) {
$ar["ConvertToDB"] = $arUserType["ConvertToDB"];
}
}
$PROPS_CACHE[$IBLOCK_ID][$ar["ID"]] = $ar;
//For CODE2ID conversion
$PROPS_CACHE[$IBLOCK_ID][0][$ar["CODE"]] = $ar["ID"];
//VERSION
$PROPS_CACHE[$IBLOCK_ID]["VERSION"] = $ar["VERSION"];
}
}
//Unify properties values arProps[$property_id]=>array($id=>array("VALUE", "DESCRIPTION"),....)
$arProps = array();
foreach ($PROPERTY_VALUES as $key => $value) {
//Code2ID
if (array_key_exists($key, $PROPS_CACHE[$IBLOCK_ID][0])) {
$key = $PROPS_CACHE[$IBLOCK_ID][0][$key];
} else {
$key = intval($key);
if ($key <= 0 || !array_key_exists($key, $PROPS_CACHE[$IBLOCK_ID])) {
continue;
}
}
if ($PROPS_CACHE[$IBLOCK_ID][$key]["PROPERTY_TYPE"] == "F") {
if (is_array($value)) {
$ar = array_keys($value);
if (array_key_exists("tmp_name", $value) || array_key_exists("del", $value)) {
$uni_value = array(array("ID" => 0, "VALUE" => $value, "DESCRIPTION" => ""));
} elseif ($ar[0] === "VALUE" && $ar[1] === "DESCRIPTION") {
$uni_value = array(array("ID" => 0, "VALUE" => $value["VALUE"], "DESCRIPTION" => $value["DESCRIPTION"]));
} elseif (count($ar) === 1 && $ar[0] === "VALUE") {
$uni_value = array(array("ID" => 0, "VALUE" => $value["VALUE"], "DESCRIPTION" => ""));
} else {
$uni_value = array();
foreach ($value as $id => $val) {
if (is_array($val)) {
if (array_key_exists("tmp_name", $val) || array_key_exists("del", $val)) {
$uni_value[] = array("ID" => $id, "VALUE" => $val, "DESCRIPTION" => "");
} else {
$ar = array_keys($val);
if ($ar[0] === "VALUE" && $ar[1] === "DESCRIPTION") {
$uni_value[] = array("ID" => $id, "VALUE" => $val["VALUE"], "DESCRIPTION" => $val["DESCRIPTION"]);
} elseif (count($ar) === 1 && $ar[0] === "VALUE") {
$uni_value[] = array("ID" => $id, "VALUE" => $val["VALUE"], "DESCRIPTION" => "");
}
}
}
}
}
} else {
//There was no valid file array found so we'll skip this property
$uni_value = array();
}
} elseif (!is_array($value)) {
$uni_value = array(array("VALUE" => $value, "DESCRIPTION" => ""));
} else {
$ar = array_keys($value);
if (count($ar) === 2 && $ar[0] === "VALUE" && $ar[1] === "DESCRIPTION") {
$uni_value = array(array("VALUE" => $value["VALUE"], "DESCRIPTION" => $value["DESCRIPTION"]));
} elseif (count($ar) === 1 && $ar[0] === "VALUE") {
$uni_value = array(array("VALUE" => $value["VALUE"], "DESCRIPTION" => ""));
} else {
$uni_value = array();
foreach ($value as $id => $val) {
if (!is_array($val)) {
//.........这里部分代码省略.........
示例4: GetTypesCreate
public static function GetTypesCreate()
{
if (!self::$arTypesCreateList) {
self::$arTypesCreateList = array("S" => GetMessage("SP_LIST_FIELD_S"), "N" => GetMessage("SP_LIST_FIELD_N"), "L" => GetMessage("SP_LIST_FIELD_L"), "F" => GetMessage("SP_LIST_FIELD_F"), "G" => GetMessage("SP_LIST_FIELD_G"), "E" => GetMessage("SP_LIST_FIELD_E"));
//User types
foreach (CIBlockProperty::GetUserType() as $ar) {
if (array_key_exists("GetPublicEditHTML", $ar)) {
self::$arTypesCreateList[$ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"]] = $ar["DESCRIPTION"];
}
}
}
return self::$arTypesCreateList;
}
示例5: GetDisplayValue
public static function GetDisplayValue($arItem, $arProperty, $event1)
{
static $installedStatictic = null;
if (null === $installedStatictic)
{
$installedStatictic = \Freetrix\Main\ModuleManager::isModuleInstalled('statistic');
}
$arUserTypeFormat = false;
if(isset($arProperty["USER_TYPE"]) && !empty($arProperty["USER_TYPE"]))
{
$arUserType = CIBlockProperty::GetUserType($arProperty["USER_TYPE"]);
if(isset($arUserType["GetPublicViewHTML"]))
$arUserTypeFormat = $arUserType["GetPublicViewHTML"];
}
static $CACHE = array("E"=>array(),"G"=>array());
if($arUserTypeFormat)
{
if($arProperty["MULTIPLE"]=="N" || !is_array($arProperty["~VALUE"]))
$arValues = array($arProperty["~VALUE"]);
else
$arValues = $arProperty["~VALUE"];
}
else
{
if(is_array($arProperty["VALUE"]))
$arValues = $arProperty["VALUE"];
else
$arValues = array($arProperty["VALUE"]);
}
$arDisplayValue = array();
$arFiles = array();
$arLinkElements = array();
$arLinkSections = array();
foreach($arValues as $val)
{
if($arUserTypeFormat)
{
$arDisplayValue[] = call_user_func_array($arUserTypeFormat,
array(
$arProperty,
array("VALUE" => $val),
array(),
));
}
elseif($arProperty["PROPERTY_TYPE"] == "E")
{
if(intval($val) > 0)
{
if(!isset($CACHE["E"][$val]))
{
//USED TO GET "LINKED" ELEMENTS
$arLinkFilter = array (
"ID" => $val,
"ACTIVE" => "Y",
"ACTIVE_DATE" => "Y",
"CHECK_PERMISSIONS" => "Y",
);
$rsLink = CIBlockElement::GetList(
array(),
$arLinkFilter,
false,
false,
array("ID","IBLOCK_ID","NAME","DETAIL_PAGE_URL", "PREVIEW_PICTURE", "DETAIL_PUCTURE")
);
$CACHE["E"][$val] = $rsLink->GetNext();
}
if(is_array($CACHE["E"][$val]))
{
$arDisplayValue[]='<a href="'.$CACHE["E"][$val]["DETAIL_PAGE_URL"].'">'.$CACHE["E"][$val]["NAME"].'</a>';
$arLinkElements[$val] = $CACHE["E"][$val];
}
}
}
elseif($arProperty["PROPERTY_TYPE"] == "G")
{
if(intval($val) > 0)
{
if(!isset($CACHE["G"][$val]))
{
//USED TO GET SECTIONS NAMES
$arSectionFilter = array (
"ID" => $val,
);
$rsSection = CIBlockSection::GetList(
array(),
$arSectionFilter,
false,
array("ID", "IBLOCK_ID", "NAME", "SECTION_PAGE_URL", "PICTURE", "DETAIL_PICTURE")
);
$CACHE["G"][$val] = $rsSection->GetNext();
}
if(is_array($CACHE["G"][$val]))
{
$arDisplayValue[]='<a href="'.$CACHE["G"][$val]["SECTION_PAGE_URL"].'">'.$CACHE["G"][$val]["NAME"].'</a>';
$arLinkSections[$val] = $CACHE["G"][$val];
}
}
}
elseif($arProperty["PROPERTY_TYPE"]=="L")
//.........这里部分代码省略.........
示例6: GetOfferProperties
public static function GetOfferProperties($offerID, $iblockID, $propertiesList, $skuTreeProps = '')
{
$iblockInfo = false;
$result = array();
$iblockID = intval($iblockID);
$offerID = intval($offerID);
if (0 >= $iblockID || 0 >= $offerID)
return $result;
$skuPropsList = array();
if (!empty($skuTreeProps))
{
if (is_array($skuTreeProps))
{
$skuPropsList = $skuTreeProps;
}
else
{
$skuTreeProps = base64_decode((string)$skuTreeProps);
if (false !== $skuTreeProps && CheckSerializedData($skuTreeProps))
{
$skuPropsList = unserialize($skuTreeProps);
if (!is_array($skuPropsList))
{
$skuPropsList = array();
}
}
}
}
if (!is_array($propertiesList))
{
$propertiesList = array();
}
if (!empty($skuPropsList))
{
$propertiesList = array_unique(array_merge($propertiesList, $skuPropsList));
}
if (empty($propertiesList))
return $result;
$propCodes = array_fill_keys($propertiesList, true);
if (self::$catalogIncluded === null)
self::$catalogIncluded = \Freetrix\Main\Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
$iblockInfo = CCatalogSKU::GetInfoByProductIBlock($iblockID);
}
if (empty($iblockInfo))
return $result;
$sortIndex = 1;
$rsProps = CIBlockElement::GetProperty(
$iblockInfo['IBLOCK_ID'],
$offerID,
array("sort"=>"asc", "enum_sort" => "asc", "value_id"=>"asc"),
array("EMPTY"=>"N")
);
while ($oneProp = $rsProps->Fetch())
{
if (!isset($propCodes[$oneProp['CODE']]) && !isset($propCodes[$oneProp['ID']]))
continue;
$propID = (isset($propCodes[$oneProp['CODE']]) ? $oneProp['CODE'] : $oneProp['ID']);
$userTypeProp = false;
$userType = null;
if (isset($oneProp['USER_TYPE']) && !empty($oneProp['USER_TYPE']))
{
$userTypeDescr = CIBlockProperty::GetUserType($oneProp['USER_TYPE']);
if (isset($userTypeDescr['GetPublicViewHTML']))
{
$userTypeProp = true;
$userType = $userTypeDescr['GetPublicViewHTML'];
}
}
if ($userTypeProp)
{
$displayValue = (string)call_user_func_array($userType,
array(
$oneProp,
array('VALUE' => $oneProp['VALUE']),
array('MODE' => 'SIMPLE_TEXT')
));
$result[] = array(
"NAME" => $oneProp["NAME"],
"CODE" => $propID,
"VALUE" => $displayValue,
"SORT" => $sortIndex++,
);
}
else
{
switch ($oneProp["PROPERTY_TYPE"])
{
case "S":
case "N":
$result[] = array(
//.........这里部分代码省略.........
示例7: GetDocumentFieldTypes
public function GetDocumentFieldTypes($documentType)
{
$iblockId = intval(substr($documentType, strlen("iblock_")));
if ($iblockId <= 0) {
throw new CBPArgumentOutOfRangeException("documentType", $documentType);
}
$arResult = array("string" => array("Name" => GetMessage("BPCGHLP_PROP_STRING"), "BaseType" => "string"), "text" => array("Name" => GetMessage("BPCGHLP_PROP_TEXT"), "BaseType" => "text"), "int" => array("Name" => GetMessage("BPCGHLP_PROP_INT"), "BaseType" => "int"), "double" => array("Name" => GetMessage("BPCGHLP_PROP_DOUBLE"), "BaseType" => "double"), "select" => array("Name" => GetMessage("BPCGHLP_PROP_SELECT"), "BaseType" => "select", "Complex" => true), "bool" => array("Name" => GetMessage("BPCGHLP_PROP_BOOL"), "BaseType" => "bool"), "date" => array("Name" => GetMessage("BPCGHLP_PROP_DATA"), "BaseType" => "date"), "datetime" => array("Name" => GetMessage("BPCGHLP_PROP_DATETIME"), "BaseType" => "datetime"), "user" => array("Name" => GetMessage("BPCGHLP_PROP_USER"), "BaseType" => "user"), "file" => array("Name" => GetMessage("BPCGHLP_PROP_FILE"), "BaseType" => "file"));
foreach (CIBlockProperty::GetUserType() as $ar) {
$t = $ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"];
if (COption::GetOptionString("bizproc", "SkipNonPublicCustomTypes", "N") == "Y" && !array_key_exists("GetPublicEditHTML", $ar) || $t == "S:UserID" || $t == "S:DateTime") {
continue;
}
$arResult[$t] = array("Name" => $ar["DESCRIPTION"], "BaseType" => "string");
if ($t == "S:UserID") {
$arResult[$t]["BaseType"] = "user";
} elseif ($t == "S:employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
$arResult[$t]["BaseType"] = "user";
} elseif ($t == "S:DateTime") {
$arResult[$t]["BaseType"] = "datetime";
} elseif ($t == "E:EList") {
$arResult[$t]["BaseType"] = "string";
$arResult[$t]["Complex"] = true;
} elseif (!array_key_exists("GetPublicEditHTML", $ar)) {
continue;
}
}
return $arResult;
}
示例8: SetPropertyValues
function SetPropertyValues($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $PROPERTY_CODE = false)
{
global $DB;
$ELEMENT_ID = intVal($ELEMENT_ID);
if (!is_array($PROPERTY_VALUES)) {
$PROPERTY_VALUES = array($PROPERTY_VALUES);
}
$arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "N");
if ($PROPERTY_CODE !== false) {
if (IntVal($PROPERTY_CODE) > 0) {
$arFilter["ID"] = IntVal($PROPERTY_CODE);
} else {
$arFilter["CODE"] = $PROPERTY_CODE;
}
} else {
$arFilter["ACTIVE"] = "Y";
}
$uniq_flt = md5(serialize($arFilter));
global $BX_IBLOCK_PROP_CACHE;
if (!is_set($BX_IBLOCK_PROP_CACHE, $IBLOCK_ID)) {
$BX_IBLOCK_PROP_CACHE[$IBLOCK_ID] = array();
}
if (is_set($BX_IBLOCK_PROP_CACHE[$IBLOCK_ID], $uniq_flt)) {
$ar_prop =& $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt];
} else {
$db_prop = CIBlockProperty::GetList(array(), $arFilter);
$ar_prop = array();
while ($prop = $db_prop->Fetch()) {
$ar_prop[] = $prop;
}
$BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt] =& $ar_prop;
}
Reset($ar_prop);
$bRecalcSections = false;
$arPROP_ID = array_keys($PROPERTY_VALUES);
$cacheValues = false;
if (count($ar_prop) > 1) {
$cacheValues = array();
$strSql = "SELECT ep.ID, ep.VALUE, ep.IBLOCK_PROPERTY_ID " . "FROM b_iblock_element_property ep, b_iblock_property p " . "WHERE ep.IBLOCK_ELEMENT_ID=" . $ELEMENT_ID . "\tAND ep.IBLOCK_PROPERTY_ID = p.ID " . "\tAND p.PROPERTY_TYPE <> 'L' " . "\tAND p.PROPERTY_TYPE <> 'G' ";
$db_res = $DB->Query($strSql);
while ($res = $db_res->Fetch()) {
if (!isset($cacheValues[$res["IBLOCK_PROPERTY_ID"]])) {
$cacheValues[$res["IBLOCK_PROPERTY_ID"]] = array();
}
$cacheValues[$res["IBLOCK_PROPERTY_ID"]][] = $res;
}
}
$ids = "0";
foreach ($ar_prop as $prop) {
if ($PROPERTY_CODE) {
$PROP = $PROPERTY_VALUES;
} else {
if (strlen($prop["CODE"]) > 0 && in_array($prop["CODE"], $arPROP_ID, TRUE)) {
$PROP = $PROPERTY_VALUES[$prop["CODE"]];
} else {
$PROP = $PROPERTY_VALUES[$prop["ID"]];
}
}
if ($prop["PROPERTY_TYPE"] == "F") {
if (!is_array($PROP) || is_array($PROP) && (is_set($PROP, "tmp_name") || is_set($PROP, "del")) || count($PROP) == 2 && is_set($PROP, "VALUE") && is_set($PROP, "DESCRIPTION")) {
$PROP = array($PROP);
}
} elseif (!is_array($PROP) || count($PROP) == 2 && is_set($PROP, "VALUE") && is_set($PROP, "DESCRIPTION")) {
$PROP = array($PROP);
}
if ($prop["USER_TYPE"] != "") {
$arUserType = CIBlockProperty::GetUserType($prop["USER_TYPE"]);
if (array_key_exists("ConvertToDB", $arUserType)) {
foreach ($PROP as $key => $value) {
if (!is_array($value)) {
$value = array("VALUE" => $value);
} elseif (!array_key_exists("VALUE", $value)) {
$value = array("VALUE" => $value);
}
$PROP[$key] = call_user_func_array($arUserType["ConvertToDB"], array($prop, $value));
}
}
}
if ($prop["VERSION"] == 2) {
if ($prop["MULTIPLE"] == "Y") {
$strTable = "b_iblock_element_prop_m" . $prop["IBLOCK_ID"];
} else {
$strTable = "b_iblock_element_prop_s" . $prop["IBLOCK_ID"];
}
} else {
$strTable = "b_iblock_element_property";
}
if ($prop["PROPERTY_TYPE"] == "L") {
$DB->Query(CIBLockElement::DeletePropertySQL($prop, $ELEMENT_ID), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($prop["VERSION"] == 2 && $prop["MULTIPLE"] == "Y") {
$strSql = "\n\t\t\t\t\t\tUPDATE\tb_iblock_element_prop_s" . $prop["IBLOCK_ID"] . "\n\t\t\t\t\t\tSET\tPROPERTY_" . $prop["ID"] . "=NULL, DESCRIPTION_" . $prop["ID"] . "=NULL\n\t\t\t\t\t\tWHERE\tIBLOCK_ELEMENT_ID=" . $ELEMENT_ID . "\n\t\t\t\t\t";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
$ids = "0";
foreach ($PROP as $key => $value) {
if (is_array($value)) {
$value = $value["VALUE"];
}
if (IntVal($value) <= 0) {
continue;
//.........这里部分代码省略.........
示例9: SetPropertyValues
//.........这里部分代码省略.........
$rs = $DB->Query("\n\t\t\t\tselect *\n\t\t\t\tfrom b_iblock_element_property\n\t\t\t\twhere IBLOCK_ELEMENT_ID = " . $ELEMENT_ID . "\n\t\t\t\torder by ID asc\n\t\t\t");
while ($ar = $rs->Fetch()) {
$property_id = $ar["IBLOCK_PROPERTY_ID"];
if (!isset($arDBProps[$property_id])) {
$arDBProps[$property_id] = array();
}
$arDBProps[$property_id][$ar["ID"]] = $ar;
}
unset($ar);
unset($rs);
}
foreach (GetModuleEvents("iblock", "OnIBlockElementSetPropertyValues", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $PROPERTY_CODE, $ar_prop, $arDBProps));
}
if (isset($arEvent)) {
unset($arEvent);
}
$arFilesToDelete = array();
$arV2ClearCache = array();
foreach ($ar_prop as $prop) {
if ($PROPERTY_CODE) {
$PROP = $PROPERTY_VALUES;
} else {
if (strlen($prop["CODE"]) > 0 && array_key_exists($prop["CODE"], $PROPERTY_VALUES)) {
$PROP = $PROPERTY_VALUES[$prop["CODE"]];
} else {
$PROP = $PROPERTY_VALUES[$prop["ID"]];
}
}
if (!is_array($PROP) || $prop["PROPERTY_TYPE"] == "F" && (array_key_exists("tmp_name", $PROP) || array_key_exists("del", $PROP)) || count($PROP) == 2 && array_key_exists("VALUE", $PROP) && array_key_exists("DESCRIPTION", $PROP)) {
$PROP = array($PROP);
}
if ($prop["USER_TYPE"] != "") {
$arUserType = CIBlockProperty::GetUserType($prop["USER_TYPE"]);
if (array_key_exists("ConvertToDB", $arUserType)) {
foreach ($PROP as $key => $value) {
if (!is_array($value) || !array_key_exists("VALUE", $value)) {
$value = array("VALUE" => $value);
}
$prop["ELEMENT_ID"] = $ELEMENT_ID;
$PROP[$key] = call_user_func_array($arUserType["ConvertToDB"], array($prop, $value));
}
}
}
if ($prop["VERSION"] == 2) {
if ($prop["MULTIPLE"] == "Y") {
$strTable = "b_iblock_element_prop_m" . $prop["IBLOCK_ID"];
} else {
$strTable = "b_iblock_element_prop_s" . $prop["IBLOCK_ID"];
}
} else {
$strTable = "b_iblock_element_property";
}
if ($prop["PROPERTY_TYPE"] == "L") {
$DB->Query(CIBLockElement::DeletePropertySQL($prop, $ELEMENT_ID));
if ($prop["VERSION"] == 2 && $prop["MULTIPLE"] == "Y") {
$arV2ClearCache[$prop["ID"]] = "PROPERTY_" . $prop["ID"] . " = NULL" . self::__GetDescriptionUpdateSql($prop["IBLOCK_ID"], $prop["ID"]);
}
$ids = "0";
foreach ($PROP as $key => $value) {
if (is_array($value)) {
$value = intval($value["VALUE"]);
} else {
$value = intval($value);
}
if ($value <= 0) {
示例10: GetDocumentFieldTypes
public function GetDocumentFieldTypes($documentType)
{
$v = substr($documentType, strlen("type_"));
if (intval($v) . "!" != $v . "!") {
throw new CBPArgumentOutOfRangeException("documentType", $documentType);
}
$iblockId = intval($v);
$arResult = array("S" => array("Name" => GetMessage("BPVDX_STRING"), "BaseType" => "string"), "T" => array("Name" => GetMessage("BPVDX_TEXT"), "BaseType" => "text"), "N" => array("Name" => GetMessage("BPVDX_NUM"), "BaseType" => "double"), "L" => array("Name" => GetMessage("BPVDX_LIST"), "BaseType" => "select", "Complex" => true), "F" => array("Name" => GetMessage("BPVDX_FILE"), "BaseType" => "file"), "B" => array("Name" => GetMessage("BPVDX_YN"), "BaseType" => "bool"));
foreach (CIBlockProperty::GetUserType() as $ar) {
$t = $ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"];
if (COption::GetOptionString("bizproc", "SkipNonPublicCustomTypes", "N") == "Y" && !array_key_exists("GetPublicEditHTML", $ar) && $t != "S:UserID" && $t != "S:DateTime") {
continue;
}
$arResult[$t] = array("Name" => $ar["DESCRIPTION"], "BaseType" => "string");
if ($t == "S:UserID") {
$arResult[$t]["BaseType"] = "user";
} elseif ($t == "S:employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
$arResult[$t]["BaseType"] = "user";
} elseif ($t == "S:DateTime") {
$arResult[$t]["BaseType"] = "datetime";
} elseif ($t == "E:EList") {
$arResult[$t]["BaseType"] = "string";
$arResult[$t]["Complex"] = true;
} elseif (!array_key_exists("GetPublicEditHTML", $ar)) {
continue;
}
}
return $arResult;
}
示例11: setIBlock
function setIBlock($IBLOCK_ID, $propertyID = array())
{
$this->VERSION = CIBlockElement::GetIBVersion($IBLOCK_ID);
if (!empty($propertyID)) {
Collection::normalizeArrayValuesByInt($propertyID);
}
$this->arProperties = array();
if (!empty($propertyID) || empty($propertyID) && !isset(self::$propertiesCache[$IBLOCK_ID])) {
$propertyIterator = PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID', 'NAME', 'ACTIVE', 'SORT', 'CODE', 'DEFAULT_VALUE', 'PROPERTY_TYPE', 'MULTIPLE', 'LINK_IBLOCK_ID', 'VERSION', 'USER_TYPE', 'USER_TYPE_SETTINGS'), 'filter' => empty($propertyID) ? array('IBLOCK_ID' => $IBLOCK_ID) : array('ID' => $propertyID, 'IBLOCK_ID' => $IBLOCK_ID), 'order' => array('ID' => 'ASC')));
while ($property = $propertyIterator->fetch()) {
if ($property['USER_TYPE']) {
$userType = CIBlockProperty::GetUserType($property['USER_TYPE']);
if (isset($userType["ConvertFromDB"])) {
if (array_key_exists("DEFAULT_VALUE", $property)) {
$value = array("VALUE" => $property["DEFAULT_VALUE"], "DESCRIPTION" => "");
$value = call_user_func_array($userType["ConvertFromDB"], array($property, $value));
$property["DEFAULT_VALUE"] = $value["VALUE"];
}
}
}
if ($property['USER_TYPE_SETTINGS'] !== '' || $property['USER_TYPE_SETTINGS'] !== null) {
$property['USER_TYPE_SETTINGS'] = unserialize($property['USER_TYPE_SETTINGS']);
}
$this->arProperties[$property['ID']] = $property;
}
unset($property, $propertyIterator);
if (empty($propertyID)) {
self::$propertiesCache[$IBLOCK_ID] = $this->arProperties;
}
} else {
$this->arProperties = self::$propertiesCache[$IBLOCK_ID];
}
}
示例12: 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":
//.........这里部分代码省略.........
示例13: __AddPropCellType
function __AddPropCellType($intOFPropID, $strPrefix, $arPropInfo)
{
$strResult = '';
ob_start();
?>
<select name="<?php
echo $strPrefix . $intOFPropID;
?>
_PROPERTY_TYPE" id="<?php
echo $strPrefix . $intOFPropID;
?>
_PROPERTY_TYPE" style="width:150px">
<option value="S" <?php
if ($arPropInfo['PROPERTY_TYPE'] == "S" && !$arPropInfo['USER_TYPE']) {
echo " selected";
}
?>
><?php
echo GetMessage("IB_E_PROP_TYPE_S");
?>
</option>
<option value="N" <?php
if ($arPropInfo['PROPERTY_TYPE'] == "N" && !$arPropInfo['USER_TYPE']) {
echo " selected";
}
?>
><?php
echo GetMessage("IB_E_PROP_TYPE_N");
?>
</option>
<option value="L" <?php
if ($arPropInfo['PROPERTY_TYPE'] == "L" && !$arPropInfo['USER_TYPE']) {
echo " selected";
}
?>
><?php
echo GetMessage("IB_E_PROP_TYPE_L");
?>
</option>
<option value="F" <?php
if ($arPropInfo['PROPERTY_TYPE'] == "F" && !$arPropInfo['USER_TYPE']) {
echo " selected";
}
?>
><?php
echo GetMessage("IB_E_PROP_TYPE_F");
?>
</option>
<option value="G" <?php
if ($arPropInfo['PROPERTY_TYPE'] == "G" && !$arPropInfo['USER_TYPE']) {
echo " selected";
}
?>
><?php
echo GetMessage("IB_E_PROP_TYPE_G");
?>
</option>
<option value="E" <?php
if ($arPropInfo['PROPERTY_TYPE'] == "E" && !$arPropInfo['USER_TYPE']) {
echo " selected";
}
?>
><?php
echo GetMessage("IB_E_PROP_TYPE_E");
?>
</option>
<?php
foreach (CIBlockProperty::GetUserType() as $ar) {
?>
<option value="<?php
echo htmlspecialcharsbx($ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"]);
?>
" <?php
if ($arPropInfo['PROPERTY_TYPE'] == $ar["PROPERTY_TYPE"] && $arPropInfo['USER_TYPE'] == $ar["USER_TYPE"]) {
echo " selected";
}
?>
><?php
echo htmlspecialcharsbx($ar["DESCRIPTION"]);
?>
</option>
<?php
}
?>
</select><?php
$strResult = ob_get_contents();
ob_end_clean();
return $strResult;
}
示例14: foreach
$arUpdateValues["DETAIL_TEXT_TYPE"] = "text";
}
if ($propertyID == "PREVIEW_TEXT") {
$arUpdateValues["PREVIEW_TEXT_TYPE"] = "text";
}
$arUpdateValues[$propertyID] = $arProperties[$propertyID][0];
}
}
}
}
// check required properties
foreach ($arParams["PROPERTY_CODES_REQUIRED"] as $key => $propertyID) {
$bError = false;
$propertyValue = intval($propertyID) > 0 ? $arUpdatePropertyValues[$propertyID] : $arUpdateValues[$propertyID];
if ($arResult["PROPERTY_LIST_FULL"][$propertyID]["USER_TYPE"] != "") {
$arUserType = CIBlockProperty::GetUserType($arResult["PROPERTY_LIST_FULL"][$propertyID]["USER_TYPE"]);
} else {
$arUserType = array();
}
//Files check
if ($arResult["PROPERTY_LIST_FULL"][$propertyID]['PROPERTY_TYPE'] == 'F') {
//New element
if ($arParams["ID"] <= 0) {
$bError = true;
if (is_array($propertyValue)) {
if (array_key_exists("tmp_name", $propertyValue) && array_key_exists("size", $propertyValue)) {
if ($propertyValue['size'] > 0) {
$bError = false;
}
} else {
foreach ($propertyValue as $arFile) {
示例15: htmlspecialcharsex
<?echo htmlspecialcharsex($arProp["NAME"])?>
</td>
<td align="left"><?
if($arProp['PROPERTY_TYPE'] == "S" && !$arProp['USER_TYPE'])
echo GetMessage("IBLOCK_PROP_S");
elseif($arProp['PROPERTY_TYPE'] == "N" && !$arProp['USER_TYPE'])
echo GetMessage("IBLOCK_PROP_N");
elseif($arProp['PROPERTY_TYPE'] == "L" && !$arProp['USER_TYPE'])
echo GetMessage("IBLOCK_PROP_L");
elseif($arProp['PROPERTY_TYPE'] == "F" && !$arProp['USER_TYPE'])
echo GetMessage("IBLOCK_PROP_F");
elseif($arProp['PROPERTY_TYPE'] == "G" && !$arProp['USER_TYPE'])
echo GetMessage("IBLOCK_PROP_G");
elseif($arProp['PROPERTY_TYPE'] == "E" && !$arProp['USER_TYPE'])
echo GetMessage("IBLOCK_PROP_E");
elseif($arProp['USER_TYPE'] && is_array($ar = CIBlockProperty::GetUserType($arProp['USER_TYPE'])))
echo htmlspecialcharsex($ar["DESCRIPTION"]);
else
echo GetMessage("IBLOCK_PROP_S");
?></td>
<td style="text-align:center"><?
echo '<input type="checkbox" value="Y" '.((is_array($arLink) && $arLink["INHERITED"] == "Y")? 'disabled="disabled"': '').' name="SECTION_PROPERTY['.$arProp['ID'].'][SMART_FILTER]" '.($arLink["SMART_FILTER"] == "Y"? 'checked="checked"': '').'>';
?></td>
<td align="left"><?
if(!is_array($arLink) || $arLink["INHERITED"] == "N")
echo '<a href="javascript:deleteSectionProperty('.$arProp['ID'].', \'select_SKU_SECTION_PROPERTY\', \'shadow_SKU_SECTION_PROPERTY\', \'table_SKU_SECTION_PROPERTY\')">'.GetMessage("CAT_CEDIT_PROP_TABLE_ACTION_DELETE").'</a>';
else
echo ' ';
?></td>
</tr>
<?endwhile?>