本文整理汇总了PHP中CIBlockSection::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::Delete方法的具体用法?PHP CIBlockSection::Delete怎么用?PHP CIBlockSection::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSection
的用法示例。
在下文中一共展示了CIBlockSection::Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeleteCategory
function DeleteCategory($ID)
{
$iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
if ($iblock_permission < "W") {
$GLOBALS["USER"]->RequiredHTTPAuthBasic();
return new CSOAPFault('Server Error', 'Unable to authorize user.');
}
$ib_section = new CIBlockSection();
if ($ib_section->Delete($ID)) {
CIBlockSection::ReSort();
return 1;
}
return new CSOAPFault('Server Error', 'Error: ' . $ib_section->LAST_ERROR);
}
示例2: DeleteDepartment
function DeleteDepartment($arFields)
{
$dpt = intval($arFields['dpt_id']);
global $iblockID;
$dbRes = CIBlockSection::GetList(array(), array("ID" => $dpt, "IBLOCK_ID" => $iblockID, "CHECK_PERMISSIONS" => "Y"), false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID'));
if ($arSection = $dbRes->Fetch()) {
if ($arSection['IBLOCK_SECTION_ID'] > 0) {
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $iblockID, 'SECTION_ID' => $arSection['ID']), false, array('ID', 'IBLOCK_ID'));
$obIBlockSection = new CIBlockSection();
$GLOBALS['DB']->StartTransaction();
while ($arRes = $dbRes->Fetch()) {
$obIBlockSection->Update($arRes['ID'], array('IBLOCK_SECTION_ID' => $arSection['IBLOCK_SECTION_ID']));
}
if ($obIBlockSection->Delete($arSection['ID'])) {
$GLOBALS['DB']->Commit();
echo "{id: '" . $arSection['IBLOCK_SECTION_ID'] . "'}";
} else {
$GLOBALS['DB']->Rollback();
$res = array('error' => trim(str_replace('<br>', "\n", $ob->LAST_ERROR)));
echo "{errors: '" . $res["error"] . "'}";
}
}
}
}
示例3: array
continue;
}
}
switch($_REQUEST['action'])
{
case "delete":
@set_time_limit(0);
if($TYPE=="S")
{
if(CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $ID, "section_delete"))
{
$DB->StartTransaction();
$APPLICATION->ResetException();
if(!CIBlockSection::Delete($ID))
{
$DB->Rollback();
if($ex = $APPLICATION->GetException())
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SECTION_DELETE_ERROR", array("#ID#" => $ID))." [".$ex->GetString()."]", $TYPE.$ID);
else
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SECTION_DELETE_ERROR", array("#ID#" => $ID)), $TYPE.$ID);
}
else
{
$DB->Commit();
}
}
else
{
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SECTION_DELETE_ERROR", array("#ID#" => $ID)), $TYPE.$ID);
示例4: array
$arResultSection = $rsSection->GetNext();
$arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_URL"], array("USER_ALIAS" => $arParams["USER_ALIAS"], "SECTION_ID" => $ID));
$arResultFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "DATE" => PhotoDateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($_REQUEST["UF_DATE"], CSite::GetDateFormat())), "NAME" => $arResultSection["NAME"], "DESCRIPTION" => $arResultSection["DESCRIPTION"], "PASSWORD" => $arResultSection["UF_PASSWORD"], "ID" => $ID, "error" => "", "url" => $arResult["URL"]);
} elseif ($bs->LAST_ERROR) {
$strWarning .= $bs->LAST_ERROR;
$bVarsFromForm = true;
} else {
$err = $GLOBALS['APPLICATION']->GetException();
if ($err) {
$strWarning .= $err->GetString();
}
$bVarsFromForm = true;
}
} elseif ($arParams["ACTION"] == "DROP") {
@set_time_limit(1000);
if (CIBlockSection::Delete($arResult["SECTION"]["ID"])) {
// /Must Be deleted
if ($arParams["BEHAVIOUR"] == "USER" && intVal($arResult["SECTION"]["IBLOCK_SECTION_ID"]) == intVal($arResult["GALLERY"]["ID"])) {
$arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["~GALLERY_URL"], array("USER_ALIAS" => $arParams["USER_ALIAS"]));
} elseif (intVal($arResult["SECTION"]["IBLOCK_SECTION_ID"]) > 0) {
$arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_URL"], array("USER_ALIAS" => $arParams["USER_ALIAS"], "SECTION_ID" => $arResult["SECTION"]["IBLOCK_SECTION_ID"]));
} else {
$arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["~INDEX_URL"], array());
}
$arResultFields = array("ID" => $arResult["SECTION"]["ID"], "error" => "", "url" => $arResult["URL"]);
} elseif ($e = $APPLICATION->GetException()) {
$strWarning .= $e->GetString();
} else {
$strWarning .= GetMessage("IBSEC_A_DELERR_REFERERS");
}
}
示例5: array
if (IntVal($arParams["USERGROUPS_RESERVE"]) > 0) {
$arParams["USERGROUPS_RESERVE"] = array($arParams["USERGROUPS_RESERVE"]);
} else {
$arParams["USERGROUPS_RESERVE"] = array();
}
}
$arResult["FatalError"] = "";
if (!CIBlockRights::UserHasRightTo($iblockId, $iblockId, 'element_read')) {
$arResult["FatalError"] .= GetMessage("INTS_NO_IBLOCK_PERMS") . ".";
}
if (StrLen($arResult["FatalError"]) <= 0) {
$deleteMeetingId = IntVal($_REQUEST["delete_meeting_id"]);
if ($deleteMeetingId > 0 && check_bitrix_sessid() && $GLOBALS["USER"]->IsAuthorized() && ($GLOBALS["USER"]->IsAdmin() || Count(Array_Intersect($GLOBALS["USER"]->GetUserGroupArray(), $arParams["USERGROUPS_MODIFY"])) > 0)) {
$dbMeetingsList = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $iblockId, "ID" => $deleteMeetingId));
if ($arMeeting = $dbMeetingsList->Fetch()) {
CIBlockSection::Delete($arMeeting["ID"]);
}
}
}
$arResult["ALLOWED_FIELDS"] = array("ID" => array("NAME" => GetMessage("INAF_F_ID"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "int", "IS_FIELD" => true), "NAME" => array("NAME" => GetMessage("INAF_F_NAME"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "string", "IS_FIELD" => true), "DESCRIPTION" => array("NAME" => GetMessage("INAF_F_DESCRIPTION"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "text", "IS_FIELD" => true), "UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "string", "IS_FIELD" => false));
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockId . "_SECTION", 0, LANGUAGE_ID);
$arKeys = Array_Keys($arResult["ALLOWED_FIELDS"]);
foreach ($arKeys as $key) {
if (!$arResult["ALLOWED_FIELDS"][$key]["IS_FIELD"]) {
if (!Array_Key_Exists($key, $arUserFields)) {
$arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arResult["ALLOWED_FIELDS"][$key]["TYPE"]);
$obUserField = new CUserTypeEntity();
$obUserField->Add($arFields);
}
}
}
示例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: array
if (CWikiSocnet::IsSocNet()) {
$arFilter['>LEFT_BORDER'] = CWikiSocnet::$iCatLeftBorder;
$arFilter['<RIGHT_BORDER'] = CWikiSocnet::$iCatRightBorder;
}
if (!empty($sCategoryName)) {
$arFilter['NAME'] = $sCategoryName;
}
$dbList = CIBlockSection::GetList(array('NAME' => 'ASC'), $arFilter, true);
$arResult['CATEGORIES'] = array();
$categories = new CWikiCategories();
$catParams = new CWikiCategoryParams();
$catParams->setPathTemplate($arParams['PATH_TO_CATEGORY']);
while ($arCat = $dbList->GetNext()) {
//fix: http://jabber.bx/view.php?id=26658
if ($arCat['ELEMENT_CNT'] <= 0) {
CIBlockSection::Delete($arCat['ID'], false);
continue;
}
$catParams->sName = $arCat['NAME'];
$catParams->sTitle = $arCat['NAME'];
$catParams->iItemsCount = $arCat['ELEMENT_CNT'];
$catParams->bIsRed = 'Y';
$catParams->createLinkFromTemplate();
$categories->addItem($catParams);
}
//Pages without categories
$arElementFilter = array("IBLOCK_ID" => $arParams['IBLOCK_ID'], "SECTION_ID" => CWikiSocnet::IsSocNet() ? CWikiSocnet::$iCatId : false, "INCLUDE_SUBSECTIONS" => "N", "ACTIVE" => "Y");
$noCatCount = CIBlockElement::GetList(array(), $arElementFilter, array(), false, array("ID"));
$catParams->sName = GetMessage("WIKI_CATEGORY_NOCAT");
$catParams->sTitle = GetMessage("WIKI_CATEGORY_NOCAT_TITLE");
$catParams->iItemsCount = $noCatCount;
示例8: delete
/**
* Удаляет запись
* @return bool
*/
public function delete()
{
$id = $this->getAttribute('id')->getValue();
if ($id > 0 && \CModule::IncludeModule('iblock')) {
$res = \CIBlockSection::Delete($id);
if ($res) {
$this->getAttribute('id')->setValue(0);
}
return $res;
} else {
return false;
}
}
示例9: removeSpecification
/**
* [removeSpecification description]
* @param array $arParams
* @return bool
*/
function removeSpecification($arParams)
{
if (!CModule::IncludeModule('iblock')) {
return false;
}
$arSelect = array("NAME", "ID");
$arFilter = array("IBLOCK_ID" => getIblockSpecifications(), "ACTIVE" => "Y", "SECTION_ID" => intval($arParams["spec"]));
$res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arItems[] = $ob->GetFields();
}
foreach ($arItems as $key => $item) {
if (!CIBlockElement::Delete($item["ID"])) {
return false;
}
}
if (CIBlockSection::Delete($arParams["spec"])) {
return true;
}
return false;
}
示例10: switch
//.........这里部分代码省略.........
}
}
if ($action != 'set_department_head' || $dpt_id != $dpt_from) {
$dbRes = CIBlockSection::GetList(array(), array('ID' => $dpt_from, 'IBLOCK_ID' => $IBLOCK_ID, 'UF_HEAD' => $user_id));
if ($arSection = $dbRes->GetNext()) {
if ($type != 1) {
$arUndo[] = array('action' => 'set_department_head', 'dpt_id' => $dpt_from, 'user_id' => $user_id);
}
$obIBlockSection = new CIBlockSection();
$obIBlockSection->Update($dpt_from, array('UF_HEAD' => 0));
}
}
}
}
if (!$ok) {
$res = array('error' => 'Wrong data');
} else {
$mode = 'reload';
}
break;
case 'delete_department':
$dpt = intval($_REQUEST['dpt_id']);
$dbRes = CIBlockSection::GetList(array(), array("ID" => $dpt, "IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "Y"));
if ($arSection = $dbRes->Fetch()) {
if ($arSection['IBLOCK_SECTION_ID'] > 0) {
$dbRes = CUser::GetList($by, $order, array('UF_DEPARTMENT' => $dpt), array('SELECT' => array('ID')));
if (!$dbRes->Fetch()) {
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'SECTION_ID' => $arSection['ID']));
$obIBlockSection = new CIBlockSection();
$GLOBALS['DB']->StartTransaction();
while ($arRes = $dbRes->Fetch()) {
$obIBlockSection->Update($arRes['ID'], array('IBLOCK_SECTION_ID' => $arSection['IBLOCK_SECTION_ID']));
}
if ($obIBlockSection->Delete($arSection['ID'])) {
$GLOBALS['DB']->Commit();
$mode = 'reload';
} else {
$GLOBALS['DB']->Rollback();
$res = array('error' => trim(str_replace('<br>', "\n", $ob->LAST_ERROR)));
}
} else {
$res = array('error' => GetMessage('ISV_ERROR_dpt_not_empty'));
}
}
}
break;
case 'move_department':
$dpt = intval($_REQUEST['dpt_id']);
$dpt_to = intval($_REQUEST['dpt_to']);
$ok = false;
if ($dpt > 0 && $dpt_to > 0) {
$dbRes = CIBlockSection::GetList(array(), array("ID" => array($dpt, $dpt_to), 'IBLOCK_ID' => $IBLOCK_ID, "CHECK_PERMISSIONS" => "Y"));
while ($arRes = $dbRes->GetNext()) {
if ($arRes['ID'] == $dpt) {
$arSection = $arRes;
} else {
$arSectionTo = $arRes;
}
}
if ($arSection && $arSectionTo) {
$ok = true;
$ob = new CIBlockSection();
if ($ob->Update($dpt, array('IBLOCK_SECTION_ID' => $dpt_to))) {
$mode = 'reload';
$arUndo[] = array('action' => 'move_department', 'dpt_id' => $dpt, 'dpt_to' => $arSection['IBLOCK_SECTION_ID']);
$undo_text = GetMessage('ISV_move_department', array("#DEPARTMENT#" => $arSection["NAME"], "#DEPARTMENT_TO#" => $arSectionTo["NAME"]));
示例11: departmentDelete
public static function departmentDelete($params)
{
if (self::canEdit()) {
CModule::IncludeModule('iblock');
$params = array_change_key_case($params, CASE_UPPER);
$arDept = self::getDepartment($params['ID']);
if (is_array($arDept)) {
$ob = new CIBlockSection();
if (!$ob->Delete($arDept['ID'])) {
throw new Exception($ob->LAST_ERROR);
}
return true;
} else {
throw new Exception('Department not found');
}
} else {
throw new Exception('Access denied!');
}
}
示例12: orderHistory
//.........这里部分代码省略.........
}
$LID = $arFields['LID'];
$userId = $arFields['USER_ID'];
if (isset($order['customer']['externalId']) && !is_null($order['customer']['externalId'])) {
$userId = $order['customer']['externalId'];
}
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
$arUpdateProps = array();
while ($ar = $rsOrderProps->Fetch()) {
$prop = CSaleOrderProps::GetByID($ar['ORDER_PROPS_ID']);
$arUpdateProps[$ar['CODE']] = array('ID' => $ar['ID'], 'TYPE' => $prop['TYPE'], 'VALUE' => $ar['VALUE']);
}
$order['fio'] = trim(implode(' ', array(isset($order['lastName']) ? $order['lastName'] : '', isset($order['firstName']) ? $order['firstName'] : '', isset($order['patronymic']) ? $order['patronymic'] : '')));
if (isset($order['delivery']['address']['city'])) {
$order['location'] = $order['delivery']['address']['city'];
}
if (isset($order['orderType']) && isset($optionsOrderTypes[$order['orderType']])) {
if (isset($optionsOrderProps[$arFields['PERSON_TYPE_ID']])) {
foreach ($optionsOrderProps[$arFields['PERSON_TYPE_ID']] as $code => $value) {
if (in_array($code, array_keys($order)) === false && isset($optionsOrderProps[$optionsOrderTypes[$order['orderType']]][$code])) {
$order[$code] = $arUpdateProps[$optionsOrderProps[$arFields['PERSON_TYPE_ID']][$code]]['VALUE'];
}
}
}
//update ordertype
CSaleOrder::Update($order['externalId'], array('PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']]));
$arProp = CSaleOrderProps::GetList(array(), array('PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']]));
$typeParam = array();
while ($ar = $arProp->Fetch()) {
$typeParam[$ar['CODE']] = $ar['CODE'];
}
foreach (array_diff_key($arUpdateProps, $typeParam) as $code => $param) {
if (isset($arUpdateProps[$code])) {
CSaleOrderPropsValue::Delete($param['ID']);
}
}
$arFields['PERSON_TYPE_ID'] = $optionsOrderTypes[$order['orderType']];
}
array_walk_recursive(self::clearArr($order), 'self::recursiveUpdate', array('update' => $arUpdateProps, 'type' => $arFields['PERSON_TYPE_ID'], 'options' => $optionsOrderProps, 'orderId' => $order['externalId']));
foreach ($order['items'] as $item) {
if (isset($item['deleted']) && $item['deleted']) {
if ($p = CSaleBasket::GetList(array(), array('ORDER_ID' => $order['externalId'], 'PRODUCT_ID' => $item['id']))->Fetch()) {
if (!CSaleBasket::Delete($p['ID'])) {
self::eventLog('ICrmOrderActions::orderHistory', 'CSaleBasket::Delete', 'Error element delete');
}
} else {
$prp = CSaleBasket::GetPropsList(array(), array("ORDER_ID" => $order['externalId'], "CODE" => 'ID', "VALUE" => $item['id']))->Fetch();
if (!CSaleBasket::Delete($prp['BASKET_ID'])) {
self::eventLog('ICrmOrderActions::orderHistory', 'CSaleBasket::Delete', 'Error castom element delete');
}
}
continue;
}
if (isset($item['offer']) === false && isset($item['offer']['externalId']) === false) {
continue;
}
$res = CIBlockElement::GetByID($item['offer']['externalId'])->Fetch();
if ($res) {
$p = CSaleBasket::GetList(array(), array('ORDER_ID' => $order['externalId'], 'PRODUCT_ID' => $item['offer']['externalId']))->Fetch();
if ($p == false) {
$p = CIBlockElement::GetByID($item['offer']['externalId'])->GetNext();
$iblock = CIBlock::GetByID($p['IBLOCK_ID'])->Fetch();
$p['CATALOG_XML_ID'] = $iblock['XML_ID'];
$p['PRODUCT_XML_ID'] = $p['XML_ID'];
unset($p['XML_ID']);
} elseif ($propResult = CSaleBasket::GetPropsList(array(''), array('BASKET_ID' => $p['ID']))) {
示例13: InstallService
function InstallService($serviceID, $serviceStage)
{
$wizard =& $this->GetWizard();
if (CModule::IncludeModule("iblock")) {
$type = substr($serviceID, 0, -1);
if ($type == "iblockElement") {
$dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockElement::Delete($arItem["ID"]);
}
} elseif ($type == "iblockSectionElement") {
$dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockElement::Delete($arItem["ID"]);
}
$dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockSection::Delete($arItem["ID"]);
}
} elseif ($serviceID == "iblockDepartmentsElement") {
$dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => "departments"));
while ($arItem = $dbItem->Fetch()) {
if ($arItem["DEPTH_LEVEL"] > 2) {
CIBlockSection::Delete($arItem["ID"]);
}
}
} elseif ($serviceID == "tasks") {
if (CModule::IncludeModule("tasks")) {
$dbItem = CTasks::GetList(array(), array("SITE_ID" => $wizard->GetVar("siteID")));
while ($arItem = $dbItem->Fetch()) {
CTasks::Delete($arItem["ID"]);
}
}
} elseif ($serviceID == "calendar") {
if (CModule::IncludeModule("calendar")) {
$dbItem = CCalendarEvent::GetList();
foreach ($dbItem as $arItem) {
CCalendarEvent::Delete(array("id" => $arItem["ID"]));
}
}
} elseif ($serviceID == "meeting") {
if (CModule::IncludeModule("meeting")) {
$dbItem = CMeeting::GetList(array(), array());
while ($arItem = $dbItem->Fetch()) {
if ($arItem["ID"]) {
CMeeting::Delete($arItem["ID"]);
}
}
}
} elseif ($serviceID == "user") {
if ($serviceStage == "user") {
$dbUser = CUser::GetList($by = "ID", $order = "DESC", array(">ID" => 1));
while ($arUser = $dbUser->Fetch()) {
CUser::Delete($arUser["ID"]);
}
}
} elseif ($serviceID == "crm") {
if ($serviceStage == "crm") {
if (CModule::IncludeModule('crm')) {
$CCrmLead = new CCrmLead();
$resLead = CCrmLead::GetList(array(), array(), array(), false);
while ($rowLead = $resLead->Fetch()) {
$CCrmLead->Delete($rowLead["ID"]);
}
$CCrmContact = new CCrmContact();
$resContact = CCrmContact::GetList(array(), array(), array(), false);
while ($rowContact = $resContact->Fetch()) {
$CCrmContact->Delete($rowContact["ID"]);
}
$CCrmCompany = new CCrmCompany();
$resCompany = CCrmCompany::GetList(array(), array(), array(), false);
while ($rowCompany = $resCompany->Fetch()) {
$CCrmCompany->Delete($rowCompany["ID"]);
}
$CCrmDeal = new CCrmDeal();
$resDeal = CCrmDeal::GetList(array(), array(), array(), false);
while ($rowDeal = $resDeal->Fetch()) {
$CCrmDeal->Delete($rowDeal["ID"]);
}
}
}
} elseif ($serviceID == "cache") {
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/cache_html.php";
if ($serviceStage == "cache1") {
BXClearCache(true);
} elseif ($serviceStage == "cache2") {
$GLOBALS["CACHE_MANAGER"]->CleanAll();
} elseif ($serviceStage == "cache3") {
$GLOBALS["stackCacheManager"]->CleanAll();
} elseif ($serviceStage == "cache4") {
CHTMLPagesCache::CleanAll();
}
COption::SetOptionString("main", "wizard_clear_exec", "Y", false, $wizard->GetVar("siteID"));
}
}
}
示例14: array
if ($rsSection->GetNext()) {
$arFields = array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "NAME" => $new_section_name);
$obSection->Update($old_section_id, $arFields);
}
}
}
if (isset($_POST["form_section_action"]) && $_POST["form_section_action"] == "add" && !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::CAN_WRITE || $old_section_id == 0 && CIBlockSectionRights::UserHasRightTo($arIBlock["ID"], $arResult["SECTION_ID"], "section_section_bind"))) {
$new_section_name = trim($_POST["new_section_name"], " \n\r\t");
if ($new_section_name) {
$arFields = array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "NAME" => $new_section_name, "IBLOCK_SECTION_ID" => $arResult["SECTION_ID"], "CHECK_PERMISSIONS" => "N");
$obSection->Add($arFields);
}
} elseif ($_POST["action_button_" . $arResult["GRID_ID"]] == "delete" && isset($_POST["ID"]) && is_array($_POST["ID"]) && !$arResult["IS_SOCNET_GROUP_CLOSED"]) {
foreach ($_POST["ID"] as $ID) {
if ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($arIBlock["ID"], $ID, "section_delete")) {
$obSection->Delete($ID, false);
}
}
} elseif ($_POST["action_button_" . $arResult["GRID_ID"]] == "edit" && isset($_POST["FIELDS"]) && is_array($_POST["FIELDS"]) && !$arResult["IS_SOCNET_GROUP_CLOSED"]) {
foreach ($_POST["FIELDS"] as $ID => $arField) {
if ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($arIBlock["ID"], $ID, "section_edit")) {
$arFields = array("NAME" => $arField["NAME"], "CHECK_PERMISSIONS" => "N");
$obSection->Update($ID, $arFields);
}
}
}
if (!isset($_POST["AJAX_CALL"])) {
LocalRedirect($arResult["LIST_SECTION_URL"]);
}
}
$grid_options = new CGridOptions($arResult["GRID_ID"]);
示例15: delSection
/**
* [delSection description]
* @param int $id
* @return bool
*/
protected function delSection($id){
return CIBlockSection::Delete($id);
}