当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockParameters::getIBlockTypes方法代码示例

本文整理汇总了PHP中CIBlockParameters::getIBlockTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockParameters::getIBlockTypes方法的具体用法?PHP CIBlockParameters::getIBlockTypes怎么用?PHP CIBlockParameters::getIBlockTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlockParameters的用法示例。


在下文中一共展示了CIBlockParameters::getIBlockTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderControlOptions

 /**
  * @param FieldType $fieldType
  * @param string $callbackFunctionName
  * @param mixed $value
  * @return string
  */
 public static function renderControlOptions(FieldType $fieldType, $callbackFunctionName, $value)
 {
     if (is_array($value)) {
         reset($value);
         $valueTmp = (int) current($value);
     } else {
         $valueTmp = (int) $value;
     }
     $iblockId = 0;
     if ($valueTmp > 0) {
         $elementIterator = \CIBlockElement::getList(array(), array('ID' => $valueTmp), false, false, array('ID', 'IBLOCK_ID'));
         if ($element = $elementIterator->fetch()) {
             $iblockId = $element['IBLOCK_ID'];
         }
     }
     if ($iblockId <= 0 && (int) $fieldType->getOptions() > 0) {
         $iblockId = (int) $fieldType->getOptions();
     }
     $defaultIBlockId = 0;
     $result = '<select id="WFSFormOptionsX" onchange="' . htmlspecialcharsbx($callbackFunctionName) . '(this.options[this.selectedIndex].value)">';
     $iblockTypeIterator = \CIBlockParameters::getIBlockTypes();
     foreach ($iblockTypeIterator as $iblockTypeId => $iblockTypeName) {
         $result .= '<optgroup label="' . htmlspecialcharsbx($iblockTypeName) . '">';
         $iblockIterator = \CIBlock::getList(array('SORT' => 'ASC'), array('TYPE' => $iblockTypeId, 'ACTIVE' => 'Y'));
         while ($iblock = $iblockIterator->fetch()) {
             $result .= '<option value="' . $iblock['ID'] . '"' . ($iblock['ID'] == $iblockId ? ' selected' : '') . '>' . htmlspecialcharsbx($iblock['NAME']) . '</option>';
             if ($defaultIBlockId <= 0 || $iblock['ID'] == $iblockId) {
                 $defaultIBlockId = $iblock['ID'];
             }
         }
         $result .= '</optgroup>';
     }
     $result .= '</select><!--__defaultOptionsValue:' . $defaultIBlockId . '--><!--__modifyOptionsPromt:' . Loc::getMessage('UTP_ELIST_DOCUMENT_MOPROMT') . '-->';
     $fieldType->setOptions($defaultIBlockId);
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:42,代码来源:usertypepropertyelist.php

示例2: ShowError

use Bitrix\Main\Loader;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!Loader::includeModule("sale") || !Loader::includeModule("iblock") || !Loader::includeModule("catalog")) {
    ShowError(GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_NEED_REQUIRED_MODULES"));
    die;
}
// Prices
$catalogGroupIterator = CCatalogGroup::getList(array("NAME" => "ASC", "SORT" => "ASC"));
$catalogGroups = array();
while ($catalogGroup = $catalogGroupIterator->fetch()) {
    $catalogGroups[$catalogGroup['NAME']] = "[{$catalogGroup['NAME']}] {$catalogGroup['NAME_LANG']}";
}
// iblockTypes
$iblockTypes = CIBlockParameters::getIBlockTypes();
$iblockNames = array();
$iblockIterator = CIBlock::GetList(array("SORT" => "ASC"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE"] != "-" ? $arCurrentValues["IBLOCK_TYPE"] : ""));
while ($iblock = $iblockIterator->fetch()) {
    $iblockNames[$iblock['ID']] = "[{$iblock['CODE']}] {$iblock['NAME']}";
}
$arAscDesc = array("asc" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SORT_ASC"), "desc" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SORT_DESC"));
$arComponentParameters = array("GROUPS" => array("PRICES" => array("NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRICES")), "BASKET" => array("NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_BASKET"))), "PARAMETERS" => array("IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_TYPE"), "TYPE" => "LIST", "VALUES" => $iblockTypes, "DEFAULT" => "catalog", "REFRESH" => "Y"), "IBLOCK_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_IBLOCK_ID"), "TYPE" => "LIST", "VALUES" => $iblockNames, "DEFAULT" => '={$_REQUEST["IBLOCK_ID"]}', "ADDITIONAL_VALUES" => "Y", "REFRESH" => "Y"), "ID" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_ID"), "TYPE" => "STRING", "DEFAULT" => '={$_REQUEST["PRODUCT_ID"]}'), "CODE" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_CODE"), "TYPE" => "STRING", "DEFAULT" => '={$_REQUEST["PRODUCT_CODE"]}'), "PROPERTY_LINK" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_PROP_LIST"), "TYPE" => "STRING", "DEFAULT" => "RECOMMEND"), "OFFERS_PROPERTY_LINK" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_OFFERS_PROP_LIST"), "TYPE" => "STRING", "DEFAULT" => "RECOMMEND"), "CACHE_TIME" => array("DEFAULT" => 86400), "DETAIL_URL" => CIBlockParameters::GetPathTemplateParam("DETAIL", "DETAIL_URL", GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_DETAIL_URL"), "", "URL_TEMPLATES"), "BASKET_URL" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_BASKET_URL"), "TYPE" => "STRING", "DEFAULT" => "/personal/basket.php"), "ACTION_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_ACTION_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "action"), "PRODUCT_ID_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_ID_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "id"), "PRODUCT_QUANTITY_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_QUANTITY_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "quantity"), "ADD_PROPERTIES_TO_BASKET" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_ADD_PROPERTIES_TO_BASKET"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "PRODUCT_PROPS_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_PROPS_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "prop", "HIDDEN" => isset($arCurrentValues['ADD_PROPERTIES_TO_BASKET']) && $arCurrentValues['ADD_PROPERTIES_TO_BASKET'] == 'N' ? 'Y' : 'N'), "PARTIAL_PRODUCT_PROPERTIES" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PARTIAL_PRODUCT_PROPERTIES"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "HIDDEN" => isset($arCurrentValues['ADD_PROPERTIES_TO_BASKET']) && $arCurrentValues['ADD_PROPERTIES_TO_BASKET'] == 'N' ? 'Y' : 'N'), "SHOW_OLD_PRICE" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_OLD_PRICE"), "TYPE" => "CHECKBOX", "VALUES" => "N"), 'SHOW_DISCOUNT_PERCENT' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_DISCOUNT_PERCENT'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'), "PRICE_CODE" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRICE_CODE"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $catalogGroups), "SHOW_PRICE_COUNT" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_PRICE_COUNT"), "TYPE" => "STRING", "DEFAULT" => "1"), 'PRODUCT_SUBSCRIPTION' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_SUBSCRIPTION'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'), "PRICE_VAT_INCLUDE" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_VAT_INCLUDE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "USE_PRODUCT_QUANTITY" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_USE_PRODUCT_QUANTITY"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"), "SHOW_NAME" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_NAME"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "SHOW_IMAGE" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_IMAGE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), 'MESS_BTN_BUY' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_BUY'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_BUY_DEFAULT')), 'MESS_BTN_DETAIL' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_DETAIL'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_DETAIL_DEFAULT')), 'MESS_NOT_AVAILABLE' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_NOT_AVAILABLE'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_NOT_AVAILABLE_DEFAULT')), 'MESS_BTN_SUBSCRIBE' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_SUBSCRIBE'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_SUBSCRIBE_DEFAULT')), "PAGE_ELEMENT_COUNT" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PAGE_ELEMENT_COUNT"), "TYPE" => "STRING", "DEFAULT" => "30")));
// Params groups
$iblockMap = array();
$iblockIterator = CIBlock::GetList(array("SORT" => "ASC"), array("ACTIVE" => "Y"));
while ($iblock = $iblockIterator->fetch()) {
    $iblockMap[$iblock['ID']] = $iblock;
}
$catalogs = array();
$productsCatalogs = array();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:.parameters.php

