示例#1
0
 protected function loadFromDatabase()
 {
     if (!isset($this->fields)) {
         $elementList = \Bitrix\Iblock\IblockTable::getList(array("select" => array_values($this->fieldMap), "filter" => array("=ID" => $this->id)));
         $this->fields = $elementList->fetch();
     }
     return is_array($this->fields);
 }
 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'));
 }
 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
0
 /**
  * Check property description before create.
  *
  * @param array $propertyDescription		Property description.
  * @return bool
  */
 public static function validatePropertyDescription($propertyDescription)
 {
     if (empty($propertyDescription) || !isset($propertyDescription['CODE'])) {
         return false;
     }
     $checkResult = true;
     switch ($propertyDescription['CODE']) {
         case self::CODE_SKU_LINK:
             if (!isset($propertyDescription['LINK_IBLOCK_ID']) || $propertyDescription['LINK_IBLOCK_ID'] <= 0 || $propertyDescription['LINK_IBLOCK_ID'] == $propertyDescription['IBLOCK_ID']) {
                 $checkResult = false;
             }
             if ($checkResult) {
                 $iblockIterator = Iblock\IblockTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => $propertyDescription['LINK_IBLOCK_ID'])));
                 if (!($iblock = $iblockIterator->fetch())) {
                     $checkResult = false;
                 }
             }
             break;
         case self::CODE_MORE_PHOTO:
         case self::CODE_BLOG_POST:
         case self::CODE_BLOG_COMMENTS_COUNT:
             $checkResult = true;
             break;
         default:
             $checkResult = false;
             break;
     }
     return $checkResult;
 }
 public function testDelete()
 {
     $this->_applyFixtures(self::FIXTURE_TYPE_SECTION_DELETE);
     $rsSection = SectionTable::getList(array('filter' => array('=IBLOCK_ID' => $this->_processIblockId)));
     $this->assertEmpty($rsSection->getSelectedRowsCount(), $this->errorMessage('section should not be'));
     $this->_applyFixtures(self::FIXTURE_TYPE_PROPERTY_DELETE);
     $rsProps = PropertyTable::getList(array('filter' => array('=IBLOCK_ID' => $this->_processIblockId)));
     $this->assertEquals($rsProps->getSelectedRowsCount(), 1, $this->errorMessage('in the information block is only one property'));
     $dbList = \CIBlock::GetList();
     $ibCountBefore = $dbList->SelectedRowsCount();
     $this->_applyFixtures(self::FIXTURE_TYPE_IBLOCK_DELETE);
     $dbList = \CIBlock::GetList();
     $ibCountAfter = $dbList->SelectedRowsCount();
     $this->assertNotEquals($ibCountBefore, $ibCountAfter, $this->errorMessage('iblock not been deleted'));
     $arIblock = IblockTable::getList(array('filter' => array('=ID' => $this->_processIblockId)))->fetch();
     $this->assertEmpty($arIblock, $this->errorMessage('iblock exists'));
 }
