本文整理汇总了PHP中Bitrix\Iblock\PropertyTable类的典型用法代码示例。如果您正苦于以下问题:PHP PropertyTable类的具体用法?PHP PropertyTable怎么用?PHP PropertyTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: properties
public static function properties($primary)
{
if (!$primary) {
throw new ArgumentException('Не указан идентификатор инфоблока');
}
$cache = new \CPHPCache();
$path = self::createPath(__METHOD__);
$cacheId = md5($primary);
if ($cache->InitCache(86400, $cacheId, $path)) {
$props = $cache->GetVars();
} else {
$field = is_numeric($primary) ? 'IBLOCK_ID' : 'IBLOCK.CODE';
$db = PropertyTable::query()->addFilter($field, $primary)->addSelect('*')->exec();
$props = array();
while ($prop = $db->fetch()) {
$code = $prop['CODE'];
if (isset($props[$code])) {
throw new \LogicException("В инфоблокe {$primary} свойство {$code} используется дважды");
}
if (strlen($code) === 0) {
throw new \LogicException("В инфоблоке {$primary} для свойства {$prop['NAME']} не задан символьный код");
}
$props[$code] = $prop;
}
if ($cache->StartDataCache()) {
$cache->EndDataCache($props);
}
}
return $props;
}
示例2: testExistsReferencesRegister
public function testExistsReferencesRegister()
{
Module::getInstance()->install();
$dbRsRef = DbVersionReferencesTable::getList(array('filter' => array('GROUP' => ReferenceController::GROUP_IBLOCK)));
$dbRsIblock = IblockTable::getList();
$this->assertEquals($dbRsIblock->getSelectedRowsCount(), $dbRsRef->getSelectedRowsCount(), $this->errorMessage('number of links to the information block and the information block entries must match'));
$dbRsRef = DbVersionReferencesTable::getList(array('filter' => array('GROUP' => ReferenceController::GROUP_IBLOCK_PROPERTY)));
$dbRsProp = PropertyTable::getList();
$this->assertEquals($dbRsProp->getSelectedRowsCount(), $dbRsRef->getSelectedRowsCount(), $this->errorMessage('number of links on the properties of information blocks and records must match'));
$dbRsRef = DbVersionReferencesTable::getList(array('filter' => array('GROUP' => ReferenceController::GROUP_IBLOCK_SECTION)));
$dbRsSection = SectionTable::getList();
$this->assertEquals($dbRsSection->getSelectedRowsCount(), $dbRsRef->getSelectedRowsCount(), $this->errorMessage('number of links to information block sections and records must match'));
}
示例3: testReinitIblockReference
public function testReinitIblockReference()
{
$beforeApplyFix = array('iblocks' => IblockTable::getList()->getSelectedRowsCount(), 'properties' => PropertyTable::getList()->getSelectedRowsCount(), 'sections' => SectionTable::getList()->getSelectedRowsCount());
$collector = Collector::createByFile(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'add_collection.json');
$this->assertNotEmpty($collector->getFixes());
Module::getInstance()->applyFixesList($collector->getFixes());
$afterApplyFix = array('iblocks' => IblockTable::getList()->getSelectedRowsCount(), 'properties' => PropertyTable::getList()->getSelectedRowsCount(), 'sections' => SectionTable::getList()->getSelectedRowsCount());
Module::getInstance()->rollbackLastChanges();
$afterRollback = array('iblocks' => IblockTable::getList()->getSelectedRowsCount(), 'properties' => PropertyTable::getList()->getSelectedRowsCount(), 'sections' => SectionTable::getList()->getSelectedRowsCount());
Module::getInstance()->applyFixesList($collector->getFixes());
$afterRollbackApply = array('iblocks' => IblockTable::getList()->getSelectedRowsCount(), 'properties' => PropertyTable::getList()->getSelectedRowsCount(), 'sections' => SectionTable::getList()->getSelectedRowsCount());
$this->assertEquals($beforeApplyFix['iblocks'], $afterApplyFix['iblocks'] - 1, $this->errorMessage('iblock not created after apply fix'));
$this->assertEquals($beforeApplyFix['properties'], $afterApplyFix['properties'] - 2, $this->errorMessage('properties not created after apply fix'));
$this->assertEquals($beforeApplyFix['sections'], $afterApplyFix['sections'] - 1, $this->errorMessage('sections not created after apply fix'));
$this->assertEquals($beforeApplyFix['iblocks'], $afterRollback['iblocks'], $this->errorMessage('iblock not removed after rollback fix'));
$this->assertEquals($beforeApplyFix['properties'], $afterRollback['properties'], $this->errorMessage('properties not removed after rollback fix'));
$this->assertEquals($beforeApplyFix['sections'], $afterRollback['sections'], $this->errorMessage('sections not removed after rollback fix'));
$this->assertEquals($afterRollback['iblocks'] + 1, $afterRollbackApply['iblocks'], $this->errorMessage('iblock not created after apply rollback fix'));
$this->assertEquals($afterRollback['properties'] + 2, $afterRollbackApply['properties'], $this->errorMessage('properties not created after apply rollback fix'));
$this->assertEquals($afterRollback['sections'] + 1, $afterRollbackApply['sections'], $this->errorMessage('sections not created after apply rollback fix'));
}
示例4: create
/**
* @inheritdoc
*/
public function create(ParameterDictionary $parameters)
{
$iblockId = (int) $parameters->get('ID');
$queryBuilder = new Entity\Query(Iblock\IblockTable::getEntity());
$iblockData = $queryBuilder->setSelect(array('ID', 'NAME'))->setFilter(array('ID' => $iblockId))->setOrder(array())->exec()->fetch();
if (empty($iblockData)) {
throw new BuilderException(sprintf('Not found iblock with id = %d', $iblockId));
}
// Get settings iblock
$iblockDataFields = \CIBlock::GetArrayByID($iblockData['ID']);
$queryBuilder = new Entity\Query(Iblock\PropertyTable::getEntity());
$propertyResult = $queryBuilder->setSelect(array('*'))->setFilter(array('IBLOCK_ID' => $iblockData['ID']))->setOrder(array())->exec();
$propertyList = array();
while ($property = $propertyResult->fetch()) {
if (!empty($property['USER_TYPE_SETTINGS'])) {
$property['USER_TYPE_SETTINGS'] = ($unserialize = @unserialize($property['USER_TYPE_SETTINGS'])) === false ? $property['USER_TYPE_SETTINGS'] : $unserialize;
}
$propertyList[$property['CODE']] = $property;
}
$this->iblockProperty = $propertyList;
$this->setElementValue();
$this->setSectionValue();
$this->setEnumValue();
$sectionValueList = array();
if (in_array($iblockData['ID'], $this->getListByType('G'))) {
foreach ($this->iblockProperty as $field) {
if ($field['PROPERTY_TYPE'] == 'G' && $field['LINK_IBLOCK_ID'] == $iblockData['ID']) {
$sectionValueList = isset($field['VALUE_LIST']) ? $field['VALUE_LIST'] : array();
break;
}
}
} else {
$queryBuilder = new Entity\Query(Iblock\SectionTable::getEntity());
$sectionValueList = $queryBuilder->setSelect(array('ID', 'NAME'))->setFilter(array('IBLOCK_ID' => $iblockData['ID']))->setOrder(array())->exec()->fetchAll();
}
$upperLevel[] = array('ID' => 0, 'NAME' => GetMessage('IBLOCK_UPPER_LEVEL'));
$sectionValueList = $upperLevel + $sectionValueList;
return array('DATA' => $iblockData, 'DEFAULT_FIELDS' => $this->getDefaultFields($iblockDataFields, $sectionValueList), 'FIELDS' => $this->iblockProperty);
}
示例5: parse
/**
* Parses the filter, we describe the properties of the
* filter type and description price
*
* @return $this
*/
public function parse()
{
if (sizeof($this->filterList) <= 0) {
return array();
}
$property = $price = array();
foreach ($this->filterList as $key => $items) {
foreach ($items as $filterQuery => $filterValue) {
if (preg_match($this->pattern['property'], $filterQuery, $match)) {
$property[] = $match[2];
} elseif (preg_match($this->pattern['price'], $filterQuery, $match)) {
$price[] = $match[2];
}
if (is_array($match)) {
unset($this->filterList[$key][$filterQuery]);
$this->filterList[$key][$match[1]] = $filterValue;
}
}
}
if (sizeof($property)) {
$queryBuilder = new Entity\Query(Iblock\PropertyTable::getEntity());
$propertyResult = $queryBuilder->setSelect(array('*'))->setFilter(array('ID' => $property))->exec();
while ($property = $propertyResult->fetch()) {
$key = sprintf('PROPERTY_%d', $property['ID']);
$this->propertyList[$key] = $property;
}
}
if (sizeof($price)) {
$priceTypeResult = \CCatalogGroup::GetList(array('SORT' => 'ASC'), array('ID' => $price));
while ($price = $priceTypeResult->Fetch()) {
$key = sprintf('CATALOG_PRICE_%d', $price['ID']);
$this->priceTypeList[$key] = $price;
}
}
$this->getValueList();
return $this;
}
示例6: unset
unset($countQuery);
$totalCount = (int) $totalCount['CNT'];
if ($totalCount > 0) {
$totalPages = ceil($totalCount / $navyParams['SIZEN']);
if ($navyParams['PAGEN'] > $totalPages) {
$navyParams['PAGEN'] = $totalPages;
}
$getListParams['limit'] = $navyParams['SIZEN'];
$getListParams['offset'] = $navyParams['SIZEN'] * ($navyParams['PAGEN'] - 1);
} else {
$navyParams['PAGEN'] = 1;
$getListParams['limit'] = $navyParams['SIZEN'];
$getListParams['offset'] = 0;
}
}
$propertyIterator = new CAdminResult(Iblock\PropertyTable::getList($getListParams), $sTableID);
if ($usePageNavigation) {
$propertyIterator->NavStart($getListParams['limit'], $navyParams['SHOW_ALL'], $navyParams['PAGEN']);
$propertyIterator->NavRecordCount = $totalCount;
$propertyIterator->NavPageCount = $totalPages;
$propertyIterator->NavPageNomer = $navyParams['PAGEN'];
} else {
$propertyIterator->NavStart();
}
$lAdmin->NavText($propertyIterator->GetNavPrint(GetMessage("IBP_ADM_PAGER")));
while ($property = $propertyIterator->Fetch()) {
$property['ID'] = (int) $property['ID'];
$property['USER_TYPE'] = (string) $property['USER_TYPE'];
if ($property['USER_TYPE'] != '') {
$property['PROPERTY_TYPE'] .= ':' . $property['USER_TYPE'];
}
示例7: array
$arSProperty_LNS[$FIELD_NAME] = $arProperty_UF[$FIELD_NAME];
}
unset($arUserFields);
}
$offers = false;
$arProperty_Offers = array();
$arProperty_OffersWithoutFile = array();
if ($catalogIncluded && $iblockExists)
{
$offers = CCatalogSKU::GetInfoByProductIBlock($arCurrentValues['IBLOCK_ID']);
if (!empty($offers))
{
$propertyIterator = Iblock\PropertyTable::getList(array(
'select' => array('ID', 'IBLOCK_ID', 'NAME', 'CODE', 'PROPERTY_TYPE', 'MULTIPLE', 'LINK_IBLOCK_ID', 'USER_TYPE'),
'filter' => array('=IBLOCK_ID' => $offers['IBLOCK_ID'], '=ACTIVE' => 'Y', '!=ID' => $offers['SKU_PROPERTY_ID']),
'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')
));
while ($property = $propertyIterator->fetch())
{
$propertyCode = (string)$property['CODE'];
if ($propertyCode == '')
$propertyCode = $property['ID'];
$propertyName = '['.$propertyCode.'] '.$property['NAME'];
$arProperty_Offers[$propertyCode] = $propertyName;
if ($property['PROPERTY_TYPE'] != Iblock\PropertyTable::TYPE_FILE)
$arProperty_OffersWithoutFile[$propertyCode] = $propertyName;
}
unset($propertyCode, $propertyName, $property, $propertyIterator);
}
示例8: setFields
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields) && $this->iblock_id > 0) {
$properties = array();
$propertyList = \Bitrix\Iblock\PropertyTable::getList(array("select" => array("*"), "filter" => array("=IBLOCK_ID" => $this->iblock_id)));
while ($row = $propertyList->fetch()) {
if ($row["USER_TYPE_SETTINGS"]) {
$row["USER_TYPE_SETTINGS"] = unserialize($row["USER_TYPE_SETTINGS"]);
}
$properties[$row["ID"]] = $row;
if ($row["CODE"] != "") {
$properties[$row["CODE"]] =& $properties[$row["ID"]];
}
}
foreach ($fields as $propertyCode => $propertyValues) {
if (is_array($propertyValues)) {
foreach ($propertyValues as $i => $propertyValue) {
if (is_array($propertyValue) && array_key_exists("VALUE", $propertyValue)) {
if ($propertyValue["VALUE"] != "") {
$propertyValues[$i] = $propertyValue["VALUE"];
} else {
unset($propertyValues[$i]);
}
}
}
}
if (isset($properties[$propertyCode])) {
$property = $properties[$propertyCode];
$fieldCode = strtolower($propertyCode);
if ($property["PROPERTY_TYPE"] === "L") {
if (is_numeric($propertyValues)) {
$value = new ElementPropertyEnum($propertyValues);
} elseif (is_array($propertyValues)) {
$value = array();
foreach ($propertyValues as $propertyValue) {
if (is_numeric($propertyValue)) {
$value[] = new ElementPropertyEnum($propertyValue);
}
}
} else {
$value = $propertyValues;
}
} elseif ($property["PROPERTY_TYPE"] === "E") {
if ($propertyValues instanceof Element) {
$this->element_link_properties[$fieldCode] = $propertyValues;
$value = $propertyValues->getField("name");
} elseif (is_numeric($propertyValues)) {
$this->element_link_properties[$fieldCode] = $propertyValues;
$value = new ElementPropertyElement($propertyValues);
} else {
$value = $propertyValues;
}
} elseif ($property["PROPERTY_TYPE"] === "G") {
if ($propertyValues instanceof Section) {
$this->section_link_properties[$fieldCode] = $propertyValues;
$value = $propertyValues->getField("name");
} elseif (is_numeric($propertyValues)) {
$this->section_link_properties[$fieldCode] = $propertyValues;
$value = new ElementPropertySection($propertyValues);
} else {
$value = $propertyValues;
}
} else {
if (strlen($property["USER_TYPE"])) {
$value = new ElementPropertyUserField($propertyValues, $property);
} else {
$value = $propertyValues;
}
}
$this->fieldMap[$fieldCode] = $property["ID"];
$this->fieldMap[$property["ID"]] = $property["ID"];
if ($property["CODE"] != "") {
$this->fieldMap[strtolower($property["CODE"])] = $property["ID"];
}
$this->fields[$property["ID"]] = $value;
}
}
}
}
示例9: GetRecommendetProduct
/**
* Returns list of recommended products for specific product.
*
* @param int $USER_ID User id.
* @param string $LID Site id.
* @param array $arFilterRecomendet Recomendation filter.
* @param string $recomMore Get more.
* @param int $cntProductDefault Max count.
* @return array
*/
function GetRecommendetProduct($USER_ID, $LID, $arFilterRecomendet = array(), $recomMore = 'N', $cntProductDefault = 2)
{
$arRecomendetResult = array();
if (CModule::IncludeModule('catalog') && !empty($arFilterRecomendet)) {
$arRecomendet = array();
if (!is_array($arFilterRecomendet)) {
$arFilterRecomendet = array($arFilterRecomendet);
}
Main\Type\Collection::normalizeArrayValuesByInt($arFilterRecomendet);
if (empty($arFilterRecomendet)) {
return $arRecomendetResult;
}
$iblockRecommended = array();
$productIterator = Iblock\ElementTable::getList(array('select' => array('ID', 'IBLOCK_ID'), 'filter' => array('@ID' => $arFilterRecomendet, '=ACTIVE' => 'Y')));
while ($product = $productIterator->fetch()) {
$product['ID'] = (int) $product['ID'];
$product['IBLOCK_ID'] = (int) $product['IBLOCK_ID'];
if (!isset($iblockRecommended[$product['IBLOCK_ID']])) {
$iblockRecommended[$product['IBLOCK_ID']] = array();
}
$iblockRecommended[$product['IBLOCK_ID']][] = $product['ID'];
}
unset($product, $productIterator);
if (empty($iblockRecommended)) {
return $arRecomendetResult;
}
$propertyList = array();
$propertyIterator = Iblock\PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID'), 'filter' => array('@IBLOCK_ID' => array_keys($iblockRecommended), '=CODE' => 'RECOMMEND', '=PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_ELEMENT)));
while ($property = $propertyIterator->fetch()) {
$property['ID'] = (int) $property['ID'];
$property['IBLOCK_ID'] = (int) $property['IBLOCK_ID'];
$propertyList[$property['IBLOCK_ID']] = $property['ID'];
}
unset($property, $propertyIterator);
if (empty($propertyList)) {
return $arRecomendetResult;
}
foreach ($propertyList as $iblockID => $propertyID) {
$propertyValue = 'PROPERTY_' . $propertyID;
$filter = array('ID' => $iblockRecommended[$iblockID], 'IBLOCK_ID' => $iblockID);
$select = array('ID', 'IBLOCK_ID', $propertyValue);
$propertyValue .= '_VALUE';
$elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $select);
while ($element = $elementIterator->Fetch()) {
if (empty($element[$propertyValue])) {
continue;
}
if (is_array($element[$propertyValue])) {
foreach ($element[$propertyValue] as &$recId) {
$recId = (int) $recId;
if ($recId > 0) {
$arRecomendet[$recId] = true;
}
}
unset($recId);
} else {
$recId = (int) $element[$propertyValue];
if ($recId > 0) {
$arRecomendet[$recId] = true;
}
}
}
}
unset($element, $elementIterator, $select, $filter, $propertyValue, $propertyID, $iblockID, $propertyList);
if (!empty($arRecomendet)) {
$arRecomendet = array_keys($arRecomendet);
$arBuyerGroups = CUser::GetUserGroup($USER_ID);
$arFilter = array("ID" => $arRecomendet, "ACTIVE" => "Y");
$rsElement = CIBlockElement::GetList(array(), $arFilter, false, false, array("NAME", "ID", "LID", 'IBLOCK_ID', 'IBLOCK_SECTION_ID', "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL"));
$currentVatMode = CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = CCatalogProduct::getUseDiscount();
CCatalogProduct::setUseDiscount(true);
CCatalogProduct::setPriceVatIncludeMode(true);
CCatalogProduct::setUsedCurrency(CSaleLang::GetLangCurrency($LID));
$i = 0;
while ($arElement = $rsElement->GetNext()) {
if (in_array($arElement["ID"], $arFilterRecomendet)) {
continue;
}
if ($recomMore == "N" && $i < $cntProductDefault || $recomMore == "Y") {
$arElement["MODULE"] = "catalog";
$arElement["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
$arElement["PRODUCT_ID"] = $arElement["ID"];
$arPrice = CCatalogProduct::GetOptimalPrice($arElement["ID"], 1, $arBuyerGroups, "N", array(), $LID, array());
$currentPrice = $arPrice['RESULT_PRICE']['DISCOUNT_PRICE'];
$arElement["PRICE"] = $currentPrice;
$arElement["CURRENCY"] = $arPrice["RESULT_PRICE"]["CURRENCY"];
$arElement["DISCOUNT_PRICE"] = $arPrice['RESULT_PRICE']['DISCOUNT'];
if ($arElement["IBLOCK_ID"] > 0 && $arElement["IBLOCK_SECTION_ID"] > 0) {
$arElement["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arElement["IBLOCK_ID"], $arElement["PRODUCT_ID"], array("find_section_section" => $arElement["IBLOCK_SECTION_ID"], 'WF' => 'Y'));
//.........这里部分代码省略.........
示例10: 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];
}
}
示例11: array
}
if ($ID > 0) {
$canWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array(MODULE_ID, ENTITY, $ID), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
$canRead = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ReadDocument, $USER->GetID(), array(MODULE_ID, ENTITY, $ID), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
} else {
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array(MODULE_ID, ENTITY, DOCUMENT_TYPE), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
$canRead = false;
}
if (!$canWrite && !$canRead) {
$error = new _CIBlockError(1, "ACCESS_DENIED", GetMessage("IBLOCK_ACCESS_DENIED_STATUS"));
break;
}
}
//Find out files properties
$arFileProps = array();
$propertyIterator = Iblock\PropertyTable::getList(array('select' => array('ID'), 'filter' => array('=IBLOCK_ID' => $IBLOCK_ID, '=PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_FILE, '=ACTIVE' => 'Y')));
while ($property = $propertyIterator->fetch()) {
$arFileProps[] = $property['ID'];
}
unset($property, $propertyIterator);
//Assembly properties values from $_POST and $_FILES
$PROP = array();
if (isset($_POST['PROP'])) {
$PROP = $_POST['PROP'];
}
//Recover some user defined properties
if (is_array($PROP)) {
foreach ($PROP as $k1 => $val1) {
if (is_array($val1)) {
foreach ($val1 as $k2 => $val2) {
$text_name = preg_replace("/([^a-z0-9])/is", "_", "PROP[" . $k1 . "][" . $k2 . "][VALUE][TEXT]");
示例12: array
if ($catalogIncluded) {
$arSort = array_merge($arSort, CCatalogIBlockParameters::GetCatalogSortFields());
$arPrice = CCatalogIBlockParameters::getPriceTypesList();
} else {
$arPrice = $arProperty_N;
}
$arIBlock_LINK = array();
$iblockFilter = !empty($arCurrentValues['LINK_IBLOCK_TYPE']) ? array('TYPE' => $arCurrentValues['LINK_IBLOCK_TYPE'], 'ACTIVE' => 'Y') : array('ACTIVE' => 'Y');
$rsIblock = CIBlock::GetList(array('SORT' => 'ASC'), $iblockFilter);
while ($arr = $rsIblock->Fetch()) {
$arIBlock_LINK[$arr['ID']] = '[' . $arr['ID'] . '] ' . $arr['NAME'];
}
unset($iblockFilter);
$arProperty_LINK = array();
if (!empty($arCurrentValues['LINK_IBLOCK_ID']) && (int) $arCurrentValues['LINK_IBLOCK_ID'] > 0) {
$propertyIterator = Iblock\PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID', 'NAME', 'CODE', 'PROPERTY_TYPE', 'MULTIPLE', 'LINK_IBLOCK_ID', 'USER_TYPE'), 'filter' => array('=IBLOCK_ID' => $arCurrentValues['LINK_IBLOCK_ID'], '=PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_ELEMENT, '=ACTIVE' => 'Y'), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')));
while ($property = $propertyIterator->fetch()) {
$propertyCode = (string) $property['CODE'];
if ($propertyCode == '') {
$propertyCode = $property['ID'];
}
$arProperty_LINK[$propertyCode] = '[' . $propertyCode . '] ' . $property['NAME'];
}
unset($propertyCode, $property, $propertyIterator);
}
$arAscDesc = array("asc" => GetMessage("IBLOCK_SORT_ASC"), "desc" => GetMessage("IBLOCK_SORT_DESC"));
$arComponentParameters = array("GROUPS" => array("ACTION_SETTINGS" => array("NAME" => GetMessage('IBLOCK_ACTIONS')), "COMPARE" => array("NAME" => GetMessage("IBLOCK_COMPARE")), "PRICES" => array("NAME" => GetMessage("IBLOCK_PRICES")), "BASKET" => array("NAME" => GetMessage("IBLOCK_BASKET")), "LINK" => array("NAME" => GetMessage("IBLOCK_LINK"))), "PARAMETERS" => array("SEF_MODE" => array(), "SEF_RULE" => array("VALUES" => array("SECTION_ID" => array("TEXT" => GetMessage("IBLOCK_SECTION_ID"), "TEMPLATE" => "#SECTION_ID#", "PARAMETER_LINK" => "SECTION_ID", "PARAMETER_VALUE" => '={$_REQUEST["SECTION_ID"]}'), "SECTION_CODE" => array("TEXT" => GetMessage("IBLOCK_SECTION_CODE"), "TEMPLATE" => "#SECTION_CODE#", "PARAMETER_LINK" => "SECTION_CODE", "PARAMETER_VALUE" => '={$_REQUEST["SECTION_CODE"]}'), "SECTION_CODE_PATH" => array("TEXT" => GetMessage("CP_BCE_SECTION_CODE_PATH"), "TEMPLATE" => "#SECTION_CODE_PATH#", "PARAMETER_LINK" => "SECTION_CODE_PATH", "PARAMETER_VALUE" => '={$_REQUEST["SECTION_CODE_PATH"]}'), "ELEMENT_ID" => array("TEXT" => GetMessage("IBLOCK_ELEMENT_ID"), "TEMPLATE" => "#ELEMENT_ID#", "PARAMETER_LINK" => "ELEMENT_ID", "PARAMETER_VALUE" => '={$_REQUEST["ELEMENT_ID"]}'), "ELEMENT_CODE" => array("TEXT" => GetMessage("IBLOCK_ELEMENT_CODE"), "TEMPLATE" => "#ELEMENT_CODE#", "PARAMETER_LINK" => "ELEMENT_CODE", "PARAMETER_VALUE" => '={$_REQUEST["ELEMENT_CODE"]}'))), "IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("IBLOCK_TYPE"), "TYPE" => "LIST", "VALUES" => $arIBlockType, "REFRESH" => "Y"), "IBLOCK_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("IBLOCK_IBLOCK"), "TYPE" => "LIST", "ADDITIONAL_VALUES" => "Y", "VALUES" => $arIBlock, "REFRESH" => "Y"), "ELEMENT_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("IBLOCK_ELEMENT_ID"), "TYPE" => "STRING", "DEFAULT" => '={$_REQUEST["ELEMENT_ID"]}'), "ELEMENT_CODE" => array("PARENT" => "BASE", "NAME" => GetMessage("IBLOCK_ELEMENT_CODE"), "TYPE" => "STRING", "DEFAULT" => ''), "SECTION_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("IBLOCK_SECTION_ID"), "TYPE" => "STRING", "DEFAULT" => '={$_REQUEST["SECTION_ID"]}'), "SECTION_CODE" => array("PARENT" => "BASE", "NAME" => GetMessage("IBLOCK_SECTION_CODE"), "TYPE" => "STRING", "DEFAULT" => ''), "SECTION_URL" => CIBlockParameters::GetPathTemplateParam("SECTION", "SECTION_URL", GetMessage("IBLOCK_SECTION_URL"), "", "URL_TEMPLATES"), "DETAIL_URL" => CIBlockParameters::GetPathTemplateParam("DETAIL", "DETAIL_URL", GetMessage("IBLOCK_DETAIL_URL"), "", "URL_TEMPLATES"), "SECTION_ID_VARIABLE" => array("PARENT" => "URL_TEMPLATES", "NAME" => GetMessage("IBLOCK_SECTION_ID_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "SECTION_ID"), "CHECK_SECTION_ID_VARIABLE" => array("PARENT" => "URL_TEMPLATES", "NAME" => GetMessage("CP_BCE_CHECK_SECTION_ID_VARIABLE"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "SET_TITLE" => array(), "SET_CANONICAL_URL" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_SET_CANONICAL_URL"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "SET_BROWSER_TITLE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_SET_BROWSER_TITLE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "BROWSER_TITLE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_BROWSER_TITLE"), "TYPE" => "LIST", "MULTIPLE" => "N", "DEFAULT" => "-", "VALUES" => array_merge(array("-" => " ", "NAME" => GetMessage("IBLOCK_FIELD_NAME")), $arProperty_LS), "HIDDEN" => isset($arCurrentValues['SET_BROWSER_TITLE']) && $arCurrentValues['SET_BROWSER_TITLE'] == 'N' ? 'Y' : 'N'), "SET_META_KEYWORDS" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_SET_META_KEYWORDS"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "META_KEYWORDS" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("T_IBLOCK_DESC_KEYWORDS"), "TYPE" => "LIST", "MULTIPLE" => "N", "DEFAULT" => "-", "VALUES" => array_merge(array("-" => " "), $arProperty_LS), "HIDDEN" => isset($arCurrentValues['SET_META_KEYWORDS']) && $arCurrentValues['SET_META_KEYWORDS'] == 'N' ? 'Y' : 'N'), "SET_META_DESCRIPTION" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_SET_META_DESCRIPTION"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "META_DESCRIPTION" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("T_IBLOCK_DESC_DESCRIPTION"), "TYPE" => "LIST", "MULTIPLE" => "N", "DEFAULT" => "-", "VALUES" => array_merge(array("-" => " "), $arProperty_LS), "HIDDEN" => isset($arCurrentValues['SET_META_DESCRIPTION']) && $arCurrentValues['SET_META_DESCRIPTION'] == 'N' ? 'Y' : 'N'), "SET_LAST_MODIFIED" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_SET_LAST_MODIFIED"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "USE_MAIN_ELEMENT_SECTION" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_USE_MAIN_ELEMENT_SECTION"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "ADD_SECTIONS_CHAIN" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_ADD_SECTIONS_CHAIN"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "ADD_ELEMENT_CHAIN" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("CP_BCE_ADD_ELEMENT_CHAIN"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "PROPERTY_CODE" => array("PARENT" => "VISUAL", "NAME" => GetMessage("IBLOCK_PROPERTY"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arProperty, "SIZE" => count($arProperty) > 5 ? 8 : 3, "ADDITIONAL_VALUES" => "Y"), "OFFERS_FIELD_CODE" => CIBlockParameters::GetFieldCode(GetMessage("CP_BCE_OFFERS_FIELD_CODE"), "VISUAL"), "OFFERS_PROPERTY_CODE" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CP_BCE_OFFERS_PROPERTY_CODE"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arProperty_Offers, "SIZE" => count($arProperty_Offers) > 5 ? 8 : 3, "ADDITIONAL_VALUES" => "Y"), "OFFERS_SORT_FIELD" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CP_BCE_OFFERS_SORT_FIELD"), "TYPE" => "LIST", "VALUES" => $arSort, "ADDITIONAL_VALUES" => "Y", "DEFAULT" => "sort"), "OFFERS_SORT_ORDER" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CP_BCE_OFFERS_SORT_ORDER"), "TYPE" => "LIST", "VALUES" => $arAscDesc, "DEFAULT" => "asc", "ADDITIONAL_VALUES" => "Y"), "OFFERS_SORT_FIELD2" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CP_BCE_OFFERS_SORT_FIELD2"), "TYPE" => "LIST", "VALUES" => $arSort, "ADDITIONAL_VALUES" => "Y", "DEFAULT" => "id"), "OFFERS_SORT_ORDER2" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CP_BCE_OFFERS_SORT_ORDER2"), "TYPE" => "LIST", "VALUES" => $arAscDesc, "DEFAULT" => "desc", "ADDITIONAL_VALUES" => "Y"), "OFFERS_LIMIT" => array("PARENT" => "VISUAL", "NAME" => GetMessage('CP_BCE_OFFERS_LIMIT'), "TYPE" => "STRING", "DEFAULT" => 0), "PRICE_CODE" => array("PARENT" => "PRICES", "NAME" => GetMessage("IBLOCK_PRICE_CODE"), "TYPE" => "LIST", "MULTIPLE" => "Y", "SIZE" => count($arPrice) > 5 ? 8 : 3, "VALUES" => $arPrice), "USE_PRICE_COUNT" => array("PARENT" => "PRICES", "NAME" => GetMessage("IBLOCK_USE_PRICE_COUNT"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "SHOW_PRICE_COUNT" => array("PARENT" => "PRICES", "NAME" => GetMessage("IBLOCK_SHOW_PRICE_COUNT"), "TYPE" => "STRING", "DEFAULT" => "1"), "PRICE_VAT_INCLUDE" => array("PARENT" => "PRICES", "NAME" => GetMessage("IBLOCK_VAT_INCLUDE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "PRICE_VAT_SHOW_VALUE" => array("PARENT" => "PRICES", "NAME" => GetMessage("IBLOCK_VAT_SHOW_VALUE"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "BASKET_URL" => array("PARENT" => "BASKET", "NAME" => GetMessage("IBLOCK_BASKET_URL"), "TYPE" => "STRING", "DEFAULT" => "/personal/basket.php"), "ACTION_VARIABLE" => array("PARENT" => "ACTION_SETTINGS", "NAME" => GetMessage("IBLOCK_ACTION_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "action"), "PRODUCT_ID_VARIABLE" => array("PARENT" => "ACTION_SETTINGS", "NAME" => GetMessage("IBLOCK_PRODUCT_ID_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "id"), "USE_PRODUCT_QUANTITY" => array("PARENT" => "BASKET", "NAME" => GetMessage("CP_BCE_USE_PRODUCT_QUANTITY"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"), "PRODUCT_QUANTITY_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CP_BCE_PRODUCT_QUANTITY_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "quantity", "HIDDEN" => isset($arCurrentValues['USE_PRODUCT_QUANTITY']) && $arCurrentValues['USE_PRODUCT_QUANTITY'] == 'Y' ? 'N' : 'Y'), "ADD_PROPERTIES_TO_BASKET" => array("PARENT" => "BASKET", "NAME" => GetMessage("CP_BCE_ADD_PROPERTIES_TO_BASKET"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "PRODUCT_PROPS_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CP_BCE_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("CP_BCE_PARTIAL_PRODUCT_PROPERTIES"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "HIDDEN" => isset($arCurrentValues['ADD_PROPERTIES_TO_BASKET']) && $arCurrentValues['ADD_PROPERTIES_TO_BASKET'] == 'N' ? 'Y' : 'N'), "PRODUCT_PROPERTIES" => array("PARENT" => "BASKET", "NAME" => GetMessage("CP_BCE_PRODUCT_PROPERTIES"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arProperty_X, "SIZE" => count($arProperty_X) > 5 ? 8 : 3, "HIDDEN" => isset($arCurrentValues['ADD_PROPERTIES_TO_BASKET']) && $arCurrentValues['ADD_PROPERTIES_TO_BASKET'] == 'N' ? 'Y' : 'N'), "DISPLAY_COMPARE" => array("PARENT" => "COMPARE", "NAME" => GetMessage('CP_BCE_DISPLAY_COMPARE'), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"), "LINK_IBLOCK_TYPE" => array("PARENT" => "LINK", "NAME" => GetMessage("IBLOCK_LINK_IBLOCK_TYPE"), "TYPE" => "LIST", "ADDITIONAL_VALUES" => "Y", "VALUES" => $arIBlockType, "REFRESH" => "Y"), "LINK_IBLOCK_ID" => array("PARENT" => "LINK", "NAME" => GetMessage("IBLOCK_LINK_IBLOCK_ID"), "TYPE" => "LIST", "ADDITIONAL_VALUES" => "Y", "VALUES" => $arIBlock_LINK, "REFRESH" => "Y"), "LINK_PROPERTY_SID" => array("PARENT" => "LINK", "NAME" => GetMessage("IBLOCK_LINK_PROPERTY_SID"), "TYPE" => "LIST", "ADDITIONAL_VALUES" => "Y", "VALUES" => $arProperty_LINK), "LINK_ELEMENTS_URL" => array("PARENT" => "LINK", "NAME" => GetMessage("IBLOCK_LINK_ELEMENTS_URL"), "TYPE" => "STRING", "DEFAULT" => "link.php?PARENT_ELEMENT_ID=#ELEMENT_ID#"), "BACKGROUND_IMAGE" => array("PARENT" => "VISUAL", "NAME" => GetMessage("T_IBLOCK_BACKGROUND_IMAGE"), "TYPE" => "LIST", "MULTIPLE" => "N", "DEFAULT" => "-", "VALUES" => array_merge(array("-" => " "), $arProperty_F)), "CACHE_TIME" => array("DEFAULT" => 36000000), "CACHE_GROUPS" => array("PARENT" => "CACHE_SETTINGS", "NAME" => GetMessage("CP_BCE_CACHE_GROUPS"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "USE_ELEMENT_COUNTER" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage('CP_BCE_USE_ELEMENT_COUNTER'), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "SHOW_DEACTIVATED" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage('CP_BCE_SHOW_DEACTIVATED'), "TYPE" => "CHECKBOX", "DEFAULT" => "N")));
if ($arCurrentValues["SEF_MODE"] == "Y") {
$arComponentParameters["PARAMETERS"]["SECTION_CODE_PATH"] = array("NAME" => GetMessage("CP_BCE_SECTION_CODE_PATH"), "TYPE" => "STRING", "DEFAULT" => "");
}
if ($catalogIncluded) {
示例13: getIblockProps
private function getIblockProps($iblockID)
{
$arProps = [];
$propsOb = \Bitrix\Iblock\PropertyTable::getList(['filter' => ['IBLOCK_ID' => $iblockID, 'ACTIVE' => 'Y'], 'select' => ['NAME', 'CODE', 'ID']]);
while ($props = $propsOb->fetch()) {
$arProps[$props['CODE']] = $props['ID'];
}
return $arProps;
}
示例14: getVisibleColumns
protected function getVisibleColumns()
{
if (self::$iblockIncluded === null) {
self::$iblockIncluded = Main\Loader::includeModule('iblock');
}
if (!self::$iblockIncluded) {
return array();
}
$result = array();
$arTmpColumns = array();
$arColumnsOptions = static::loadVisibleColumns($this->idPrefix);
if (is_array($arColumnsOptions) && isset($arColumnsOptions["columns"]) && strlen($arColumnsOptions["columns"]) > 0) {
$arTmpColumns = explode(",", $arColumnsOptions["columns"]);
}
if (is_array($arTmpColumns) && !empty($arTmpColumns)) {
$arTmpColumns = explode(",", $arColumnsOptions["columns"]);
$iBlockProps = array();
foreach ($arTmpColumns as $id => $columnCode) {
if (substr($columnCode, 0, 9) == "PROPERTY_") {
$iBlockProps[] = substr($columnCode, 9);
} else {
$result[$columnCode] = Loc::getMessage("SALE_ORDER_BASKET_SETTINGS_COL_" . $columnCode);
}
}
$dbRes = \Bitrix\Iblock\PropertyTable::getList(array('filter' => array('=CODE' => $iBlockProps), 'select' => array('ID', 'NAME', 'CODE')));
while ($arPropData = $dbRes->fetch()) {
$result["PROPERTY_" . $arPropData['CODE']] = $arPropData["NAME"];
}
} else {
$result = static::getDefaultVisibleColumns();
}
return $result;
}
示例15: unset
if ($propertyCode == '') {
$propertyCode = $property['ID'];
}
$propertyName = '[' . $propertyCode . '] ' . $property['NAME'];
$arProperty[$propertyCode] = $propertyName;
if ($property['PROPERTY_TYPE'] == Iblock\PropertyTable::TYPE_NUMBER) {
$arProperty_N[$propertyCode] = $propertyName;
}
}
unset($propertyCode, $propertyName, $property, $propertyIterator);
}
$arOffers = CIBlockPriceTools::GetOffersIBlock($arCurrentValues["IBLOCK_ID"]);
$OFFERS_IBLOCK_ID = is_array($arOffers) ? $arOffers["OFFERS_IBLOCK_ID"] : 0;
$arProperty_Offers = array();
if ($OFFERS_IBLOCK_ID) {
$propertyIterator = Iblock\PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID', 'NAME', 'CODE', 'PROPERTY_TYPE'), 'filter' => array('=IBLOCK_ID' => $OFFERS_IBLOCK_ID, '=ACTIVE' => 'Y', '!=PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_FILE), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')));
while ($property = $propertyIterator->fetch()) {
$propertyCode = (string) $property['CODE'];
if ($propertyCode == '') {
$propertyCode = $property['ID'];
}
$propertyName = '[' . $propertyCode . '] ' . $property['NAME'];
$arProperty_Offers[$propertyCode] = $propertyName;
}
unset($propertyCode, $propertyName, $property, $propertyIterator);
}
$arSort = CIBlockParameters::GetElementSortFields(array('SHOWS', 'SORT', 'TIMESTAMP_X', 'NAME', 'ID', 'ACTIVE_FROM', 'ACTIVE_TO'), array('KEY_LOWERCASE' => 'Y'));
$arPrice = array();
if ($boolCatalog) {
$arSort = array_merge($arSort, CCatalogIBlockParameters::GetCatalogSortFields());
$arPrice = CCatalogIBlockParameters::getPriceTypesList();