本文整理汇总了PHP中CIBlock::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetList方法的具体用法?PHP CIBlock::GetList怎么用?PHP CIBlock::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateAddCode
/**
* Генерация создания
*
* generateAddCode
* @param array $params
* @return string
* @throws \Exception
*/
public function generateAddCode($params)
{
$this->checkParams($params);
$return = "";
$hlBlockData = $this->ownerItemDbData['hlblockData'];
if ($hlFieldData = $this->ownerItemDbData['hlFieldData']) {
unset($hlFieldData['ID']);
unset($hlFieldData['ENTITY_ID']);
# add iblock code to
if (($hlFieldData['USER_TYPE_ID'] == "iblock_element" || $hlFieldData['USER_TYPE_ID'] == "iblock_section") && isset($hlFieldData['SETTINGS']['IBLOCK_ID'])) {
if (!empty($hlFieldData['SETTINGS']['IBLOCK_ID'])) {
$iblockId = $hlFieldData['SETTINGS']['IBLOCK_ID'];
unset($hlFieldData['SETTINGS']['IBLOCK_ID']);
$rsIBlock = $this->iblock->GetList(array(), array('ID' => $iblockId, 'CHECK_PERMISSIONS' => 'N'));
if ($arIBlock = $rsIBlock->Fetch()) {
$hlFieldData['SETTINGS']['IBLOCK_CODE'] = $arIBlock['CODE'];
} else {
throw new BimException(' Not found iblock with id ' . $iblockId);
}
}
}
$return = $this->getMethodContent('Bim\\Db\\Iblock\\HighloadblockFieldIntegrate', 'Add', array($hlBlockData['NAME'], $hlFieldData));
}
return $return;
}
示例2: generateAddCode
/**
* Генерация создания Информационного блока
*
* generateAddCode
* @param array $IblockCode
* @return bool|string
*/
public function generateAddCode($IblockCode)
{
$return = array();
$iblockObject = $this->iblock->GetList(array(), array('CODE' => $IblockCode, 'CHECK_PERMISSIONS' => 'N'));
if ($item = $iblockObject->Fetch()) {
# Установка групп пользователей
$this->setUserGroupId($item['ID'], $item);
$item['FIELDS'] = \CIBlock::GetFields($item['ID']);
Helper::unsetFields(array('ID'), $item);
if ($return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Add', array($item))) {
$IblockProperty = new \CIBlockProperty();
$iblockPropertyQuery = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $item['CODE']));
while ($iblockProperty = $iblockPropertyQuery->Fetch()) {
Helper::unsetFields(array('ID'), $iblockProperty);
$iblockProperty['IBLOCK_CODE'] = $item['CODE'];
$propertyQuery = \CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $iblockProperty['IBLOCK_ID'], "CODE" => $iblockProperty['CODE']));
while ($propertyValues = $propertyQuery->Fetch()) {
Helper::unsetFields(array('ID', 'PROPERTY_ID'), $propertyValues);
$iblockProperty['VALUES'][] = $propertyValues;
}
if (!is_null($iblockProperty['LINK_IBLOCK_ID'])) {
$linkedIBlock = $this->iblock->GetList(array(), array('ID' => $iblockProperty['LINK_IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'))->Fetch();
$iblockProperty['LINK_IBLOCK_CODE'] = $linkedIBlock['CODE'];
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($iblockProperty));
}
return implode(PHP_EOL, $return);
} else {
return false;
}
} else {
return false;
}
}
示例3: generateAddCode
/**
* Генерация создания
*
* generateAddCode
* @param array $hlBlockId
* @return string
* @throws \Exception
*/
public function generateAddCode($hlBlockId)
{
$return = array();
$hlBlock = HL\HighloadBlockTable::getById($hlBlockId)->fetch();
if (!$hlBlock) {
throw new BimException('Not found highload block with id = ' . $hlBlockId);
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\HighloadblockIntegrate', 'Add', array($hlBlock['NAME'], $hlBlock['TABLE_NAME']));
$hlQuery = $this->userType->GetList(array(), array("ENTITY_ID" => "HLBLOCK_" . $hlBlockId));
while ($hlData = $hlQuery->Fetch()) {
$fullData = $this->userType->GetByID($hlData['ID']);
unset($fullData['ID']);
unset($fullData['ENTITY_ID']);
if (($fullData['USER_TYPE_ID'] == "iblock_element" || $fullData['USER_TYPE_ID'] == "iblock_section") && isset($fullData['SETTINGS']['IBLOCK_ID'])) {
if (!empty($fullData['SETTINGS']['IBLOCK_ID'])) {
$iblockId = $fullData['SETTINGS']['IBLOCK_ID'];
unset($fullData['SETTINGS']['IBLOCK_ID']);
$blockQuery = $this->iblock->GetList(array(), array('ID' => $iblockId, 'CHECK_PERMISSIONS' => 'N'));
if ($iBlockData = $blockQuery->Fetch()) {
$fullData['SETTINGS']['IBLOCK_CODE'] = $iBlockData['CODE'];
} else {
throw new BimException(' Not found iblock with id ' . $iblockId);
}
}
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\HighloadblockFieldIntegrate', 'Add', array($hlBlock['NAME'], $fullData));
}
return implode(PHP_EOL, $return);
}
示例4: Add
/**
* Add
* @param $arFields
* @return bool
* @throws \Exception
*/
public static function Add($arFields)
{
$iblock = new \CIBlock();
if (isset($arFields['SORT'])) {
if (!is_int($arFields['SORT'])) {
if (intval($arFields['SORT'])) {
$arFields['SORT'] = intval($arFields['SORT']);
} else {
$arFields['SORT'] = 500;
}
}
} else {
$arFields['SORT'] = 500;
}
# default
$arDefaultValues = array('MULTIPLE' => false, 'IS_REQUIRED' => false, 'ACTIVE' => true, 'PROPERTY_TYPE' => 'S', 'USER_TYPE' => false, 'FILE_TYPE' => '', 'LIST_TYPE' => 'L', 'ROW_COUNT' => 1, 'COL_COUNT' => 30, 'LINK_IBLOCK_ID' => null, 'DEFAULT_VALUE' => null, 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'MULTIPLE_CNT' => 5, 'HINT' => '', 'SECTION_PROPERTY' => 'Y', 'SMART_FILTER' => 'N', 'USER_TYPE_SETTINGS' => array(), 'VALUES' => array());
if ($arFields['IBLOCK_CODE']) {
unset($arFields['IBLOCK_ID']);
$rsIBlock = $iblock->GetList(array(), array('CODE' => $arFields['IBLOCK_CODE'], 'CHECK_PERMISSIONS' => 'N'));
if ($arIBlock = $rsIBlock->Fetch()) {
$arFields['IBLOCK_ID'] = $arIBlock['ID'];
} else {
throw new BimException(__METHOD__ . ' Not found iblock with code ' . $arFields['IBLOCK_CODE']);
}
}
if (!strlen($arFields['CODE'])) {
throw new BimException(__METHOD__ . ' Not found property code');
}
$iblockPropDbRes = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $arFields['IBLOCK_ID'], 'CODE' => $arFields['CODE']));
if ($iblockPropDbRes !== false && $iblockPropDbRes->SelectedRowsCount()) {
throw new BimException(__METHOD__ . 'Property with code = "' . $arFields['CODE'] . '" ');
}
if ($arFields['LINK_IBLOCK_CODE']) {
unset($arFields['LINK_IBLOCK_ID']);
$rsIBlock = $iblock->GetList(array(), array('CODE' => $arFields['LINK_IBLOCK_CODE'], 'CHECK_PERMISSIONS' => 'N'));
if ($arIBlock = $rsIBlock->Fetch()) {
$arFields['LINK_IBLOCK_ID'] = $arIBlock['ID'];
}
}
foreach ($arDefaultValues as $DefaultName => $DefaultValue) {
if (!isset($arFields[$DefaultName]) || empty($arFields[$DefaultName])) {
$arFields[$DefaultName] = $DefaultValue;
}
}
$objCIBlockProperty = new \CIBlockProperty();
unset($arFields['ID']);
$iId = $objCIBlockProperty->Add($arFields);
if ($iId) {
return $iId;
} else {
throw new BimException(__METHOD__ . ' ' . $objCIBlockProperty->LAST_ERROR);
}
}
示例5: selectIBlock
public function selectIBlock($iblockCode)
{
$this->_bIBlockSelected = false;
if (!array_key_exists($iblockCode, $this->_arConfig['IBLOCK'])) {
return false;
}
$arConfig =& $this->_arConfig['IBLOCK'][$iblockCode];
$this->_iblockCode = $iblockCode;
$this->_iblockXmlID = $arConfig['XML_ID'];
$this->_iblockType = $arConfig['IBLOCK_TYPE_ID'];
$this->_iblockXMLFile = WIZARD_RELATIVE_PATH . '/site/services/iblock/xml/' . LANGUAGE_ID . '/' . $arConfig['XML_FILE'];
$this->_iblockXMLDir = WIZARD_RELATIVE_PATH . '/site/services/iblock/xml/' . LANGUAGE_ID . '/' . str_replace('.xml', '_files', $arConfig['XML_FILE']);
$this->_iblockFormSettingsFile = WIZARD_RELATIVE_PATH . '/site/services/iblock/xml/' . LANGUAGE_ID . '/' . $arConfig['FORM_SETTINGS'];
if (!is_file($_SERVER['DOCUMENT_ROOT'] . $this->_iblockXMLFile) || !file_exists($_SERVER['DOCUMENT_ROOT'] . $this->_iblockXMLFile)) {
return false;
}
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->_iblockXMLDir) || !file_exists($_SERVER['DOCUMENT_ROOT'] . $this->_iblockXMLDir)) {
return false;
}
$rsIBlock = \CIBlock::GetList(array(), array("XML_ID" => $this->_iblockXmlID, "TYPE" => $this->_iblockType));
if ($arIBlock = $rsIBlock->Fetch()) {
$this->_iblockID = $arIBlock['ID'];
}
$this->_bIBlockSelected = true;
return true;
}
示例6: storeResult
function storeResult($arResult, $arParams) {
$iblock = CIBlock::GetList(
array(),
array(
'TYPE' => $arParams['IBLOCK_TYPE'],
'CODE' => $arParams['IBLOCK_CODE'],
)
);
$iblock = $iblock->Fetch();
$el = new CIBlockElement;
$props = array();
foreach ($arResult['FIELDS_LIST'] as $arField) {
if ($arField['FIELD_TYPE'] == 'TEXT' || $arField['FIELD_TYPE'] == 'NUMBER') {
$props[$arField['CODE']] = array(
'VALUE' => $arResult['POST_DATA']['~'.$arField['CODE']],
);
} elseif ($arField['FIELD_TYPE'] == 'TEXTAREA') {
$props[$arField['CODE']] = array(
'VALUE' => array(
'TYPE' => 'text',
'TEXT' => $arResult['POST_DATA']['~'.$arField['CODE']],
),
);
} elseif ($arField['FIELD_TYPE'] == 'LIST') {
$propEnum = CIBlockPropertyEnum::GetList(
array(),
array(
'XML_ID' => $arResult['POST_DATA']['~'.$arField['CODE']],
'CODE' => $arField['CODE'],
'IBLOCK_ID' => $iblock['ID'],
)
);
$propEnum = $propEnum->Fetch();
if ( ! $propEnum) return false;
$props[$arField['CODE']] = array(
'VALUE' => $propEnum['ID'],
);
}
}
$res = $el->Add(array(
'IBLOCK_TYPE' => $arParams['IBLOCK_TYPE'],
'IBLOCK_ID' => $iblock['ID'],
'ACTIVE' => 'Y',
'PROPERTY_VALUES' => $props,
'ACTIVE_FROM' => ConvertTimeStamp(time()+CTimeZone::GetOffset(), 'FULL'),
'NAME' => 'Form result', # !!! NEED TO REPLACE TO DEFAULT VALUE
));
if (!$res) {
return array(
'MESSAGE' => $el->LAST_ERROR,
);
}
return true;
}
示例7: findBy
/**
* Ищент инфоблок по указанному фильтру и добавляет его в общий список
* @param array $filter
* @return array
*/
protected static function findBy(array $filter)
{
if (!\CModule::IncludeModule('iblock')) {
return null;
}
$res = \CIBlock::GetList(array(), array_merge($filter, ['CHECK_PERMISSIONS' => 'N']), false);
if ($ob = $res->GetNext()) {
$iblock = array();
foreach ($ob as $key => $value) {
if (strpos($key, '~') !== 0) {
continue;
}
$iblock[substr($key, 1)] = $value;
}
$pRes = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $ob['ID']));
while ($pOb = $pRes->GetNext()) {
$property = array();
foreach ($pOb as $key => $value) {
if (strpos($key, '~') !== 0) {
continue;
}
$property[substr($key, 1)] = $value;
}
$iblock['PROPERTIES'][] = $property;
}
self::$_list[] = $iblock;
return $iblock;
}
return null;
}
示例8: GetIBlockTypes
public function GetIBlockTypes($lid, $catalogOnly = true, $hideOffers = true)
{
CModule::IncludeModule("iblock");
$arTypeAll = array();
$dbIBlock = CIBlock::GetList(array("IBLOCK_TYPE" => "ASC", "NAME" => "ASC"), array("LID" => $lid));
while ($arIBlock = $dbIBlock->Fetch()) {
if (true == $catalogOnly) {
if (CModule::IncludeModule("catalog") && CCatalog::GetByID($arIBlock["ID"])) {
if ($hideOffers == true && CCatalogSKU::GetInfoByOfferIBlock($arIBlock["ID"])) {
continue;
}
$arTypeIblock[] = $arIBlock;
}
} else {
$arTypeIblock[] = $arIBlock;
}
}
unset($dbIBlock);
foreach ($arTypeIblock as $arIBlock) {
$arType = CIBlockType::GetByIDLang($arIBlock["IBLOCK_TYPE_ID"], LANG);
$arTypeAll[$arType["ID"]]["ID"] = $arType["ID"];
$arTypeAll[$arType["ID"]]["NAME"] = "{$arType["NAME"]} [{$arType["ID"]}]";
$arTypeAll[$arType["ID"]]["IBLOCK"][$arIBlock["ID"]] = "{$arIBlock["NAME"]} [{$arIBlock["ID"]}]";
unset($arType);
}
unset($arTypeIblock);
return $arTypeAll;
}
示例9: Init
function Init(&$next_step, $files_dir, $arParams = array())
{
$this->next_step =& $next_step;
$this->files_dir = $files_dir;
$this->arParams = $arParams;
//if (is_array($this->next_step['_TEMPORARY']['DEPARTMENTS']))
$this->arSectionCache =& $this->next_step['_TEMPORARY']['DEPARTMENTS'];
$this->DEPARTMENTS_IBLOCK_ID = $this->arParams['DEPARTMENTS_IBLOCK_ID'];
$this->ABSENCE_IBLOCK_ID = $this->arParams['ABSENCE_IBLOCK_ID'];
$this->STATE_HISTORY_IBLOCK_ID = $this->arParams['STATE_HISTORY_IBLOCK_ID'];
$dbRes = CIBlock::GetList(array(), array('TYPE' => $arParams['IBLOCK_TYPE'] ? $arParams['IBLOCK_TYPE'] : 'STRUCTURE', 'ID' => array($this->DEPARTMENTS_IBLOCK_ID, $this->ABSENCE_IBLOCK_ID, $this->STATE_HISTORY_IBLOCK_ID)));
$bError = false;
if (intval($dbRes->SelectedRowsCount()) < 3) {
if (ToUpper($GLOBALS['DBType']) != 'MYSQL') {
$i = 0;
while ($arRes = $dbRes->Fetch()) {
$i++;
}
$bError = $i < 3;
} else {
$bError = true;
}
}
if ($bError) {
$GLOBALS['APPLICATION']->ThrowException(GetMessage('IBLOCK_XML2_USER_ERROR_IBLOCK_MISSING'));
return false;
}
$def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
if ($def_group != "") {
$this->arUserGroups = explode(",", $def_group);
}
return true;
}
示例10: generateAddCode
/**
* Генерация создания
*
* generateAddCode
* @param array $IblockTypeId
* @return bool|string
*/
public function generateAddCode($IblockTypeId)
{
$iBlock = new \CIBlock();
$CIblockType = new \CIBlockType();
$lang = new \CLanguage();
$return = array();
$dbIblockType = $CIblockType->GetByID($IblockTypeId);
if ($arIblockType = $dbIblockType->GetNext()) {
$Iblock = new \CIBlock();
$dbIblock = $Iblock->GetList(array(), array('TYPE' => $IblockTypeId, 'CHECK_PERMISSIONS' => 'N'));
while ($arIblock = $dbIblock->GetNext()) {
$IblockProperty = new \CIBlockProperty();
$dbIblockProperty = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $arIblock['CODE'], 'CHECK_PERMISSIONS' => 'N'));
while ($arIblockProperty = $dbIblockProperty->GetNext()) {
$dbPropertyValues = \CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $arIblockProperty['IBLOCK_ID'], "CODE" => $arIblockProperty['CODE']));
while ($arPropertyValues = $dbPropertyValues->Fetch()) {
$arIblockProperty['VALUES'][$arPropertyValues['ID']] = $arPropertyValues;
}
Helper::unsetFields(array('ID', '~ID', 'IBLOCK_ID', '~IBLOCK_ID'), $arIblockProperty);
$arIblockProperty['IBLOCK_CODE'] = $arIblock['CODE'];
foreach ($arIblockProperty as $k => $v) {
if (strstr($k, "~") || is_null($v)) {
unset($arIblockProperty[$k]);
}
}
if (isset($arIblockProperty['LINK_IBLOCK_ID'])) {
$res = $iBlock->GetList(array(), array("ID" => $arIblockProperty['LINK_IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'));
if ($ar_res = $res->GetNext()) {
unset($arIblockProperty['LINK_IBLOCK_ID']);
$arIblockProperty['LINK_IBLOCK_CODE'] = $ar_res['CODE'];
}
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($arIblockProperty));
}
foreach ($arIblock as $k => $v) {
if (strstr($k, "~") || $k == 'ID') {
unset($arIblock[$k]);
}
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Add', array($arIblock));
}
foreach ($arIblockType as $k => $v) {
if (strstr($k, "~") || is_null($v)) {
unset($arIblockType[$k]);
}
}
$rsLang = $lang->GetList($by = "lid", $order = "desc");
while ($arLang = $rsLang->Fetch()) {
$arTypeLang = $CIblockType->GetByIDLang($IblockTypeId, $arLang['LID']);
$arIblockType["LANG"][$arLang['LID']] = array('NAME' => $arTypeLang['NAME'], 'SECTION_NAME' => $arTypeLang['SECTION_NAME'], 'ELEMENT_NAME' => $arTypeLang['ELEMENT_NAME']);
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockTypeIntegrate', 'Add', array($arIblockType));
$return = array_reverse($return);
return implode(PHP_EOL, $return);
} else {
return false;
}
}
示例11: showIblockListSelect
static function showIblockListSelect()
{
$res = CIBlock::GetList(array("ID" => "ASC"), array(), false);
echo '<select name="IBLOCK_ID">';
while ($ar_res = $res->Fetch()) {
echo "<option value='{$ar_res['ID']}'>[{$ar_res['ID']}] {$ar_res['NAME']}</option>";
}
echo '</select>';
}
示例12: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$type = $input->getArgument('type');
\CModule::IncludeModule('iblock');
$resIBlocks = \CIBlock::GetList(array('NAME' => 'asc'), array('TYPE' => $type));
while ($arIBlock = $resIBlocks->Fetch()) {
$output->writeln("<info>" . $arIBlock['NAME'] . " (" . $arIBlock['ID'] . ") </info>");
}
}
示例13: _getIblocks
/**
* Собирает массив индентификаторов инфоблоков CODE => ID
* @return array Массив идентификаторов инфоблоков в виде array(CODE => ID)
*/
function _getIblocks()
{
$resIblocks = \CIBlock::GetList(array('ID' => 'ASC'), array());
$arIb = array();
while ($ar = $resIblocks->Fetch()) {
$arIb[$ar['CODE']] = $ar['ID'];
}
return $arIb;
}
示例14: GetIdByCode
/**
* @param string $code код инфблока
* @return int ID инфоблока
*/
public static function GetIdByCode($code)
{
$res = CIBlock::GetList(array(), array('TYPE' => 'bizproc_iblockx', 'SITE_ID' => SITE_ID, 'ACTIVE' => 'Y', "CODE" => $code), true);
if (empty($res)) {
ShowError("Инфоблок с кодом=" . $code . " не найден");
return 0;
}
$data = $res->GetNext();
return $data["ID"];
}
示例15: getIblocks
public function getIblocks($filter = array())
{
$filter['CHECK_PERMISSIONS'] = 'N';
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$dbResult = \CIBlock::GetList(array('SORT' => 'ASC'), $filter);
$list = array();
while ($aItem = $dbResult->Fetch()) {
$list[] = $aItem;
}
return $list;
}