示例3: getFieldInputControlOptions

    public static function getFieldInputControlOptions($documentType, &$fieldType, $functionNameJs, &$value)
    {
        $result = "";
        static $documentFieldTypes = array();
        if (!array_key_exists($documentType, $documentFieldTypes)) {
            $documentFieldTypes[$documentType] = self::getDocumentFieldTypes($documentType);
        }
        if (!array_key_exists($fieldType["Type"], $documentFieldTypes[$documentType]) || !$documentFieldTypes[$documentType][$fieldType["Type"]]["Complex"]) {
            return "";
        }
        if ($fieldType["Type"] == "E:EList") {
            if (is_array($value)) {
                reset($value);
                $valueTmp = intval(current($value));
            } else {
                $valueTmp = intval($value);
            }
            $iblockId = 0;
            if ($valueTmp > 0) {
                $queryResult = \CIBlockElement::getList(array(), array("ID" => $valueTmp), false, false, array("ID", "IBLOCK_ID"));
                if ($fetchResult = $queryResult->fetch()) {
                    $iblockId = $fetchResult["IBLOCK_ID"];
                }
            }
            if ($iblockId <= 0 && intval($fieldType["Options"]) > 0) {
                $iblockId = intval($fieldType["Options"]);
            }
            $defaultIBlockId = 0;
            $result .= '<select id="WFSFormOptionsX" onchange="' . htmlspecialcharsbx($functionNameJs) . '(this.options[this.selectedIndex].value)">';
            $iblockType = \CIBlockParameters::getIBlockTypes();
            foreach ($iblockType as $iblockTypeId => $iblockTypeName) {
                $result .= '<optgroup label="' . $iblockTypeName . '">';
                $dbIBlock = \CIBlock::getList(array("SORT" => "ASC"), array("TYPE" => $iblockTypeId, "ACTIVE" => "Y"));
                while ($iblock = $dbIBlock->getNext()) {
                    $result .= '<option value="' . $iblock["ID"] . '"' . ($iblock["ID"] == $iblockId ? " selected" : "") . '>' . $iblock["NAME"] . '</option>';
                    if ($defaultIBlockId <= 0 || $iblock["ID"] == $iblockId) {
                        $defaultIBlockId = $iblock["ID"];
                    }
                }
                $result .= '</optgroup>';
            }
            $result .= '</select><!--__defaultOptionsValue:' . $defaultIBlockId . '--><!--__modifyOptionsPromt:' . GetMessage("IBD_DOCUMENT_MOPROMT") . '-->';
            $fieldType["Options"] = $defaultIBlockId;
        } elseif ($fieldType["Type"] == "select") {
            $valueTmp = $fieldType["Options"];
            if (!is_array($valueTmp)) {
                $valueTmp = array($valueTmp => $valueTmp);
            }
            $str = '';
            foreach ($valueTmp as $k => $v) {
                if (is_array($v) && count($v) == 2) {
                    $v1 = array_values($v);
                    $k = $v1[0];
                    $v = $v1[1];
                }
                if ($k != $v) {
                    $str .= '[' . $k . ']' . $v;
                } else {
                    $str .= $v;
                }
                $str .= "\n";
            }
            $result .= '<textarea id="WFSFormOptionsX" rows="5" cols="30">' . htmlspecialcharsbx($str) . '</textarea><br />';
            $result .= Loc::getMessage("DISK_IBD_DOCUMENT_XFORMOPTIONS1") . '<br />';
            $result .= Loc::getMessage("DISK_IBD_DOCUMENT_XFORMOPTIONS2") . '<br />';
            $result .= '<script type="text/javascript">
				function WFSFormOptionsXFunction()
				{
					var result = {};
					var i, id, val, str = document.getElementById("WFSFormOptionsX").value;

					var arr = str.split(/[\\r\\n]+/);
					var p, re = /\\[([^\\]]+)\\].+/;
					for (i in arr)
					{
						str = arr[i].replace(/^\\s+|\\s+$/g, \'\');
						if (str.length > 0)
						{
							id = str.match(re);
							if (id)
							{
								p = str.indexOf(\']\');
								id = id[1];
								val = str.substr(p + 1);
							}
							else
							{
								val = str;
								id = val;
							}
							result[id] = val;
						}
					}

					return result;
				}
				</script>';
            $result .= '<input type="button" onclick="' . htmlspecialcharsbx($functionNameJs) . '(WFSFormOptionsXFunction())" value="' . Loc::getMessage("DISK_IBD_DOCUMENT_XFORMOPTIONS3") . '">';
        }
        return $result;
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:bizprocdocument.php


注:本文中的CIBlockParameters::getIBlockTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。