当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockRights::DeleteAllRights方法代码示例

本文整理汇总了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>
  * &lt;?<br>if($USER-&gt;IsAdmin())<br>{<br>	$DB-&gt;StartTransaction();<br>	if(!CIBlock::Delete($iblock_id))<br>	{<br>		$strWarning .= GetMessage("IBLOCK_DELETE_ERROR");<br>		$DB-&gt;Rollback();<br>	}<br>	else<br>		$DB-&gt;Commit();<br>}<br>?&gt;<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")) {
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:iblock.php


注:本文中的CIBlockRights::DeleteAllRights方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。