本文整理汇总了PHP中CIBlockProperty::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty::Delete方法的具体用法?PHP CIBlockProperty::Delete怎么用?PHP CIBlockProperty::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockProperty
的用法示例。
在下文中一共展示了CIBlockProperty::Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
/**
* Delete
* @param $sIBlockCode
* @param $sPropertyCode
* @return array
* @throws \Exception
*/
public static function Delete($sIBlockCode, $sPropertyCode)
{
$rsProperty = \CIBlockProperty::GetList(array(), array('IBLOCK_CODE' => $sIBlockCode, 'CODE' => $sPropertyCode));
if ($arProperty = $rsProperty->Fetch()) {
if (\CIBlockProperty::Delete($arProperty['ID'])) {
return true;
} else {
throw new BimException(__METHOD__ . "Iblock property delete error!");
}
} else {
throw new BimException(__METHOD__ . 'Not find property with code ' . $sPropertyCode);
}
}
示例2: Delete
public function Delete()
{
if (is_array($this->_property)) {
$obProperty = new CIBlockProperty();
if ($obProperty->Delete($this->_property["ID"])) {
$this->_property = false;
}
}
parent::Delete();
return true;
}
示例3: deletePropertyIfExists
public function deletePropertyIfExists($iblockId, $propertyCode)
{
$propId = $this->getPropertyId($iblockId, $propertyCode);
if (!$propId) {
return false;
}
$ib = new \CIBlockProperty();
if ($ib->Delete($propId)) {
return true;
}
$this->throwException(__METHOD__, $ib->LAST_ERROR);
}
示例4: array
}
if ($arID = $lAdmin->GroupAction()) {
if ($_REQUEST['action_target'] == 'selected') {
$propertyIterator = Iblock\PropertyTable::getList(array('select' => array('ID'), 'filter' => $arFilter));
while ($property = $propertyIterator->fetch()) {
$arID[] = $property['ID'];
}
unset($property, $propertyIterator);
}
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
if (!CIBlockProperty::Delete($ID)) {
$lAdmin->AddGroupError(GetMessage("IBP_ADM_DELETE_ERROR"), $ID);
}
break;
case "activate":
case "deactivate":
$ibp = new CIBlockProperty();
$arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
if (!$ibp->Update($ID, $arFields)) {
$lAdmin->AddUpdateError(GetMessage("IBP_ADM_SAVE_ERROR", array("#ID#" => $ID, "#ERROR_TEXT#" => $ibp->LAST_ERROR)), $ID);
}
break;
}
}
}
$arHeader = array(array("id" => "ID", "content" => GetMessage("IBP_ADM_ID"), "sort" => "ID", "align" => "right", "default" => true), array("id" => "NAME", "content" => GetMessage("IBP_ADM_NAME"), "sort" => "NAME", "default" => true), array("id" => "CODE", "content" => GetMessage("IBP_ADM_CODE"), "sort" => "CODE", "default" => true), array("id" => "PROPERTY_TYPE", "content" => GetMessage("IBP_ADM_PROPERTY_TYPE"), "sort" => "PROPERTY_TYPE", "default" => true), array("id" => "SORT", "content" => GetMessage("IBP_ADM_SORT"), "sort" => "SORT", "align" => "right", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("IBP_ADM_ACTIVE"), "sort" => "ACTIVE", "align" => "center", "default" => true), array("id" => "IS_REQUIRED", "content" => GetMessage("IBP_ADM_IS_REQUIRED"), "sort" => "IS_REQUIRED", "align" => "center", "default" => true), array("id" => "MULTIPLE", "content" => GetMessage("IBP_ADM_MULTIPLE"), "sort" => "MULTIPLE", "align" => "center", "default" => true), array("id" => "SEARCHABLE", "content" => GetMessage("IBP_ADM_SEARCHABLE"), "sort" => "SEARCHABLE", "align" => "center", "default" => true), array("id" => "FILTRABLE", "content" => GetMessage("IBP_ADM_FILTRABLE"), "sort" => "FILTRABLE", "align" => "center"), array("id" => "XML_ID", "content" => GetMessage("IBP_ADM_XML_ID"), "sort" => "XML_ID"), array("id" => "WITH_DESCRIPTION", "content" => GetMessage("IBP_ADM_WITH_DESCRIPTION"), "sort" => "WITH_DESCRIPTION", "align" => "center"), array("id" => "HINT", "content" => GetMessage("IBP_ADM_HINT")));
示例5: IntVal
CAgent::AddAgent("CIBlockRSS::PreGenerateRSS(" . $ID . ", true);", "iblock", "N", IntVal($RSS_TTL) * 60 * 60, "", "Y");
} else {
CAgent::RemoveAgent("CIBlockRSS::PreGenerateRSS(" . $ID . ", true);", "iblock");
}
if ($_POST["IPROPERTY_CLEAR_VALUES"] === "Y") {
$ipropValues = new \Bitrix\Iblock\InheritedProperty\IblockValues($ID);
$ipropValues->clearValues();
}
/********************/
$ibp = new CIBlockProperty();
foreach ($arProperties as $property_id => $arProperty) {
$property_id = (int) $property_id;
$arProperty["IBLOCK_ID"] = $ID;
if ($property_id > 0) {
if (isset($arProperty['DEL']) && $arProperty['DEL'] == 'Y') {
if (!CIBlockProperty::Delete($property_id) && ($ex = $APPLICATION->GetException())) {
$strWarning .= GetMessage("IB_E_PROPERTY_ERROR") . ": " . $ex->GetString() . "<br>";
$bVarsFromForm = true;
}
} else {
$res = $ibp->Update($property_id, $arProperty);
if (!$res) {
$strWarning .= GetMessage("IB_E_PROPERTY_ERROR") . ": " . $ibp->LAST_ERROR . "<br>";
$bVarsFromForm = true;
}
}
} else {
$PropID = (int) $ibp->Add($arProperty);
if ($PropID <= 0) {
$strWarning .= $ibp->LAST_ERROR . "<br>";
$bVarsFromForm = true;
示例6: 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")) {
//.........这里部分代码省略.........
示例7: process
/**
*
*/
public function process()
{
if ($this->processed) {
return;
}
$this->processed = true;
foreach ($this->generateData() as $k => $v) {
$this->data[$k] = $v;
}
$this->update();
$o = new \CIBlock();
$mesages = $this->messages();
$o->SetMessages($this->getId(), $mesages);
$fields = $this->fields();
$o->SetFields($this->getId(), $fields);
$props = $this->loadProperties();
$newProps = $this->properties();
foreach ($this->urlsProps() as $key => $data) {
$newProps[$key] = $data;
}
$o = new \CIBlockProperty();
foreach ($props as $prop => $data) {
if (!isset($newProps[$prop])) {
$o->Delete($data['ID']);
}
}
foreach ($newProps as $prop => $data) {
$data['CODE'] = $prop;
if ($data['PROPERTY_TYPE'] == 'E' || $data['PROPERTY_TYPE'] == 'G') {
if (!isset($data['LINK_IBLOCK_ID'])) {
if (isset($data['LINK_IBLOCK_CODE'])) {
$data['LINK_IBLOCK_ID'] = self::codeToId($data['LINK_IBLOCK_CODE']);
}
}
}
if (isset($props[$prop])) {
$id = $props[$prop]['ID'];
$o->Update($id, $data);
} else {
$data['IBLOCK_ID'] = $this->getId();
$id = $o->Add($data);
}
if ($data['PROPERTY_TYPE'] == 'L' && isset($data['ITEMS']) && is_array($data['ITEMS'])) {
$items = array();
$newItems = $data['ITEMS'];
$res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $id, 'CHECK_PERMISSIONS' => 'N'));
while ($row = $res->Fetch()) {
$iid = $row['ID'];
$eid = $row['EXTERNAL_ID'];
if (!isset($newItems[$eid])) {
\CIBlockPropertyEnum::Delete($iid);
} else {
$items[$eid] = $row;
}
}
$eo = new \CIBlockPropertyEnum();
foreach ($newItems as $eid => $edata) {
if (is_string($edata)) {
$edata = array('VALUE' => $edata);
}
$edata['PROPERTY_ID'] = $id;
$edata['EXTERNAL_ID'] = $eid;
$edata['XML_ID'] = $eid;
if (isset($items[$eid])) {
$eo->Update($items[$eid]['ID'], $edata);
} else {
$eo->Add($edata);
}
}
}
}
}
示例8: delPropertiesInlock
protected function delPropertiesInlock($arProperties){
if (!CModule::IncludeModule("iblock")):
return false;
endif;
foreach ($arProperties as $key => $prop) :
if (!CIBlockProperty::Delete($prop["ID"])):
return false;
endif;
endforeach;
return $res;
}
示例9: ShowError
}
}
if (!empty($errorMsg)) {
ShowError($errorMsg);
}
unset($_GET['ID'], $_POST['ID'], $_REQUEST['ID']);
// otherwise the filter will work
/*if(!isset($_POST['AJAX_CALL']))
{
LocalRedirect($APPLICATION->GetCurPage());
}*/
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && check_bitrix_sessid() && isset($_GET['action_' . $arResult['GRID_ID']])) {
if ($arResult['CAN_DELETE'] && $_GET['action_' . $arResult['GRID_ID']] === 'delete') {
$id = isset($_GET['ID']) ? $_GET['ID'] : 0;
if ($id > 0) {
if (!CIBlockProperty::Delete($id)) {
$errorMsg .= GetMessage("CRM_PRODUCT_PROP_PL_DELETE_ERROR", array("#ID#" => $id)) . '<br>';
}
}
unset($_GET['ID'], $_REQUEST['ID']);
// otherwise the filter will work
}
if (!empty($errorMsg)) {
ShowError($errorMsg);
}
unset($_GET['ID'], $_POST['ID'], $_REQUEST['ID']);
// otherwise the filter will work
/*if(!isset($_POST['AJAX_CALL']))
{
LocalRedirect($APPLICATION->GetCurPage());
}*/
示例10: dropElementProperty
protected function dropElementProperty($iblockId, $propertyName)
{
$query = CIBlockProperty::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y", "IBLOCK_ID" => $iblockId, 'CODE' => $propertyName));
if ($query && ($row = $query->fetch())) {
CIBlockProperty::Delete($row['ID']);
}
}
示例11: LocalRedirect
}
if ($propID <= 0) {
$errMsg .= $ibp->LAST_ERROR;
$bVarsFromForm = true;
if ($e = $APPLICATION->GetException()) {
$errMsg .= $e->GetString() . '<br>';
}
} else {
if (isset($_POST['apply'])) {
LocalRedirect(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_EDIT'], array('prop_id' => $propID)));
} else {
LocalRedirect(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_LIST']));
}
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['delete'])) {
CIBlockProperty::Delete($propID);
LocalRedirect(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_LIST']));
}
}
$arResult['ERR_MSG'] = $errMsg . $errMsgDirValues;
if ($bVarsFromForm) {
$arProperty = array("ID" => $propID, "ACTIVE" => $_POST["PROPERTY_ACTIVE"], "IBLOCK_ID" => $iblockID, "NAME" => $_POST["PROPERTY_NAME"], "SORT" => $_POST["PROPERTY_SORT"], "CODE" => $_POST["PROPERTY_CODE"], "MULTIPLE" => $_POST["PROPERTY_MULTIPLE"], "IS_REQUIRED" => $_POST["PROPERTY_IS_REQUIRED"], "SEARCHABLE" => $_POST["PROPERTY_SEARCHABLE"], "FILTRABLE" => $_POST["PROPERTY_FILTRABLE"], "WITH_DESCRIPTION" => $_POST["PROPERTY_WITH_DESCRIPTION"], "MULTIPLE_CNT" => $_POST["PROPERTY_MULTIPLE_CNT"], "HINT" => $_POST["PROPERTY_HINT"], "SECTION_PROPERTY" => $_POST["PROPERTY_SECTION_PROPERTY"], "SMART_FILTER" => $_POST["PROPERTY_SMART_FILTER"], "ROW_COUNT" => $_POST["PROPERTY_ROW_COUNT"], "COL_COUNT" => $_POST["PROPERTY_COL_COUNT"], "DEFAULT_VALUE" => $_POST["PROPERTY_DEFAULT_VALUE"], "FILE_TYPE" => $_POST["PROPERTY_FILE_TYPE"]);
if (isset($_POST["PROPERTY_PROPERTY_TYPE"])) {
if (strpos($_POST["PROPERTY_PROPERTY_TYPE"], ":")) {
list($arProperty["PROPERTY_TYPE"], $arProperty["USER_TYPE"]) = explode(':', $_POST["PROPERTY_PROPERTY_TYPE"], 2);
} else {
$arProperty["PROPERTY_TYPE"] = $_POST["PROPERTY_PROPERTY_TYPE"];
}
}
if (!empty($arListValues)) {
$arProperty["VALUES"] = $arListValues;
示例12: 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) \CIBlockProperty::Delete($id));
$res->isSuccess() && $this->removeCurrentVersion($id);
return $res;
}
示例13: IblockPropertyDelete
/**
* @param string $iblock
* @param string $code
*/
protected function IblockPropertyDelete($iblock, $code)
{
$ibId = $this->IblockGetIdByCode($iblock);
if (!$ibId) {
throw new \Exception("Can't find iblock {$iblock}");
}
$res = \CIBlockProperty::GetList([], ['CODE' => $code, 'IBLOCK_ID' => $ibId, 'CHECK_PERMISSIONS' => 'N']);
if ($ob = $res->Fetch()) {
if (!\CIBlockProperty::Delete($ob['ID'])) {
throw new \Exception("Can't delete iblock property {$code}");
}
}
}
示例14: deletePropertyById
public function deletePropertyById($propertyId)
{
$ib = new \CIBlockProperty();
if ($ib->Delete($propertyId)) {
return true;
}
$this->throwException(__METHOD__, $ib->LAST_ERROR);
}
示例15: unset
$str_PROPERTY_ID = $str_PROPERTY_IDCheck;
unset($str_PROPERTY_IDCheck);
$rsProps = CIBlockProperty::GetByID($str_PROPERTY_ID, $intIBlockID);
if (!($arPropCheck = $rsProps->Fetch())) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
ShowError(str_replace('#ID#', $str_PROPERTY_ID, GetMessage("BT_ADM_IEP_PROPERTY_IS_NOT_EXISTS")));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
}
}
$bVarsFromForm = $bReload;
$message = false;
$strWarning = "";
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["action"]) && $_POST["action"] === "delete") {
CIBlockProperty::Delete($str_PROPERTY_ID);
if (strlen($return_url) > 0) {
LocalRedirect($return_url);
} else {
LocalRedirect('iblock_property_admin.php?lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $intIBlockID . ($_REQUEST["admin"] == "Y" ? "&admin=Y" : "&admin=N"));
}
} elseif (!$bReload && $_SERVER["REQUEST_METHOD"] == "POST" && (isset($_POST["save"]) || isset($_POST["apply"]))) {
$arFields = array("ACTIVE" => $_POST["PROPERTY_ACTIVE"], "IBLOCK_ID" => $_POST["IBLOCK_ID"], "LINK_IBLOCK_ID" => $_POST["PROPERTY_LINK_IBLOCK_ID"], "NAME" => $_POST["PROPERTY_NAME"], "SORT" => $_POST["PROPERTY_SORT"], "CODE" => $_POST["PROPERTY_CODE"], "MULTIPLE" => $_POST["PROPERTY_MULTIPLE"], "IS_REQUIRED" => $_POST["PROPERTY_IS_REQUIRED"], "SEARCHABLE" => $_POST["PROPERTY_SEARCHABLE"], "FILTRABLE" => $_POST["PROPERTY_FILTRABLE"], "WITH_DESCRIPTION" => $_POST["PROPERTY_WITH_DESCRIPTION"], "MULTIPLE_CNT" => $_POST["PROPERTY_MULTIPLE_CNT"], "HINT" => $_POST["PROPERTY_HINT"], "ROW_COUNT" => $_POST["PROPERTY_ROW_COUNT"], "COL_COUNT" => $_POST["PROPERTY_COL_COUNT"], "DEFAULT_VALUE" => $_POST["PROPERTY_DEFAULT_VALUE"], "LIST_TYPE" => $_POST["PROPERTY_LIST_TYPE"], "USER_TYPE_SETTINGS" => $_POST["PROPERTY_USER_TYPE_SETTINGS"], "FILE_TYPE" => $_POST["PROPERTY_FILE_TYPE"]);
if (isset($_POST["PROPERTY_SECTION_PROPERTY"])) {
$arFields["SECTION_PROPERTY"] = $_POST["PROPERTY_SECTION_PROPERTY"];
if (isset($_POST["PROPERTY_SMART_FILTER"])) {
$arFields["SMART_FILTER"] = $_POST["PROPERTY_SMART_FILTER"];
}
if (isset($_POST["PROPERTY_DISPLAY_TYPE"])) {
$arFields["DISPLAY_TYPE"] = $_POST["PROPERTY_DISPLAY_TYPE"];
}