本文整理汇总了PHP中CIBlockRights::DeleteAllRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights::DeleteAllRights方法的具体用法?PHP CIBlockRights::DeleteAllRights怎么用?PHP CIBlockRights::DeleteAllRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockRights
的用法示例。
在下文中一共展示了CIBlockRights::DeleteAllRights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
/**
* <p>Функция удаляет информационный блок.</p>
*
*
*
*
* @param int $ID Код информационного блока.
*
*
*
* @return bool <a href="http://dev.1c-bitrix.ru/api_help/iblock/events/onbeforeiblockdelete.php">OnBeforeIBlockDelete</a><a
* name="examples"></a>
*
*
* <h4>Example</h4>
* <pre>
* <?<br>if($USER->IsAdmin())<br>{<br> $DB->StartTransaction();<br> if(!CIBlock::Delete($iblock_id))<br> {<br> $strWarning .= GetMessage("IBLOCK_DELETE_ERROR");<br> $DB->Rollback();<br> }<br> else<br> $DB->Commit();<br>}<br>?><br>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
$err_mess = "FILE: " . __FILE__ . "<br>LINE: ";
/** @global CDatabase $DB */
global $DB;
/** @global CMain $APPLICATION */
global $APPLICATION;
/** @global CUserTypeManager $USER_FIELD_MANAGER */
global $USER_FIELD_MANAGER;
/** @global CCacheManager $CACHE_MANAGER */
global $CACHE_MANAGER;
$ID = IntVal($ID);
$APPLICATION->ResetException();
foreach (GetModuleEvents("iblock", "OnBeforeIBlockDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
$err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
$ex = $APPLICATION->GetException();
if (is_object($ex)) {
$err .= ': ' . $ex->GetString();
}
$APPLICATION->throwException($err);
return false;
}
}
foreach (GetModuleEvents("iblock", "OnIBlockDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
$iblockSections = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $ID, "DEPTH_LEVEL" => 1, "CHECK_PERMISSIONS" => "N"), false, array("ID"));
while ($iblockSection = $iblockSections->Fetch()) {
if (!CIBlockSection::Delete($iblockSection["ID"], false)) {
return false;
}
}
$iblockElements = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $ID, "SHOW_NEW" => "Y", "CHECK_PERMISSIONS" => "N"), false, false, array("IBLOCK_ID", "ID"));
while ($iblockElement = $iblockElements->Fetch()) {
if (!CIBlockElement::Delete($iblockElement["ID"])) {
return false;
}
}
$props = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $ID, "CHECK_PERMISSIONS" => "N"));
while ($property = $props->Fetch()) {
if (!CIBlockProperty::Delete($property["ID"])) {
return false;
}
}
$seq = new CIBlockSequence($ID);
$seq->Drop(true);
$obIBlockRights = new CIBlockRights($ID);
$obIBlockRights->DeleteAllRights();
CIBlockSectionPropertyLink::DeleteByIBlock($ID);
$DB->Query("delete from b_iblock_offers_tmp where PRODUCT_IBLOCK_ID=" . $ID, false, $err_mess . __LINE__);
$DB->Query("delete from b_iblock_offers_tmp where OFFERS_IBLOCK_ID=" . $ID, false, $err_mess . __LINE__);
if (!$DB->Query("DELETE FROM b_iblock_messages WHERE IBLOCK_ID = " . $ID, false, $err_mess . __LINE__)) {
return false;
}
if (!$DB->Query("DELETE FROM b_iblock_fields WHERE IBLOCK_ID = " . $ID, false, $err_mess . __LINE__)) {
return false;
}
$USER_FIELD_MANAGER->OnEntityDelete("IBLOCK_" . $ID . "_SECTION");
if (!$DB->Query("DELETE FROM b_iblock_group WHERE IBLOCK_ID=" . $ID, false, $err_mess . __LINE__)) {
return false;
}
if (!$DB->Query("DELETE FROM b_iblock_rss WHERE IBLOCK_ID=" . $ID, false, $err_mess . __LINE__)) {
return false;
}
if (!$DB->Query("DELETE FROM b_iblock_site WHERE IBLOCK_ID=" . $ID, false, $err_mess . __LINE__)) {
return false;
}
if (!$DB->Query("DELETE FROM b_iblock WHERE ID=" . $ID, false, $err_mess . __LINE__)) {
return false;
}
$DB->Query("DROP TABLE b_iblock_element_prop_s" . $ID, true, $err_mess . __LINE__);
$DB->Query("DROP TABLE b_iblock_element_prop_m" . $ID, true, $err_mess . __LINE__);
$DB->Query("DROP SEQUENCE sq_b_iblock_element_prop_m" . $ID, true, $err_mess . __LINE__);
CIBlock::CleanCache($ID);
if (defined("BX_COMP_MANAGED_CACHE")) {
//.........这里部分代码省略.........