示例#6
0
$res = false;
$iblockDropDown = array();
$iblockFilter = array('=PROPERTY_INDEX' => 'I');
if (Loader::includeModule('catalog')) {
    $OfferIblocks = array();
    $offersIterator = \Bitrix\Catalog\CatalogIblockTable::getList(array('select' => array('IBLOCK_ID'), 'filter' => array('!PRODUCT_IBLOCK_ID' => 0)));
    while ($offer = $offersIterator->fetch()) {
        $OfferIblocks[] = (int) $offer['IBLOCK_ID'];
    }
    if (!empty($OfferIblocks)) {
        unset($offer);
        $iblockFilter['!ID'] = $OfferIblocks;
    }
    unset($offersIterator, $OfferIblocks);
}
$iblockList = \Bitrix\Iblock\IblockTable::getList(array('select' => array('ID', 'NAME', 'ACTIVE'), 'filter' => $iblockFilter, 'order' => array('ID' => 'asc', 'NAME' => 'asc')));
while ($iblockInfo = $iblockList->fetch()) {
    $iblockDropDown[$iblockInfo['ID']] = '[' . $iblockInfo['ID'] . '] ' . $iblockInfo['NAME'] . ($iblockInfo['ACTIVE'] == 'N' ? ' (' . GetMessage('IBLOCK_REINDEX_DEACTIVE') . ')' : '');
}
unset($iblockInfo, $iblockList);
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["Reindex"] == "Y") {
    CUtil::JSPostUnescape();
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_js.php";
    if (empty($iblockDropDown)) {
        $message = new CAdminMessage(array("MESSAGE" => GetMessage("IBLOCK_REINDEX_COMPLETE"), "DETAILS" => GetMessage("IBLOCK_REINDEX_TOTAL_COMPLETE"), "HTML" => true, "TYPE" => "OK"));
        echo $message->Show();
    } else {
        if (!isset($iblockDropDown[$IBLOCK_ID])) {
            $IBLOCK_ID = key($iblockDropDown);
        }
        $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_ID);
示例#7
0
 /**
  * Adds admin users notification about index rebuild.
  *
  * @param boolean $force Whenever skip iblock check.
  *
  * @return void
  */
 public static function checkAdminNotification($force = false)
 {
     if ($force) {
         $add = true;
     } else {
         $iblockList = \Bitrix\Iblock\IblockTable::getList(array('select' => array('ID'), 'filter' => array('=PROPERTY_INDEX' => 'I')));
         $add = $iblockList->fetch() ? true : false;
     }
     if ($add) {
         $notifyList = \CAdminNotify::getList(array(), array("TAG" => "iblock_property_reindex"));
         if (!$notifyList->fetch()) {
             \CAdminNotify::add(array("MESSAGE" => Loc::getMessage("IBLOCK_NOTIFY_PROPERTY_REINDEX", array("#LINK#" => "/bitrix/admin/iblock_reindex.php?lang=" . \Bitrix\Main\Application::getInstance()->getContext()->getLanguage())), "TAG" => "iblock_property_reindex", "MODULE_ID" => "iblock", "ENABLE_CLOSE" => "Y", "PUBLIC_SECTION" => "N"));
         }
     } else {
         \CAdminNotify::deleteByTag("iblock_property_reindex");
     }
 }
示例#8
0
    /**
     * @return string
     * @throws \Bitrix\Main\ArgumentException
     */
    public function getForm()
    {
        /*
         * select iblock list
         */
        $iblockList = array();
        $iblockDb = IblockTable::getList(array('select' => array('ID', 'NAME')));
        while ($iblock = $iblockDb->fetch()) {
            $iblockList[] = $iblock;
        }
        if (!empty($iblockList)) {
            $iblockList = array_merge(array(array('ID' => '', 'NAME' => Loc::getMessage('sender_connector_iblock_select'))), $iblockList);
        } else {
            $iblockList = array_merge(array(array('ID' => '', 'NAME' => Loc::getMessage('sender_connector_iblock_empty'))), $iblockList);
        }
        /*
         * select properties from all iblocks
         */
        $propertyToIblock = array();
        $propertyList = array();
        $propertyList[''][] = array('ID' => '', 'NAME' => Loc::getMessage('sender_connector_iblock_select'));
        $propertyList['EMPTY'][] = array('ID' => '', 'NAME' => Loc::getMessage('sender_connector_iblock_prop_empty'));
        $iblockFieldsDb = PropertyTable::getList(array('select' => array('ID', 'NAME', 'IBLOCK_ID'), 'filter' => array('=PROPERTY_TYPE' => PropertyTable::TYPE_STRING)));
        while ($iblockFields = $iblockFieldsDb->fetch()) {
            // add default value
            if (!array_key_exists($iblockFields['IBLOCK_ID'], $propertyList)) {
                $propertyList[$iblockFields['IBLOCK_ID']][] = array('ID' => '', 'NAME' => Loc::getMessage('sender_connector_iblock_field_select'));
            }
            // add property
            $propertyList[$iblockFields['IBLOCK_ID']][] = array('ID' => $iblockFields['ID'], 'NAME' => $iblockFields['NAME']);
            // add property link to iblock
            $propertyToIblock[$iblockFields['ID']] = $iblockFields['IBLOCK_ID'];
        }
        /*
         * create html-control of iblock list
         */
        $iblockInput = '<select name="' . $this->getFieldName('IBLOCK') . '" id="' . $this->getFieldId('IBLOCK') . '" onChange="IblockSelect' . $this->getFieldId('IBLOCK') . '()">';
        foreach ($iblockList as $iblock) {
            $inputSelected = $iblock['ID'] == $this->getFieldValue('IBLOCK') ? 'selected' : '';
            $iblockInput .= '<option value="' . $iblock['ID'] . '" ' . $inputSelected . '>';
            $iblockInput .= htmlspecialcharsbx($iblock['NAME']);
            $iblockInput .= '</option>';
        }
        $iblockInput .= '</select>';
        /*
         * create html-control of properties list for name
         */
        $iblockPropertyNameInput = '<select name="' . $this->getFieldName('PROPERTY_NAME') . '" id="' . $this->getFieldId('PROPERTY_NAME') . '">';
        if (array_key_exists($this->getFieldValue('PROPERTY_NAME', 0), $propertyToIblock)) {
            $propSet = $propertyList[$propertyToIblock[$this->getFieldValue('PROPERTY_NAME', 0)]];
        } else {
            $propSet = $propertyList[''];
        }
        foreach ($propSet as $property) {
            $inputSelected = $property['ID'] == $this->getFieldValue('PROPERTY_NAME') ? 'selected' : '';
            $iblockPropertyNameInput .= '<option value="' . $property['ID'] . '" ' . $inputSelected . '>';
            $iblockPropertyNameInput .= htmlspecialcharsbx($property['NAME']);
            $iblockPropertyNameInput .= '</option>';
        }
        $iblockPropertyNameInput .= '</select>';
        /*
         *  create html-control of properties list for email
         */
        $iblockPropertyEmailInput = '<select name="' . $this->getFieldName('PROPERTY_EMAIL') . '" id="' . $this->getFieldId('PROPERTY_EMAIL') . '">';
        if (array_key_exists($this->getFieldValue('PROPERTY_EMAIL', 0), $propertyToIblock)) {
            $propSet = $propertyList[$propertyToIblock[$this->getFieldValue('PROPERTY_EMAIL', 0)]];
        } else {
            $propSet = $propertyList[''];
        }
        foreach ($propSet as $property) {
            $inputSelected = $property['ID'] == $this->getFieldValue('PROPERTY_EMAIL') ? 'selected' : '';
            $iblockPropertyEmailInput .= '<option value="' . $property['ID'] . '" ' . $inputSelected . '>';
            $iblockPropertyEmailInput .= htmlspecialcharsbx($property['NAME']);
            $iblockPropertyEmailInput .= '</option>';
        }
        $iblockPropertyEmailInput .= '</select>';
        $jsScript = "\n\t\t<script>\n\t\t\tfunction IblockSelect" . $this->getFieldId('IBLOCK') . "()\n\t\t\t{\n\t\t\t\tvar iblock = BX('" . $this->getFieldId('IBLOCK') . "');\n\t\t\t\tIblockPropertyAdd(iblock, BX('" . $this->getFieldId('PROPERTY_NAME') . "'));\n\t\t\t\tIblockPropertyAdd(iblock, BX('" . $this->getFieldId('PROPERTY_EMAIL') . "'));\n\t\t\t}\n\t\t\tfunction IblockPropertyAdd(iblock, iblockProperty)\n\t\t\t{\n\t\t\t\tif(iblockProperty.length>0)\n\t\t\t\t{\n\t\t\t\t\tfor (var j in iblockProperty.options)\n\t\t\t\t\t{\n\t\t\t\t\t\tiblockProperty.options.remove(j);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar propList = {};\n\t\t\t\tif(iblockProperties[iblock.value] && iblockProperties[iblock.value].length>0)\n\t\t\t\t\tpropList = iblockProperties[iblock.value];\n\t\t\t\telse\n\t\t\t\t\tpropList = iblockProperties['EMPTY'];\n\t\t\t\tfor(var i in propList)\n\t\t\t\t{\n\t\t\t\t\tvar optionName = propList[i]['NAME'];\n\t\t\t\t\tvar optionValue = propList[i]['ID'];\n\t\t\t\t\tiblockProperty.options.add(new Option(optionName, optionValue));\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tvar iblockProperties = " . \CUtil::PhpToJSObject($propertyList) . ";\n\t\t</script>\n\t\t";
        return '
			' . Loc::getMessage('sender_connector_iblock_required_settings') . '
			<br/><br/>
			<table>
				<tr>
					<td>' . Loc::getMessage('sender_connector_iblock_field_iblock') . '</td>
					<td>' . $iblockInput . '</td>
				</tr>
				<tr>
					<td>' . Loc::getMessage('sender_connector_iblock_field_name') . '</td>
					<td>' . $iblockPropertyNameInput . '</td>
				</tr>
				<tr>
					<td>' . Loc::getMessage('sender_connector_iblock_field_email') . '</td>
					<td>' . $iblockPropertyEmailInput . '</td>
				</tr>
			</table>
			' . $jsScript . '
		';
    }
示例#9
0
 public function getBlockByID($IBlockId)
 {
     $listIBlock = \Bitrix\Iblock\IblockTable::getList(array(), array('ID' => $IBlockId));
     return $IBlock = $listIBlock->Fetch();
 }
示例#10
0
    $propertyID = intval($_POST['selectProperties']);
    $newTypeIBlock = $_POST['new-type-property-info-block'];
    $conversionResult = $conversionProperty($propertyID, $iblockID, $newTypeIBlock);
    $conversionResult && CAdminNotify::Add(array('MESSAGE' => 'Конвертация прошла успешно', 'TAG' => 'save_property_notify', 'MODULE_ID' => 'ws.tools', 'ENABLE_CLOSE' => 'Y'));
    !$conversionResult && CAdminNotify::Error(array('MESSAGE' => 'Конвертация не прошла успешно', 'TAG' => 'save_property_notify_error', 'MODULE_ID' => 'ws.tools', 'ENABLE_CLOSE' => 'Y'));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$jsParams = array();
$types = array();
$rsTypes = \Bitrix\Iblock\TypeLanguageTable::getList(array('filter' => array('LANGUAGE_ID' => LANG)));
while ($type = $rsTypes->fetch()) {
    $types[$type['IBLOCK_TYPE_ID']] = $type['NAME'];
}
$jsParams['types'] = array('name' => 'selectTypes', 'list' => $types);
$iblocks = array();
$rsIblocks = \Bitrix\Iblock\IblockTable::getList();
while ($iblock = $rsIblocks->fetch()) {
    $iblocks[$iblock['ID']] = array('name' => $iblock['NAME'], 'type' => $iblock['IBLOCK_TYPE_ID']);
}
$jsParams['iblocks'] = array('name' => 'selectIblocks', 'list' => $iblocks);
$properties = array();
$rsProperties = \Bitrix\Iblock\PropertyTable::getList(array('filter' => array('PROPERTY_TYPE' => \Bitrix\Iblock\PropertyTable::TYPE_STRING, 'USER_TYPE' => NULL)));
while ($property = $rsProperties->fetch()) {
    $properties[$property['ID']] = array('name' => $property['NAME'], 'iblockId' => $property['IBLOCK_ID']);
}
$jsParams['properties'] = array('name' => 'selectProperties', 'list' => $properties);
/** @var $localization \WS\Tools\Localization */
$localization;
?>
<form method="POST"
      action="<?php 
示例#11
0
Loc::loadMessages($context->getServer()->getDocumentRoot() . "/bitrix/modules/main/options.php");
Loc::loadMessages(__FILE__);
\Bitrix\Main\Loader::includeModule('iblock');
function ShowParamsHTMLByArray($arParams)
{
    foreach ($arParams as $Option) {
        __AdmSettingsDrawRow(ADMIN_MODULE_NAME, $Option);
    }
}
/*
 *
 * VALUES
 *
 * */
$debug = ['N', 'Y'];
$obIblocks = \Bitrix\Iblock\IblockTable::getList(['filter' => ['ACTIVE' => 'Y'], 'select' => ['ID', 'NAME']]);
$arIblocks = [];
while ($arIblock = $obIblocks->fetch()) {
    $arIblocks[$arIblock['ID']] = $arIblock['NAME'];
}
/**/
$tabControl = new CAdminTabControl("tabControl", [["DIV" => "edit1", "TAB" => Loc::getMessage("MAIN_TAB_SET"), "TITLE" => Loc::getMessage("MAIN_TAB_TITLE_SET")], ["DIV" => "edit2", "TAB" => Loc::getMessage("TAB_TWO"), "ICON" => "", "TITLE" => Loc::getMessage("TAB_TWO_TITLE")]]);
$arAllOptions = ["settings" => [["DEBUG", Loc::getMessage("DEBUG"), "N", ["selectbox", $debug]], ["TMP_DIR", Loc::getMessage("TMP_DIR"), "/upload/tmp_xml", ["text"]], ["XML_FILE", Loc::getMessage("XML_FILE"), "lot_info_%ID.xml", ["text"]], ["XML_DIR", Loc::getMessage("XML_DIR"), "", ["text"]], ["LOG_FILE", Loc::getMessage("LOG_FILE"), "/local/logs/lot_info", ["text"]], ["API_URL", Loc::getMessage("API_URL"), "", ["text"]], ["API_KEY", Loc::getMessage("API_KEY"), "", ["text"]], ["API_CMD", Loc::getMessage("API_CMD"), "", ["text"]], ["GET_PARAMS", Loc::getMessage("GET_PARAMS"), "", ["text"]], ["IBLOCK_ID", Loc::getMessage("IBLOCK_ID"), "N", ["selectbox", $arIblocks]], ["SITIES_ID", Loc::getMessage("SITIES_ID"), "N", ["selectbox", $arIblocks]]]];
if ($REQUEST_METHOD == "POST" && strlen($Update . $Apply . $RestoreDefaults) > 0 && check_bitrix_sessid()) {
    if (strlen($RestoreDefaults) > 0) {
        COption::RemoveOption("iblock");
    } else {
        foreach ($arAllOptions['settings'] as $arOption) {
            $name = $arOption[0];
            $val = $_REQUEST[$name];
            if ($arOption[2][0] == "checkbox" && $val != "Y") {
    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;
    }
}
$rsIBlocks = new CAdminResult(\Bitrix\Iblock\IblockTable::getList($getListParams), $sTableID);
if ($usePageNavigation) {
    $rsIBlocks->NavStart($getListParams['limit'], $navyParams['SHOW_ALL'], $navyParams['PAGEN']);
    $rsIBlocks->NavRecordCount = $totalCount;
    $rsIBlocks->NavPageCount = $totalPages;
    $rsIBlocks->NavPageNomer = $navyParams['PAGEN'];
} else {
    $rsIBlocks->NavStart();
}
// build list
$lAdmin->NavText($rsIBlocks->GetNavPrint(GetMessage("IBLOCK_RADM_IBLOCKS")));
$invalid = 0;
while ($iblockInfo = $rsIBlocks->Fetch()) {
    $row = $lAdmin->AddRow($iblockInfo["ID"], $iblockInfo);
    $row->AddViewField("ID", $iblockInfo["ID"]);
    $row->AddViewField("NAME", $iblockInfo["NAME"]);
示例#13
0
 /**
  * Deletes information blocks of given type
  * and language messages from TypeLanguageTable
  *
  * @param \Bitrix\Main\Entity\Event $event Contains information about iblock type being deleted.
  *
  * @return \Bitrix\Main\Entity\EventResult
  */
 public static function onDelete(\Bitrix\Main\Entity\Event $event)
 {
     $id = $event->getParameter("id");
     //Delete information blocks
     $iblockList = IblockTable::getList(array("select" => array("ID"), "filter" => array("=IBLOCK_TYPE_ID" => $id["ID"]), "order" => array("ID" => "DESC")));
     while ($iblock = $iblockList->fetch()) {
         $iblockDeleteResult = IblockTable::delete($iblock["ID"]);
         if (!$iblockDeleteResult->isSuccess()) {
             return $iblockDeleteResult;
         }
     }
     //Delete language messages
     $result = TypeLanguageTable::deleteByIblockTypeId($id["ID"]);
     return $result;
 }
示例#14
0
use Bitrix\Main\Localization\Loc;
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!\Bitrix\Main\Loader::includeModule('bex.bbc')) {
    return false;
}
Loc::loadMessages(__FILE__);
try {
    ComponentParameters::includeModules(['iblock']);
    $iblockTypes = CIBlockParameters::GetIBlockTypes([0 => '']);
    $iblocks = [0 => ''];
    $sections = [0 => ''];
    $elementProperties = [];
    if (isset($arCurrentValues['IBLOCK_TYPE']) && strlen($arCurrentValues['IBLOCK_TYPE'])) {
        $rsIblocks = Iblock\IblockTable::getList(['order' => ['SORT' => 'ASC', 'NAME' => 'ASC'], 'filter' => ['IBLOCK_TYPE_ID' => $arCurrentValues['IBLOCK_TYPE'], 'ACTIVE' => 'Y'], 'select' => ['ID', 'NAME']]);
        while ($iblock = $rsIblocks->fetch()) {
            $iblocks[$iblock['ID']] = $iblock['NAME'];
        }
    }
    if (isset($arCurrentValues['IBLOCK_ID']) && strlen($arCurrentValues['IBLOCK_ID'])) {
        $rsSections = Iblock\SectionTable::getList(['order' => ['SORT' => 'ASC', 'NAME' => 'ASC'], 'filter' => ['IBLOCK_ID' => $arCurrentValues['IBLOCK_ID'], 'ACTIVE' => 'Y'], 'select' => ['ID', 'NAME']]);
        while ($arSection = $rsSections->fetch()) {
            $sections[$arSection['ID']] = $arSection['NAME'];
        }
        $rsProperties = CIBlockProperty::GetList(['sort' => 'asc', 'name' => 'asc'], ['ACTIVE' => 'Y', 'IBLOCK_ID' => $arCurrentValues['IBLOCK_ID']]);
        while ($property = $rsProperties->Fetch()) {
            $elementProperties[$property['CODE']] = '[' . $property['CODE'] . '] ' . $property['NAME'];
        }
    }
    $paramElementsFields = CIBlockParameters::GetFieldCode(Loc::getMessage('ELEMENTS_LIST_FIELDS'), 'BASE');
 protected function getExistsSubjectIds()
 {
     $rs = IblockTable::getList(array('select' => array('ID')));
     $res = array();
     while ($arIblock = $rs->fetch()) {
         $res[] = $arIblock['ID'];
     }
     return $res;
 }