本文整理汇总了PHP中CIBlockElementRights::DeleteAllRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElementRights::DeleteAllRights方法的具体用法?PHP CIBlockElementRights::DeleteAllRights怎么用?PHP CIBlockElementRights::DeleteAllRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElementRights
的用法示例。
在下文中一共展示了CIBlockElementRights::DeleteAllRights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
//.........这里部分代码省略.........
return false;
}
} else {
if (!$DB->Query("DELETE FROM b_iblock_element_property WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
return false;
}
}
static $arDelCache = array();
if (!is_set($arDelCache, $zr["IBLOCK_ID"])) {
$arDelCache[$zr["IBLOCK_ID"]] = false;
$db_ps = $DB->Query("SELECT ID,IBLOCK_ID,VERSION,MULTIPLE FROM b_iblock_property WHERE PROPERTY_TYPE='E' AND (LINK_IBLOCK_ID=" . $zr["IBLOCK_ID"] . " OR LINK_IBLOCK_ID=0 OR LINK_IBLOCK_ID IS NULL)");
while ($ar_ps = $db_ps->Fetch()) {
if ($ar_ps["VERSION"] == 2) {
if ($ar_ps["MULTIPLE"] == "Y") {
$strTable = "b_iblock_element_prop_m" . $ar_ps["IBLOCK_ID"];
} else {
$strTable = "b_iblock_element_prop_s" . $ar_ps["IBLOCK_ID"];
}
} else {
$strTable = "b_iblock_element_property";
}
$arDelCache[$zr["IBLOCK_ID"]][$strTable][] = $ar_ps["ID"];
}
}
if ($arDelCache[$zr["IBLOCK_ID"]]) {
foreach ($arDelCache[$zr["IBLOCK_ID"]] as $strTable => $arProps) {
if (strncmp("b_iblock_element_prop_s", $strTable, 23) == 0) {
$tableFields = $DB->GetTableFields($strTable);
foreach ($arProps as $prop_id) {
$strSql = "UPDATE " . $strTable . " SET PROPERTY_" . $prop_id . "=null";
if (isset($tableFields["DESCRIPTION_" . $prop_id])) {
$strSql .= ",DESCRIPTION_" . $prop_id . "=null";
}
$strSql .= " WHERE PROPERTY_" . $prop_id . "=" . $zr["ID"];
if (!$DB->Query($strSql)) {
return false;
}
}
} elseif (strncmp("b_iblock_element_prop_m", $strTable, 23) == 0) {
$tableFields = $DB->GetTableFields(str_replace("prop_m", "prop_s", $strTable));
$strSql = "SELECT IBLOCK_PROPERTY_ID, IBLOCK_ELEMENT_ID FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
$rs = $DB->Query($strSql);
while ($ar = $rs->Fetch()) {
$strSql = "\n\t\t\t\t\t\t\t\t\tUPDATE " . str_replace("prop_m", "prop_s", $strTable) . "\n\t\t\t\t\t\t\t\t\tSET PROPERTY_" . $ar["IBLOCK_PROPERTY_ID"] . "=null\n\t\t\t\t\t\t\t\t\t" . (isset($tableFields["DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"]]) ? ",DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"] . "=null" : "") . "\n\t\t\t\t\t\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ar["IBLOCK_ELEMENT_ID"] . "\n\t\t\t\t\t\t\t\t";
if (!$DB->Query($strSql)) {
return false;
}
}
$strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
if (!$DB->Query($strSql)) {
return false;
}
} else {
$strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
if (!$DB->Query($strSql)) {
return false;
}
}
}
}
if (!$DB->Query("DELETE FROM b_iblock_section_element WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
return false;
}
$obIBlockElementRights = new CIBlockElementRights($zr["IBLOCK_ID"], $zr["ID"]);
$obIBlockElementRights->DeleteAllRights();
$ipropTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($zr["IBLOCK_ID"], $zr["ID"]);
$ipropTemplates->delete();
if (IntVal($zr["WF_PARENT_ELEMENT_ID"]) <= 0 && $zr["WF_STATUS_ID"] == 1 && CModule::IncludeModule("search")) {
CSearch::DeleteIndex("iblock", $elementId);
}
CIBlockElement::DeleteFile($zr["PREVIEW_PICTURE"], $zr["ID"], "PREVIEW", $zr["WF_PARENT_ELEMENT_ID"], $zr["IBLOCK_ID"]);
CIBlockElement::DeleteFile($zr["DETAIL_PICTURE"], $zr["ID"], "DETAIL", $zr["WF_PARENT_ELEMENT_ID"], $zr["IBLOCK_ID"]);
if (CModule::IncludeModule("workflow")) {
$DB->Query("DELETE FROM b_workflow_move WHERE IBLOCK_ELEMENT_ID=" . $elementId);
}
$DB->Query("DELETE FROM b_iblock_element_lock WHERE IBLOCK_ELEMENT_ID=" . $elementId);
$DB->Query("DELETE FROM b_rating_vote WHERE ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND ENTITY_ID = " . $elementId);
$DB->Query("DELETE FROM b_rating_voting WHERE ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND ENTITY_ID = " . $elementId);
if (!$DB->Query("DELETE FROM b_iblock_element WHERE ID=" . $elementId)) {
return false;
}
if (isset(self::$elementIblock[$elementId])) {
unset(self::$elementIblock[$elementId]);
}
\Bitrix\Iblock\PropertyIndex\Manager::deleteElementIndex($zr["IBLOCK_ID"], $piId);
if (CModule::IncludeModule("bizproc")) {
CBPDocument::OnDocumentDelete(array("iblock", "CIBlockDocument", $zr["ID"]), $arErrorsTmp);
}
foreach (GetModuleEvents("iblock", "OnAfterIBlockElementDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($zr));
}
CIBlock::clearIblockTagCache($zr['IBLOCK_ID']);
unset($elementId);
}
}
/************* QUOTA *************/
$_SESSION["SESS_RECOUNT_DB"] = "Y";
/************* QUOTA *************/
return true;
}