本文整理汇总了PHP中CIBlockType::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockType::Delete方法的具体用法?PHP CIBlockType::Delete怎么用?PHP CIBlockType::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockType
的用法示例。
在下文中一共展示了CIBlockType::Delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteIblockType
public function deleteIblockType($typeId)
{
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (\CIBlockType::Delete($typeId)) {
return true;
}
$this->throwException(__METHOD__, 'Could not delete iblock type %s', $typeId);
}
示例2: deleteIBlockType
/**
* @param string $id
*
* @throws MigrationException
*/
protected function deleteIBlockType($id)
{
/** @global $APPLICATION \CMain */
/** @global $DB \CDatabase */
global $APPLICATION;
global $DB;
$DB->StartTransaction();
if (\CIBlockType::Delete($id)) {
$DB->Commit();
} else {
$DB->Rollback();
throw new MigrationException($APPLICATION->GetException());
}
}
示例3: Delete
/**
* Delete
* @param $IblockTypeCode
* @return bool
* @throws \Exception
*/
public static function Delete($IblockTypeCode)
{
$Iblock = new \CIBlock();
$iblockEl = new \CIBlockElement();
$dbIblock = $Iblock->GetList(array(), array('TYPE' => $IblockTypeCode));
while ($dbRow = $dbIblock->Fetch()) {
$iblockElDbRes = $iblockEl->GetList(array(), array('IBLOCK_ID' => $dbRow['ID']));
if ($iblockElDbRes !== false && $iblockElDbRes->SelectedRowsCount()) {
throw new BimException('Can not delete iblock type: iblock id =' . $dbRow['ID'] . ' have elements');
}
}
if (!\CIBlockType::Delete($IblockTypeCode)) {
throw new BimException('Delete iblock type error!');
}
return true;
}
示例4: while
}
if ($USER->IsAdmin() && ($arID = $lAdmin->GroupAction())) {
if ($_REQUEST['action_target'] == 'selected') {
$rsData = CIBlockType::GetList($arOrder, $arFilter);
while ($arRes = $rsData->Fetch()) {
$arID[] = $arRes['ID'];
}
}
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
$DB->StartTransaction();
if (!CIBlockType::Delete($ID)) {
$DB->Rollback();
$lAdmin->AddGroupError(GetMessage("IBLOCK_TYPE_ADMIN_ERR_DEL") . " ("" . htmlspecialcharsbx($ID) . "")", $ID);
}
$DB->Commit();
break;
}
}
}
// Fill list with data
$rsData = CIBlockType::GetList($arOrder, $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
// Set page navigation
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("IBLOCK_TYPE_ADMIN_NAV")));
// List headers/columns
示例5: removeSampleIblock
/**
*Удаляем установленный инфоблок с примерами. Его ID хранится в опции модуля demo_iblock_id
*/
function removeSampleIblock()
{
global $DB;
$iIblockId = intval(COption::GetOptionString("bit.includer", "demo_iblock_id", "0"));
if ($iIblockId > 0 && CModule::IncludeModule('iblock')) {
$res = CIBlock::GetByID($iIblockId);
if ($arIblock = $res->GetNext()) {
$DB->StartTransaction();
if (!CIBlock::Delete($arIblock['ID'])) {
$DB->Rollback();
} else {
$DB->Commit();
}
//Удаляем тип инфоблока если в нем нет других инфоблоков
$res = CIBlock::GetList(array(), array('TYPE' => $arIblock['IBLOCK_TYPE_ID'], 'SITE_ID' => $arIblock['LID'], 'ACTIVE' => 'Y'), true);
if (intval($res->SelectedRowsCount()) == 0) {
$DB->StartTransaction();
if (!CIBlockType::Delete($arIblock['IBLOCK_TYPE_ID'])) {
$DB->Rollback();
} else {
$DB->Commit();
}
}
}
}
}
示例6: UnInstallDB
function UnInstallDB()
{global $DB;
if(CModule::IncludeModule("iblock"))
{
$DB->StartTransaction();
if(!CIBlockType::Delete('vdk_companies_type'))
{
$DB->Rollback();
echo 'Delete error!';
}
$DB->Commit();
}
if(CModule::IncludeModule("iblock"))
{
$DB->StartTransaction();
if(!CIBlockType::Delete('vdk_cities_type'))
{
$DB->Rollback();
echo 'Delete error!';
}
$DB->Commit();
}
return true;
}
示例7: DoUninstall
function DoUninstall()
{
if(!CModule::IncludeModule('iblock')) return false;
global $APPLICATION, $step, $errors;
$step = IntVal($step);
if($step<2)
{
$APPLICATION->IncludeAdminFile(GetMessage("FORM_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/unstep1.php");
}
elseif($step==2)
{
$errors = false;
if($_REQUEST["SAVE_IBLOCK"]!="Y"){
CIBlockType::Delete("kaycom_ONEPLACESEO");
}
UnRegisterModule(self::MODULE_ID);
$this->UnInstallDB();
$this->UnInstallFiles();
UnRegisterModuleDependences("main", "OnEpilog", "kaycom.oneplaceseo", "CKaycomOneplaceseo", "onPageLoad");
$APPLICATION->IncludeAdminFile(GetMessage("FORM_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$this->MODULE_ID."/install/unstep2.php");
}
}
示例8: IblockTypeDelete
/**
* @param string $name
* @param bool $deleteIfExists
*/
protected function IblockTypeDelete($name)
{
$name = trim($name);
if (empty($name)) {
throw new \Exception('You must set iblock CODE');
}
global $DB;
$DB->StartTransaction();
if (!\CIBlockType::Delete($name)) {
$DB->Rollback();
$error = "Can't delete {$name} iblock type";
} else {
echo "Delete {$name} iblock type\r\n";
}
$DB->Commit();
if (isset($error)) {
throw new \Exception($error);
}
}