本文整理汇总了PHP中CIBlock::GetFieldsDefaults方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetFieldsDefaults方法的具体用法?PHP CIBlock::GetFieldsDefaults怎么用?PHP CIBlock::GetFieldsDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::GetFieldsDefaults方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($iblock_id, $field_id, $label, $sort)
{
parent::__construct($iblock_id, $field_id, $label, $sort);
$this->_type = CListFieldTypeList::GetByID($field_id);
if ($this->_iblock_id > 0) {
$arIBlockFields = CIBlock::GetArrayByID($this->_iblock_id, "FIELDS");
} else {
$arIBlockFields = CIBlock::GetFieldsDefaults();
}
$this->_iblock_field = $arIBlockFields[$field_id];
}
示例2: GetFields
/**
* <p>Функция возвращает описание полей элементов инфоблоков. Структура массива описана в <a href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/SetFields.php">CIBlock::SetFields.</a></p>
*
*
*
*
* @param int $ID Код информациооного блока<br>
*
*
*
* @return array <p>Массив.</p>
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/SetFields.php">CIBlock::SetFields</a> </li>
* </ul><br>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/GetFields.php
* @author Bitrix
*/
public static function GetFields($ID)
{
/** @global CDatabase $DB */
global $DB;
$ID = intval($ID);
$arDefFields = CIBlock::GetFieldsDefaults();
$res = $DB->Query("\n\t\t\tSELECT\n\t\t\t\tF.*\n\t\t\tFROM\n\t\t\t\tb_iblock B\n\t\t\t\tLEFT JOIN b_iblock_fields F ON B.ID = F.IBLOCK_ID\n\t\t\tWHERE\n\t\t\t\tB.ID = " . $ID . "\n\t\t");
while ($ar = $res->Fetch()) {
if (array_key_exists($ar["FIELD_ID"], $arDefFields)) {
if ($arDefFields[$ar["FIELD_ID"]]["IS_REQUIRED"] === false) {
$arDefFields[$ar["FIELD_ID"]]["IS_REQUIRED"] = $ar["IS_REQUIRED"] === "Y" ? "Y" : "N";
}
$arDefFields[$ar["FIELD_ID"]]["DEFAULT_VALUE"] = $ar["DEFAULT_VALUE"];
}
}
foreach ($arDefFields as $FIELD_ID => $default) {
if ($default["IS_REQUIRED"] === false) {
$arDefFields[$FIELD_ID]["IS_REQUIRED"] = "N";
}
if ($FIELD_ID == "DETAIL_PICTURE" || $FIELD_ID == "PREVIEW_PICTURE" || $FIELD_ID == "CODE" || $FIELD_ID == "SECTION_PICTURE" || $FIELD_ID == "SECTION_DETAIL_PICTURE" || $FIELD_ID == "SECTION_CODE") {
$a =& $arDefFields[$FIELD_ID]["DEFAULT_VALUE"];
$a = strlen($a) ? unserialize($a) : array();
if (array_key_exists("TRANS_LEN", $a)) {
$trans_len = intval($a["TRANS_LEN"]);
if ($trans_len > 255) {
$trans_len = 255;
} elseif ($trans_len < 1) {
$trans_len = 100;
}
$a["TRANS_LEN"] = $trans_len;
}
}
}
return $arDefFields;
}
示例3: foreach
?>
</a>
<?php
}
?>
</td>
</tr>
<?php
}
$tabControl->BeginNextTab();
if ($bVarsFromForm) {
$arFields = $_REQUEST["FIELDS"];
} else {
$arFields = CIBlock::GetFields($ID);
}
$arDefFields = CIBlock::GetFieldsDefaults();
foreach ($arDefFields as $FIELD_ID => $arField) {
if ($arField["VISIBLE"] == "N") {
continue;
}
if (!preg_match("/^LOG_/", $FIELD_ID)) {
continue;
}
?>
<tr>
<td width="40%"><label for="FIELDS[<?php
echo $FIELD_ID;
?>
][IS_REQUIRED]"><?php
echo GetMessage("IB_E_" . $FIELD_ID);
?>
示例4: createFieldset2
function createFieldset2($IBLOCK, $SKU = false, $PRICE = false)
{
$filedNames = CIBlock::GetFieldsDefaults();
$Properties = array("ID" => GetMessage("ACRIT_EXPORTPRO_IDENTIFIKACIONNYY_NO"), "NAME" => GetMessage("ACRIT_EXPORTPRO_NAIMENOVANIE"), "CODE" => GetMessage("ACRIT_EXPORTPRO_SIMVOLQNYY_KOD"), "ACTIVE" => GetMessage("ACRIT_EXPORTPRO_AKTIVNOSTQ"), "DETAIL_PAGE_URL" => GetMessage("ACRIT_EXPORTPRO_SSYLKA_NA_DETALQNUU"), "DATE_ACTIVE_FROM" => GetMessage("ACRIT_EXPORTPRO_DATA_NACALA_AKTIVNOS"), "DATE_ACTIVE_TO" => GetMessage("ACRIT_EXPORTPRO_DATA_OKONCANIA_AKTIV"), "PREVIEW_TEXT" => GetMessage("ACRIT_EXPORTPRO_TEKST_ANONSA"), "PREVIEW_PICTURE" => GetMessage("ACRIT_EXPORTPRO_IZOBRAJENIE_ANONSA"), "DETAIL_TEXT" => GetMessage("ACRIT_EXPORTPRO_DETALQNOE_OPISANIE"), "DETAIL_PICTURE" => GetMessage("ACRIT_EXPORTPRO_DETALQNOE_IZOBRAJENI"), "IBLOCK_ID" => GetMessage("ACRIT_EXPORTPRO_FIELD_IBLOCK_ID"), "IBLOCK_CODE" => GetMessage("ACRIT_EXPORTPRO_FIELD_IBLOCK_CODE"), "IBLOCK_SECTION_ID" => GetMessage("ACRIT_EXPORTPRO_FIELD_IBLOCK_SECTION_ID"), "IBLOCK_SECTION_NAME" => GetMessage("ACRIT_EXPORTPRO_FIELD_IBLOCK_SECTION_NAME"), "CREATED_BY" => GetMessage("ACRIT_EXPORTPRO_FIELD_CREATED_BY"), "CREATED_USER_NAME" => GetMessage("ACRIT_EXPORTPRO_FIELD_CREATED_USER_NAME"), "TIMESTAMP_X" => GetMessage("ACRIT_EXPORTPRO_FIELD_TIMESTAMP_X"), "MODIFIED_BY" => GetMessage("ACRIT_EXPORTPRO_FIELD_MODIFIED_BY"), "USER_NAME" => GetMessage("ACRIT_EXPORTPRO_FIELD_USER_NAME"));
if ($PRICE) {
//$arGroups = array();
//if( CModule::IncludeModule( "catalog" ) ){
// $dbRes = CCatalogGroup::GetList( array( "SORT" => "ASC" ), array( "ACTIVE" => "Y" ) );
// while( $arRes = $dbRes->GetNext() ){
// $price["CATALOG-PRICE_" . $arRes["ID"]] = "[" . $arRes["ID"] . "] " . $arRes["NAME_LANG"];
// $price["CATALOG-PRICE_" . $arRes["ID"]."_CURRENCY"] = "[" . $arRes["ID"] . "] " . $arRes["NAME_LANG"] ."(".GetMessage("ACRIT_EXPORTPRO_FIELD_CURRNECY").")";
// }
//}
//$arGroups = "";
//if( CModule::IncludeModule( "catalog" ) ){
// $dbRes = CCatalogGroup::GetGroupsList( array() );
// while( $arRes = $dbRes->Fetch() ){
// if( $arRes["BUY"] == "Y" )
// $arGroups[] = $arRes["CATALOG_GROUP_ID"];
// }
// $dbRes = CCatalogGroup::GetList( array( "SORT" => "ASC" ), array( "ACTIVE" => "Y", "ID" => $arGroups ), 0, 0, array( "ID", "NAME", "BASE" ) );
// while( $arRes = $dbRes->GetNext() ){
// $price["CATALOG-PRICE_" . $arRes["ID"]] = "[" . $arRes["ID"] . "] " . $arRes["NAME"];
// }
//}
}
if (!is_array($IBLOCK)) {
$k = $IBLOCK;
$IBLOCK = array();
$IBLOCK[] = $k;
}
if (!is_array($SECTIONS)) {
$k = $SECTIONS;
$SECTIONS = array();
$SECTIONS[] = $k;
}
if (is_array($IBLOCK) && sizeof($IBLOCK) > 0) {
foreach ($IBLOCK as $iblock) {
$arIBlock[$iblock]["FIELDS"] = $Properties;
$res = CIBlock::GetByID($iblock);
if ($ar_res = $res->GetNext()) {
$arIBlock[$iblock]["NAME"] = $ar_res["NAME"];
}
$intIBlockID = $iblock;
if ($SKU == true && CModule::IncludeModule("catalog")) {
$arOffers = CCatalogSKU::GetInfoByProductIBlock($intIBlockID);
if (!empty($arOffers["IBLOCK_ID"])) {
$intOfferIBlockID = $arOffers["IBLOCK_ID"];
$strPerm = "D";
$rsOfferIBlocks = CIBlock::GetByID($intOfferIBlockID);
if ($arOfferIBlock = $rsOfferIBlocks->Fetch()) {
$bBadBlock = !CIBlockRights::UserHasRightTo($intOfferIBlockID, $intOfferIBlockID, "iblock_admin_display");
if ($bBadBlock) {
echo GetMessage("ERR_NO_ACCESS_IBLOCK_SKU");
}
}
$boolOffers = true;
} else {
$boolOffers = false;
}
} else {
$boolOffers = false;
}
//--получем свойства инфоблока
$dbRes = CIBlockProperty::GetList(array("name" => "asc"), array("IBLOCK_ID" => $intIBlockID, "ACTIVE" => "Y"));
$arIBlock[$iblock]["PROPERTY"] = array();
$arIBlock[$iblock]["OFFERS_PROPERTY"] = array();
while ($arRes = $dbRes->Fetch()) {
$arIBlock[$iblock]["PROPERTY"][$arRes["ID"]] = $arRes;
}
if ($boolOffers) {
$rsProps = CIBlockProperty::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => $intOfferIBlockID, "ACTIVE" => "Y"));
while ($arProp = $rsProps->Fetch()) {
//if( $arOffers["SKU_PROPERTY_ID"] != $arProp["ID"] ){
if ($arProp["PROPERTY_TYPE"] == "L") {
$arProp["VALUES"] = array();
$rsPropEnums = CIBlockProperty::GetPropertyEnum($arProp["ID"], array("sort" => "asc"), array("IBLOCK_ID" => $intOfferIBlockID));
while ($arPropEnum = $rsPropEnums->Fetch()) {
$arProp["VALUES"][$arPropEnum["ID"]] = $arPropEnum["VALUE"];
}
}
$arIBlock[$iblock]["OFFERS_PROPERTY"][$arProp["ID"]] = $arProp;
if (is_array($arSelectedPropTypes) && in_array($arProp["PROPERTY_TYPE"], $arSelectedPropTypes)) {
$arSelectOfferProps[] = $arProp["ID"];
}
//}
}
}
}
}
if (@CModule::IncludeModule("catalog")) {
$arIBlock["CATALOG"] = array();
$arIBlock["CATALOG"]["QUANTITY"] = GetMessage("ACRIT_EXPORTPRO_KOLICESTVO");
$arIBlock["CATALOG"]["QUANTITY_RESERVED"] = GetMessage("ACRIT_EXPORTPRO_QUANTITY_RESERVED");
$arIBlock["CATALOG"]["WEIGHT"] = GetMessage("ACRIT_EXPORTPRO_WEIGHT");
$arIBlock["CATALOG"]["WIDTH"] = GetMessage("ACRIT_EXPORTPRO_WIDTH");
$arIBlock["CATALOG"]["LENGTH"] = GetMessage("ACRIT_EXPORTPRO_LENGTH");
$arIBlock["CATALOG"]["HEIGHT"] = GetMessage("ACRIT_EXPORTPRO_HEIGHT");
$arIBlock["CATALOG"]["PURCHASING_PRICE"] = GetMessage("ACRIT_EXPORTPRO_FIELD_PURCHASING_PRICE");
$p = GetCatalogGroups($b = "SORT", $o = "ASC");
//.........这里部分代码省略.........