本文整理汇总了PHP中CIBlockProperty::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty::getList方法的具体用法?PHP CIBlockProperty::getList怎么用?PHP CIBlockProperty::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockProperty
的用法示例。
在下文中一共展示了CIBlockProperty::getList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddDocumentField
public function AddDocumentField($documentType, $fields)
{
$iblockId = intval(substr($documentType, strlen("iblock_")));
if ($iblockId <= 0) {
throw new CBPArgumentOutOfRangeException("documentType", $documentType);
}
if (substr($fields["code"], 0, strlen("PROPERTY_")) == "PROPERTY_") {
$fields["code"] = substr($fields["code"], strlen("PROPERTY_"));
}
$fieldsTemporary = array("NAME" => $fields["name"], "ACTIVE" => "Y", "SORT" => $fields["sort"] ? $fields["sort"] : 900, "CODE" => $fields["code"], 'MULTIPLE' => $fields['multiple'] == 'Y' || (string) $fields['multiple'] === '1' ? 'Y' : 'N', 'IS_REQUIRED' => $fields['required'] == 'Y' || (string) $fields['required'] === '1' ? 'Y' : 'N', "IBLOCK_ID" => $iblockId, "FILTRABLE" => "Y", "SETTINGS" => $fields["settings"] ? $fields["settings"] : array("SHOW_ADD_FORM" => 'Y', "SHOW_EDIT_FORM" => 'Y'), "DEFAULT_VALUE" => $fields['DefaultValue']);
if (strpos("0123456789", substr($fieldsTemporary["CODE"], 0, 1)) !== false) {
$fieldsTemporary["CODE"] = self::generateMnemonicCode($fieldsTemporary["CODE"]);
}
if (array_key_exists("additional_type_info", $fields)) {
$fieldsTemporary["LINK_IBLOCK_ID"] = intval($fields["additional_type_info"]);
}
if (strstr($fields["type"], ":") !== false) {
list($fieldsTemporary["TYPE"], $fieldsTemporary["USER_TYPE"]) = explode(":", $fields["type"], 2);
if ($fields["type"] == "E:EList") {
$fieldsTemporary["LINK_IBLOCK_ID"] = $fields["options"];
}
} elseif ($fields["type"] == "user") {
$fieldsTemporary["TYPE"] = "S:employee";
$fieldsTemporary["USER_TYPE"] = "UserID";
} elseif ($fields["type"] == "date") {
$fieldsTemporary["TYPE"] = "S:Date";
$fieldsTemporary["USER_TYPE"] = "Date";
} elseif ($fields["type"] == "datetime") {
$fieldsTemporary["TYPE"] = "S:DateTime";
$fieldsTemporary["USER_TYPE"] = "DateTime";
} elseif ($fields["type"] == "file") {
$fieldsTemporary["TYPE"] = "F";
$fieldsTemporary["USER_TYPE"] = "";
} elseif ($fields["type"] == "select") {
$fieldsTemporary["TYPE"] = "L";
$fieldsTemporary["USER_TYPE"] = false;
if (is_array($fields["options"])) {
$i = 10;
foreach ($fields["options"] as $k => $v) {
$def = "N";
if ($fields['DefaultValue'] == $v) {
$def = "Y";
}
$fieldsTemporary["VALUES"][] = array("XML_ID" => $k, "VALUE" => $v, "DEF" => $def, "SORT" => $i);
$i = $i + 10;
}
} elseif (is_string($fields["options"]) && strlen($fields["options"]) > 0) {
$a = explode("\n", $fields["options"]);
$i = 10;
foreach ($a as $v) {
$v = trim(trim($v), "\r\n");
if (!$v) {
continue;
}
$v1 = $v2 = $v;
if (substr($v, 0, 1) == "[" && strpos($v, "]") !== false) {
$v1 = substr($v, 1, strpos($v, "]") - 1);
$v2 = trim(substr($v, strpos($v, "]") + 1));
}
$def = "N";
if ($fields['DefaultValue'] == $v2) {
$def = "Y";
}
$fieldsTemporary["VALUES"][] = array("XML_ID" => $v1, "VALUE" => $v2, "DEF" => $def, "SORT" => $i);
$i = $i + 10;
}
}
} elseif ($fields["type"] == "string") {
$fieldsTemporary["TYPE"] = "S";
if ($fields["row_count"] && $fields["col_count"]) {
$fieldsTemporary["ROW_COUNT"] = $fields["row_count"];
$fieldsTemporary["COL_COUNT"] = $fields["col_count"];
} else {
$fieldsTemporary["ROW_COUNT"] = 1;
$fieldsTemporary["COL_COUNT"] = 30;
}
} elseif ($fields["type"] == "text") {
$fieldsTemporary["TYPE"] = "S";
if ($fields["row_count"] && $fields["col_count"]) {
$fieldsTemporary["ROW_COUNT"] = $fields["row_count"];
$fieldsTemporary["COL_COUNT"] = $fields["col_count"];
} else {
$fieldsTemporary["ROW_COUNT"] = 4;
$fieldsTemporary["COL_COUNT"] = 30;
}
} elseif ($fields["type"] == "int" || $fields["type"] == "double") {
$fieldsTemporary["TYPE"] = "N";
} elseif ($fields["type"] == "bool") {
$fieldsTemporary["TYPE"] = "L";
$fieldsTemporary["VALUES"][] = array("XML_ID" => 'yes', "VALUE" => GetMessage("BPVDX_YES"), "DEF" => "N", "SORT" => 10);
$fieldsTemporary["VALUES"][] = array("XML_ID" => 'no', "VALUE" => GetMessage("BPVDX_NO"), "DEF" => "N", "SORT" => 20);
} else {
$fieldsTemporary["TYPE"] = $fields["type"];
$fieldsTemporary["USER_TYPE"] = false;
}
$idField = false;
$properties = CIBlockProperty::getList(array(), array("IBLOCK_ID" => $fieldsTemporary["IBLOCK_ID"], "CODE" => $fieldsTemporary["CODE"]));
if (!$properties->fetch()) {
$listObject = new CList($iblockId);
$idField = $listObject->addField($fieldsTemporary);
//.........这里部分代码省略.........
示例2: sprintf
$iblock = $iblockMap[$catalog['IBLOCK_ID']];
if ((int) $catalog['SKU_PROPERTY_ID'] > 0) {
// sku
$groupName = sprintf(GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_GROUP_OFFERS_CATALOG_PARAMS"), $iblock['NAME']);
} else {
$groupName = sprintf(GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_GROUP_PRODUCT_CATALOG_PARAMS"), $iblock['NAME']);
}
$groupId = 'CATALOG_PPARAMS_' . $iblock['ID'];
$arComponentParameters['GROUPS'][$groupId] = array("NAME" => $groupName);
// Params in group
// 1. Display Properties
$listProperties = array();
$allProperties = array();
$fileProperties = array();
$treeProperties = array();
$propertyIterator = CIBlockProperty::getList(array("SORT" => "ASC", "NAME" => "ASC"), array("IBLOCK_ID" => $iblock['ID'], "ACTIVE" => "Y"));
while ($property = $propertyIterator->fetch()) {
$property['ID'] = (int) $property['ID'];
$propertyName = '[' . $property['ID'] . ']' . ('' != $property['CODE'] ? '[' . $property['CODE'] . ']' : '') . ' ' . $property['NAME'];
if ('' == $property['CODE']) {
$property['CODE'] = $property['ID'];
}
$allProperties[$property['CODE']] = $propertyName;
if ('F' == $property['PROPERTY_TYPE']) {
$fileProperties[$property['CODE']] = $propertyName;
}
if ('L' == $property['PROPERTY_TYPE']) {
$listProperties[$property['CODE']] = $propertyName;
}
// skip property id
if ($property['ID'] == $catalog['SKU_PROPERTY_ID']) {
示例3: getPropsList
protected function getPropsList($iblockId, $skuPropertyId = 0)
{
$arResult = array();
$dbrFProps = \CIBlockProperty::getList(array("SORT" => "ASC", "NAME" => "ASC"), array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "!XML_ID" => "CML2_LINK", "CHECK_PERMISSIONS" => "N"));
while ($arProp = $dbrFProps->getNext()) {
if ($skuPropertyId == $arProp['ID']) {
continue;
}
$arProp["PROPERTY_USER_TYPE"] = !empty($arProp["USER_TYPE"]) ? \CIBlockProperty::getUserType($arProp["USER_TYPE"]) : array();
$arResult[] = $arProp;
}
return $arResult;
}
示例4: define
define('STOP_STATISTICS', true);
define('NO_AGENT_CHECK', true);
define('DisableEventsCheck', true);
define('BX_SECURITY_SHOW_MESSAGE', true);
define("PUBLIC_AJAX_MODE", true);
define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/iblock/admin_tools.php";
IncludeModuleLangFile(__FILE__);
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
if (!CModule::includeModule("iblock") || !CModule::includeModule('fileman')) {
die;
}
CUtil::jSPostUnescape();
if (check_bitrix_sessid()) {
if ($_POST['GET_INPUT'] == 'Y') {
$APPLICATION->RestartBuffer();
if ($_POST['PROPERTY_ID'] == "DETAIL" || $_POST['PROPERTY_ID'] == "ANNOUNCE") {
echo CFileInput::show('PROP[' . $_POST['PROPERTY_ID'] . '][' . $_POST['ROW_ID'] . ']', array(), array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::getOptionString("iblock", "detail_image_size"), "H" => COption::getOptionString("iblock", "detail_image_size"))), array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"] == "Y"));
}
$properties = CIBlockProperty::getList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "ID" => $_POST["PROPERTY_ID"], "CHECK_PERMISSIONS" => "N"));
if ($prop_fields = $properties->Fetch()) {
$prop_fields["VALUE"] = array();
$prop_fields["~VALUE"] = array();
_ShowPropertyField('PROP[' . $prop_fields["ID"] . '][' . $_POST['ROW_ID'] . ']', $prop_fields, $prop_fields["VALUE"], false, false, 50000, 'iblock_generator_form');
}
exit;
}
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例5: AddDocumentField
public function AddDocumentField($documentType, $arFields)
{
$iblockId = intval(substr($documentType, strlen("iblock_")));
if ($iblockId <= 0)
throw new CBPArgumentOutOfRangeException("documentType", $documentType);
if (substr($arFields["code"], 0, strlen("PROPERTY_")) == "PROPERTY_")
$arFields["code"] = substr($arFields["code"], strlen("PROPERTY_"));
$arFieldsTmp = array(
"NAME" => $arFields["name"],
"ACTIVE" => "Y",
"SORT" => 150,
"CODE" => $arFields["code"],
'MULTIPLE' => $arFields['multiple'] == 'Y' || (string)$arFields['multiple'] === '1' ? 'Y' : 'N',
'IS_REQUIRED' => $arFields['required'] == 'Y' || (string)$arFields['required'] === '1' ? 'Y' : 'N',
"IBLOCK_ID" => $iblockId,
"FILTRABLE" => "Y",
);
if (strpos("0123456789", substr($arFieldsTmp["CODE"], 0, 1))!==false)
$arFieldsTmp["CODE"] = self::generateMnemonicCode($arFieldsTmp["CODE"]);
if (array_key_exists("additional_type_info", $arFields))
$arFieldsTmp["LINK_IBLOCK_ID"] = intval($arFields["additional_type_info"]);
if (strstr($arFields["type"], ":") !== false)
{
list($arFieldsTmp["PROPERTY_TYPE"], $arFieldsTmp["USER_TYPE"]) = explode(":", $arFields["type"], 2);
if ($arFields["type"] == "E:EList")
$arFieldsTmp["LINK_IBLOCK_ID"] = $arFields["options"];
}
elseif ($arFields["type"] == "user")
{
$arFieldsTmp["PROPERTY_TYPE"] = "S";
$arFieldsTmp["USER_TYPE"]= "UserID";
}
elseif ($arFields["type"] == "date")
{
$arFieldsTmp["PROPERTY_TYPE"] = "S";
$arFieldsTmp["USER_TYPE"]= "Date";
}
elseif ($arFields["type"] == "datetime")
{
$arFieldsTmp["PROPERTY_TYPE"] = "S";
$arFieldsTmp["USER_TYPE"]= "DateTime";
}
elseif ($arFields["type"] == "file")
{
$arFieldsTmp["PROPERTY_TYPE"] = "F";
$arFieldsTmp["USER_TYPE"]= "";
}
elseif ($arFields["type"] == "select")
{
$arFieldsTmp["PROPERTY_TYPE"] = "L";
$arFieldsTmp["USER_TYPE"]= false;
if (is_array($arFields["options"]))
{
$i = 10;
foreach ($arFields["options"] as $k => $v)
{
$arFieldsTmp["VALUES"][] = array("XML_ID" => $k, "VALUE" => $v, "DEF" => "N", "SORT" => $i);
$i = $i + 10;
}
}
elseif (is_string($arFields["options"]) && (strlen($arFields["options"]) > 0))
{
$a = explode("\n", $arFields["options"]);
$i = 10;
foreach ($a as $v)
{
$v = trim(trim($v), "\r\n");
if (!$v)
continue;
$v1 = $v2 = $v;
if (substr($v, 0, 1) == "[" && strpos($v, "]") !== false)
{
$v1 = substr($v, 1, strpos($v, "]") - 1);
$v2 = trim(substr($v, strpos($v, "]") + 1));
}
$arFieldsTmp["VALUES"][] = array("XML_ID" => $v1, "VALUE" => $v2, "DEF" => "N", "SORT" => $i);
$i = $i + 10;
}
}
}
else
{
$arFieldsTmp["PROPERTY_TYPE"] = $arFields["type"];
$arFieldsTmp["USER_TYPE"] = false;
}
if ($arFieldsTmp["PROPERTY_TYPE"] == "T")
{
$arFieldsTmp["PROPERTY_TYPE"] = "S";
$arFieldsTmp["ROW_COUNT"] = 5;
}
$properties = CIBlockProperty::getList(
array(),
//.........这里部分代码省略.........