本文整理汇总了PHP中CIBlock::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::Delete方法的具体用法?PHP CIBlock::Delete怎么用?PHP CIBlock::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule("iblock")) {
return;
}
$iblockXMLFile = WIZARD_SERVICE_RELATIVE_PATH . "/ibexp/ru/sannews.xml";
$iblockCode = "news";
//_".WIZARD_SITE_ID;
$iblockType = "news";
$rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $iblockType));
$iblockID = false;
if ($arIBlock = $rsIBlock->Fetch()) {
$iblockID = $arIBlock["ID"];
if (WIZARD_INSTALL_DEMO_DATA) {
CIBlock::Delete($arIBlock["ID"]);
$iblockID = false;
}
}
if ($iblockID == false) {
$permissions = array("1" => "X", "2" => "R");
$dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
if ($arGroup = $dbGroup->Fetch()) {
$permissions[$arGroup["ID"]] = 'W';
}
$iblockID = WizardServices::ImportIBlockFromXML($iblockXMLFile, $iblockCode, $iblockType, WIZARD_SITE_ID, $permissions);
if ($iblockID < 1) {
return;
}
//WizardServices::SetIBlockFormSettings($iblockID, Array ( 'tabs' => GetMessage("W_IB_GROUP_PHOTOG_TAB1").$REAL_PICTURE_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB2").$rating_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB3").$vote_count_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB4").$vote_sum_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB5").$APPROVE_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB6").$PUBLIC_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB7"), ));
//IBlock fields
示例2: Delete
/**
* Deletes iblock type including all iblocks.<br>
* When there is an error occured on iblock deletion
* it stops and returns false.
*
* @param string $ID iblock type ID.
* @return bool|CDBResult
*/
public static function Delete($ID)
{
/** @global CDatabase $DB */
global $DB;
/** @global CCacheManager $CACHE_MANAGER */
global $CACHE_MANAGER;
if (CACHED_b_iblock_type !== false) {
$CACHE_MANAGER->CleanDir("b_iblock_type");
}
$iblocks = CIBlock::GetList(array(), array("=TYPE" => $ID));
while ($iblock = $iblocks->Fetch()) {
if (!CIBlock::Delete($iblock["ID"])) {
return false;
}
}
if (!$DB->Query("DELETE FROM b_iblock_type_lang WHERE IBLOCK_TYPE_ID='" . $DB->ForSql($ID) . "'", true)) {
return false;
}
return $DB->Query("DELETE FROM b_iblock_type WHERE ID='" . $DB->ForSql($ID) . "'", true);
}
示例3: is_array
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
$arResult["AdminAccess"] = $USER->IsAdmin() || is_array($arParams["ADMIN_ACCESS"]) && count(array_intersect($USER->GetUserGroupArray(), $arParams["ADMIN_ACCESS"])) > 0;
$deleteBlockId = intval($_REQUEST["delete_block_id"]);
if ($deleteBlockId > 0 && $arResult["AdminAccess"] && check_bitrix_sessid()) {
$db = CIBlock::GetList(array(), array("ID" => $deleteBlockId, "SITE_ID" => SITE_ID, "TYPE" => $arParams["IBLOCK_TYPE"]));
if ($ar = $db->GetNext()) {
$db1 = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $ar["ID"], "SHOW_NEW" => "Y"), false, false, array("IBLOCK_ID", "ID"));
while ($ar1 = $db1->Fetch()) {
CBPDocument::OnDocumentDelete(array("bizproc", "CBPVirtualDocument", $ar1["ID"]), $arErrorsTmp);
}
$db2 = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("bizproc", "CBPVirtualDocument", "type_" . $ar["ID"])), false, false, array("ID"));
while ($ar2 = $db2->Fetch()) {
CBPWorkflowTemplateLoader::Delete($ar2["ID"]);
}
CIBlock::Delete($ar["ID"]);
}
}
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
$arResult["Blocks"] = array();
$dbBlockList = CIBlock::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y", "SITE_ID" => SITE_ID, "TYPE" => $arParams["IBLOCK_TYPE"]));
while ($arBlock = $dbBlockList->GetNext()) {
$arBlock["LIST_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LIST"], array("block_id" => $arBlock["ID"]));
if (intval($arBlock["PICTURE"]) <= 0) {
$arBlock["PICTURE"] = "/bitrix/images/bizproc/vd_bp.jpg";
}
$arMessagesTmp = CIBlock::GetMessages($arBlock["ID"]);
$arBlock["CreateTitle"] = htmlspecialcharsbx(is_array($arMessagesTmp) && array_key_exists("ELEMENT_ADD", $arMessagesTmp) ? $arMessagesTmp["ELEMENT_ADD"] : "");
$workflowTemplateId = 0;
$db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("bizproc", "CBPVirtualDocument", "type_" . $arBlock["ID"])), false, false, array("ID"));
示例4: array
}
//die($strError);
}
$boolFlag = CIBlock::Delete($arSKU['IBLOCK_ID']);
if (!$boolFlag) {
$strError = "";
if ($ex = $APPLICATION->GetException()) {
$strError = $ex->GetString();
} else {
$strError = "Couldn't delete offers iblock";
}
//die($strError);
}
}
if ($boolFlag) {
$boolFlag = CIBlock::Delete($IBLOCK_CATALOG_ID);
if (!$boolFlag) {
$strError = "";
if ($ex = $APPLICATION->GetException()) {
$strError = $ex->GetString();
} else {
$strError = "Couldn't delete catalog iblock";
}
//die($strError);
}
}
if ($boolFlag) {
$IBLOCK_CATALOG_ID = false;
}
}
$dbResultList = CCatalogGroup::GetList(array(), array("BASE" => "Y"));
示例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: deleteIblock
public function deleteIblock($iblockId)
{
if (\CIBlock::Delete($iblockId)) {
return true;
}
$this->throwException(__METHOD__, 'Could not delete iblock %s', $iblockId);
}
示例7: implode
$data = implode("\n", $data);
eval('$data = ' . $data . ';');
if (!is_array($data) || !sizeof($data)) {
ShowError(GetMessage('GREENSIGHT_IBLOCK_IMPORT_ERROR_EVAL'));
break;
}
// импорт структуры
$cib = new CIBlock();
$cibp = new CIBlockProperty();
foreach ($data as &$_iblock_data) {
$rsIBlock = $cib->GetList(false, array('CODE' => $_iblock_data['CODE'], 'TYPE' => $iBlockTypeID));
$arIBlock = $rsIBlock->Fetch();
if ($arIBlock['ID']) {
if ($_POST['overwrite'] == '1') {
// если инфоблоки перезаписываем, удалим имеющийся
$cib->Delete($arIBlock['ID']);
} else {
// если инфблоки не перезаписываем, то пропускаем этот
continue;
}
}
// создание инфоблоков
if (!$cib->Add(array('SITE_ID' => array($_iblock_data['LID']), 'CODE' => $_iblock_data['CODE'], 'EXTERNAL_ID' => $_iblock_data['EXTERNAL_ID'], 'XML_ID' => $_iblock_data['XML_ID'], 'IBLOCK_TYPE_ID' => $iBlockTypeID, 'NAME' => $_iblock_data['NAME'], 'ACTIVE' => $_iblock_data['ACTIVE'], 'SORT' => $_iblock_data['SORT'], 'LIST_PAGE_URL' => $_iblock_data['LIST_PAGE_URL'], 'SECTION_PAGE_URL' => $_iblock_data['SECTION_PAGE_URL'], 'DETAIL_PAGE_URL' => $_iblock_data['DETAIL_PAGE_URL'], 'PICTURE' => $_iblock_data['PICTURE'], 'DESCRIPTION' => $_iblock_data['DESCRIPTION'], 'DESCRIPTION_TYPE' => $_iblock_data['DESCRIPTION_TYPE'], 'RSS_ACTIVE' => $_iblock_data['RSS_ACTIVE'], 'RSS_TTL' => $_iblock_data['RSS_TTL'], 'RSS_FILE_ACTIVE' => $_iblock_data['RSS_FILE_ACTIVE'], 'RSS_FILE_LIMIT' => $_iblock_data['RSS_FILE_LIMIT'], 'RSS_FILE_DAYS' => $_iblock_data['RSS_FILE_DAYS'], 'RSS_YANDEX_ACTIVE' => $_iblock_data['RSS_YANDEX_ACTIVE'], 'INDEX_ELEMENT' => $_iblock_data['INDEX_ELEMENT'], 'INDEX_SECTION' => $_iblock_data['INDEX_SECTION'], 'WORKFLOW' => $_iblock_data['WORKFLOW'], 'SECTION_CHOOSER' => $_iblock_data['SECTION_CHOOSER'], 'VERSION' => $_iblock_data['VERSION'], 'EDIT_FILE_BEFORE' => $_iblock_data['EDIT_FILE_BEFORE'], 'EDIT_FILE_AFTER' => $_iblock_data['EDIT_FILE_AFTER']))) {
$DB->Rollback();
ShowError(GetMessage('GREENSIGHT_IBLOCK_IMPORT_ERROR_IBLOCK_CREATE'));
break 2;
}
$rsIBlock = $cib->GetList(false, array('CODE' => $_iblock_data['CODE'], 'TYPE' => $iBlockTypeID));
$arIBlock = $rsIBlock->Fetch();
// добавление свойств
if (sizeof($_iblock_data['properties'])) {
示例8: foreach
}
}
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
if (!CIBlockRights::UserHasRightTo($ID, $ID, "iblock_delete")) {
break;
}
@set_time_limit(0);
$DB->StartTransaction();
$rsIBlock = CIBlock::GetByID($ID);
$arIBlock = $rsIBlock->GetNext();
if (!CIBlock::Delete($ID)) {
$DB->Rollback();
$lAdmin->AddGroupError(GetMessage("IBLOCK_ADM_DELETE_ERROR"), $ID);
} else {
if (COption::GetOptionString("iblock", "event_log_iblock", "N") === "Y") {
$res_log["NAME"] = $arIBlock["NAME"];
CEventLog::Log("IBLOCK", "IBLOCK_DELETE", "iblock", $ID, serialize($res_log));
}
}
$DB->Commit();
break;
case "activate":
case "deactivate":
if (!CIBlockRights::UserHasRightTo($ID, $ID, "iblock_delete")) {
break;
}
示例9: LocalRedirect
$CACHE_MANAGER->CleanDir("menu");
$tab_name = $arResult["FORM_ID"] . "_active_tab";
//And go to proper page
if (isset($_POST["save"])) {
LocalRedirect($arResult["LISTS_URL"]);
} elseif ($arIBlock) {
LocalRedirect(CHTTP::urlAddParams($arResult["LIST_EDIT_URL"], array($tab_name => $_POST[$tab_name]), array("skip_empty" => true, "encode" => true)));
} else {
LocalRedirect(CHTTP::urlAddParams(str_replace(array("#list_id#", "#group_id#"), array($res, $arParams["SOCNET_GROUP_ID"]), $arParams["LIST_EDIT_URL"]), array($tab_name => $_POST[$tab_name]), array("skip_empty" => true, "encode" => true)));
}
} else {
ShowError($ob->LAST_ERROR);
$bVarsFromForm = true;
}
} elseif (isset($_POST["action"]) && $_POST["action"] === "delete" && $arResult["IBLOCK_ID"]) {
if (CIBlock::Delete($arResult["IBLOCK_ID"])) {
//Clear components cache
global $CACHE_MANAGER;
$CACHE_MANAGER->ClearByTag("lists_list_" . $arResult["IBLOCK_ID"]);
$CACHE_MANAGER->ClearByTag("lists_list_any");
$CACHE_MANAGER->CleanDir("menu");
}
LocalRedirect($arResult["~LISTS_URL"]);
} else {
//Go to lists page
LocalRedirect($arResult["~LISTS_URL"]);
}
}
$data = array();
if ($bVarsFromForm) {
//There was an error so display form values
示例10: Delete
function Delete($ID)
{
global $DB, $USER;
if (CACHED_b_iblock_type !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_iblock_type");
}
$iblocks = CIBlock::GetList(array(), array("=TYPE" => $ID));
while ($iblock = $iblocks->Fetch()) {
if (!CIBlock::Delete($iblock["ID"])) {
return false;
}
}
if (!$DB->Query("DELETE FROM b_iblock_type_lang WHERE IBLOCK_TYPE_ID='" . $DB->ForSql($ID) . "'", true)) {
return false;
}
return $DB->Query("DELETE FROM b_iblock_type WHERE ID='" . $DB->ForSql($ID) . "'", true);
}
示例11: OnPostForm
//.........这里部分代码省略.........
$langs = new CLang;
if ($langs->Update($ST, $arFields) === false) {
$arErrors[] = array('LID'=>$ST, 'NAME'=>$arSites[$ST]['NAME'], 'MSG'=>GetMessage('WD_TPL_NOT_ASSIGN'));
}
$arSitesPassed[] = $ST;
}
else {
$this->SetError( GetMessage('WD_STEP_2_NOT_INSTALLED') );
}
}
else {
if (WizardServices::CopyDirFilesEx(str_replace('\\', '/', dirname(__FILE__)) . '/public_files', $doc_root) !== false) {
$pub_files[] = '[' . $arSites[$ST]['LID'] . '] ' . $arSites[$ST]['NAME'];
$langs = new CLang;
if ($langs->Update($ST, $arFields) === false) {
$arErrors[] = array('LID'=>$ST, 'NAME'=>$arSites[$ST]['NAME'], 'MSG'=>GetMessage('WD_TPL_NOT_ASSIGN'));
}
$arSitesPassed[] = $ST;
}
else {
$this->SetError( GetMessage('WD_STEP_2_NOT_INSTALLED') );
}
}
}
}
$wizard->SetVar('errors', $arErrors);
$wizard->SetVar('public_files_installed', $pub_files);
//$install_data = $wizard->GetVar('install_data');
if (count($arSitesPassed) && count($pub_data)) {
CModule::IncludeModule('iblock');
// create iblock type
$arType = array(
'ID'=>'BT',
"SECTIONS" => "Y",
"IN_RSS" => "N",
"SORT" => 100,
"LANG" => Array(),
);
$arLanguages = Array();
$rsLanguage = CLanguage::GetList($by, $order, array());
while($arLanguage = $rsLanguage->Fetch())
$arLanguages[] = $arLanguage["LID"];
$bIBType = true;
$dbType = CIBlockType::GetList(Array(),Array("=ID" => $arType["ID"]));
if(! $dbType->Fetch()) {
foreach($arLanguages as $languageID)
{
$arType["LANG"][$languageID]["NAME"] = 'Bitrixtemplates';
$arType["LANG"][$languageID]["ELEMENT_NAME"] = 'Item';
$arType["LANG"][$languageID]["SECTION_NAME"] = 'Section';
}
$iblockType = new CIBlockType;
$bIBType = $iblockType->Add($arType);
}
if ($bIBType) {
$arCodeToId = array();
foreach($pub_data as $arF) {
$iblockCode = $arF['name'];
$rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $arType['ID']));
if ($arIBlock = $rsIBlock->Fetch())
{
CIBlock::Delete($arIBlock["ID"]);
}
$filepath = str_replace('\\', '/', dirname(__FILE__)) . '/public_data/'.$arF['filepath'];
$filepath = preg_replace('#^.+?\/bitrix\/#','/bitrix/', $filepath);
//echo $filepath;
$iblockID = WizardServices::ImportIBlockFromXML(
$filepath,
$iblockCode,
$arType['ID'],
$arSitesPassed
);
$arCodeToId[$iblockCode] = $iblockID;
}
if ($pub_updater) {
$updater = str_replace('\\', '/', dirname(__FILE__)) . '/public_data/'.$pub_updater;
$arUpdate = array();
include($updater);
if (is_array($arUpdate)) {
foreach($arUpdate as $arData) {
$file = $_SERVER[DOCUMENT_ROOT].$arData['file'];
//echo $file;
//print_r($arCodeToId);
$iblockCode = ToUpper($arData['code']).'_IBLOCK_CODE';
$iblockId = ToUpper($arData['code']).'_IBLOCK_ID';
$id = $arCodeToId[$arData['code']];
if (file_exists($file) && $id) {
CWizardUtil::ReplaceMacros($file, array($iblockCode => $arType['ID'], $iblockId => $id));
}
}
}
}
}
}
}
}
示例12: deleteOldIBlockData
protected function deleteOldIBlockData()
{
global $DB;
if (!$this->_bIBlockSelected) {
return false;
}
if ($this->_iblockID > 0) {
if (WIZARD_INSTALL_DEMO_DATA) {
$DB->StartTransaction();
$bDeleteSuccess = \CIBlock::Delete($this->_iblockID);
if ($bDeleteSuccess) {
$this->_iblockID = 0;
$DB->Commit();
} else {
$DB->Rollback();
die('Error deleting iblock');
}
}
}
return true;
}
示例13: IblockDelete
/**
* @var string $code
*/
protected function IblockDelete($name)
{
$name = trim($name);
if (empty($name)) {
throw new \Exception('You must set iblock CODE');
}
global $DB;
$res = \CIBlock::GetList([], ['CODE' => $name, 'CHECK_PERMISSIONS' => 'N']);
if ($ob = $res->Fetch()) {
$DB->StartTransaction();
if (!\CIBlock::Delete($ob['ID'])) {
$DB->Rollback();
$error = "Can't delete {$name} iblock";
} else {
echo "Delete {$name} iblock\r\n";
}
$DB->Commit();
if (isset($error)) {
throw new \Exception($error);
}
}
}
示例14: delete
/**
* Delete subject record
* @param $id
* @param null $dbVersion
* @return ApplyResult
*/
public function delete($id, $dbVersion = null)
{
$dbVersion && ($id = $this->getCurrentVersionId($id, $dbVersion));
!$dbVersion && !$this->hasCurrentReference($id) && $this->registerCurrentVersionId($id);
$res = new ApplyResult();
$res->setSuccess((bool) \CIBlock::Delete($id))->setMessage('Not execute ib delete');
$res->isSuccess() && $this->removeCurrentVersion($id);
return $res;
}
示例15: deleteIblockIfExists
public function deleteIblockIfExists($iblockCode)
{
$iblockId = $this->getIblockId($iblockCode);
if (!$iblockId) {
return false;
}
if (\CIBlock::Delete($iblockId)) {
return true;
}
$this->throwException(__METHOD__, 'Could not delete iblock %s', $iblockCode);
}