本文整理匯總了PHP中CIBlockElement::UpdateSearch方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIBlockElement::UpdateSearch方法的具體用法?PHP CIBlockElement::UpdateSearch怎麽用?PHP CIBlockElement::UpdateSearch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::UpdateSearch方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Update
function Update($ID, $arFields, $bWorkFlow = false, $bUpdateSearch = true, $bResizePictures = false, $bCheckDiskQuota = true)
{
global $DB, $USER;
$ID = intval($ID);
$db_element = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_HISTORY" => "Y"), false, false, array("ID", "TIMESTAMP_X", "MODIFIED_BY", "DATE_CREATE", "CREATED_BY", "IBLOCK_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "SORT", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "WF_STATUS_ID", "WF_PARENT_ELEMENT_ID", "WF_NEW", "WF_COMMENTS", "IN_SECTIONS", "CODE", "TAGS", "XML_ID", "TMP_ID"));
if (!($ar_element = $db_element->Fetch())) {
return false;
}
$arIBlock = CIBlock::GetArrayByID($ar_element["IBLOCK_ID"]);
$bWorkFlow = $bWorkFlow && is_array($arIBlock) && $arIBlock["WORKFLOW"] != "N" && CModule::IncludeModule("workflow");
$ar_wf_element = $ar_element;
$LAST_ID = 0;
if ($bWorkFlow) {
$LAST_ID = CIBlockElement::WF_GetLast($ID);
if ($LAST_ID != $ID) {
$db_element = CIBlockElement::GetByID($LAST_ID);
if (!($ar_wf_element = $db_element->Fetch())) {
return false;
}
}
$arFields["WF_PARENT_ELEMENT_ID"] = $ID;
if (!array_key_exists("PROPERTY_VALUES", $arFields) || !is_array($arFields["PROPERTY_VALUES"])) {
$arFields["PROPERTY_VALUES"] = array();
}
$bFieldProps = array();
foreach ($arFields["PROPERTY_VALUES"] as $k => $v) {
$bFieldProps[$k] = true;
}
$arFieldProps =& $arFields['PROPERTY_VALUES'];
$props = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $ar_wf_element["ID"]);
while ($arProp = $props->Fetch()) {
$pr_val_id = $arProp['PROPERTY_VALUE_ID'];
if ($arProp['PROPERTY_TYPE'] == 'F' && strlen($pr_val_id) > 0) {
if (strlen($arProp["CODE"]) > 0 && is_set($arFieldProps, $arProp["CODE"])) {
$pr_id = $arProp["CODE"];
} else {
$pr_id = $arProp['ID'];
}
if (array_key_exists($pr_id, $arFieldProps) && array_key_exists($pr_val_id, $arFieldProps[$pr_id]) && is_array($arFieldProps[$pr_id][$pr_val_id])) {
$new_value = $arFieldProps[$pr_id][$pr_val_id];
if (strlen($new_value['name']) <= 0 && $new_value['del'] != "Y" && strlen($new_value['VALUE']['name']) <= 0 && $new_value['VALUE']['del'] != "Y") {
if (array_key_exists('DESCRIPTION', $new_value) && $new_value['DESCRIPTION'] != $arProp['DESCRIPTION']) {
$p = array("VALUE" => CFile::MakeFileArray($arProp['VALUE']));
$p["DESCRIPTION"] = $new_value["DESCRIPTION"];
$p["MODULE_ID"] = "iblock";
$arFieldProps[$pr_id][$pr_val_id] = $p;
} elseif ($arProp['VALUE'] > 0) {
$arFieldProps[$pr_id][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
}
} else {
$arFieldProps[$pr_id][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
continue;
}
if (strlen($pr_val_id) <= 0 || array_key_exists($arProp["ID"], $bFieldProps) || strlen($arProp["CODE"]) > 0 && array_key_exists($arProp["CODE"], $bFieldProps)) {
continue;
}
$arFieldProps[$arProp["ID"]][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
if ($ar_wf_element["IN_SECTIONS"] == "Y") {
$ar_wf_element["IBLOCK_SECTION"] = array();
$rsSections = CIBlockElement::GetElementGroups($ar_element["ID"], true, array('ID', 'IBLOCK_ELEMENT_ID'));
while ($arSection = $rsSections->Fetch()) {
$ar_wf_element["IBLOCK_SECTION"][] = $arSection["ID"];
}
}
unset($ar_wf_element["DATE_ACTIVE_FROM"]);
unset($ar_wf_element["DATE_ACTIVE_TO"]);
unset($ar_wf_element["EXTERNAL_ID"]);
unset($ar_wf_element["TIMESTAMP_X"]);
unset($ar_wf_element["ID"]);
$arFields = $arFields + $ar_wf_element;
}
$arFields["WF"] = $bWorkFlow ? "Y" : "N";
$bBizProc = is_array($arIBlock) && $arIBlock["BIZPROC"] == "Y" && IsModuleInstalled("bizproc");
if (array_key_exists("BP_PUBLISHED", $arFields)) {
if ($bBizProc) {
if ($arFields["BP_PUBLISHED"] == "Y") {
$arFields["WF_STATUS_ID"] = 1;
$arFields["WF_NEW"] = false;
} else {
$arFields["WF_STATUS_ID"] = 2;
$arFields["WF_NEW"] = "Y";
$arFields["BP_PUBLISHED"] = "N";
}
} else {
$arFields["WF_NEW"] = false;
unset($arFields["BP_PUBLISHED"]);
}
} else {
$arFields["WF_NEW"] = false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "PREVIEW_TEXT_TYPE") && $arFields["PREVIEW_TEXT_TYPE"] != "html") {
$arFields["PREVIEW_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "DETAIL_TEXT_TYPE") && $arFields["DETAIL_TEXT_TYPE"] != "html") {
//.........這裏部分代碼省略.........
示例2: UnpublishDocument
/**
* ћетод снимает документ с публикации. “о есть делает его недоступным в публичной части сайта.
*
* @param string $documentId - код документа.
*/
public function UnpublishDocument($documentId)
{
global $DB;
CIBlockElement::WF_CleanUpHistoryCopies($documentId, 0);
$strSql = "update b_iblock_element set WF_STATUS_ID='2', WF_NEW='Y' WHERE ID=" . intval($documentId) . " AND WF_PARENT_ELEMENT_ID IS NULL";
$z = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
CIBlockElement::UpdateSearch($documentId);
}
示例3: while
\Bitrix\Iblock\PropertyIndex\Manager::updateElementIndex($IBLOCK_ID, $previousProductId);
}
$updateFacet = false;
$previousProductId = $PRODUCT_ID;
}
} else {
$error_lines++;
$strImportErrorMessage .= $strErrorR;
}
if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
break;
}
} while ($arRes = $csvFile->Fetch());
}
if ($PRODUCT_ID > 0) {
CIBlockElement::UpdateSearch($PRODUCT_ID);
if ($updateFacet) {
\Bitrix\Iblock\PropertyIndex\Manager::updateElementIndex($IBLOCK_ID, $PRODUCT_ID);
}
$updateFacet = false;
}
//////////////////////////////
// start additional actions //
//////////////////////////////
// activate 'in-file' sections
if ($bAllLinesLoaded && $bThereIsGroups && $inFileAction == 'A' && !$bDeactivationStarted) {
$res = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID, "TMP_ID" => $tmpid, "ACTIVE" => "N", 'CHECK_PERMISSIONS' => 'N'), false, array('ID', 'NAME'));
while ($arr = $res->Fetch()) {
$bs->Update($arr["ID"], array("NAME" => $arr["NAME"], "ACTIVE" => "Y"));
if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
break;
示例4: Add
function Add($arFields, $bWorkFlow = false, $bUpdateSearch = true, $bResizePictures = false)
{
global $DB, $USER;
$arIBlock = CIBlock::GetArrayByID($arFields["IBLOCK_ID"]);
$bWorkFlow = $bWorkFlow && is_array($arIBlock) && $arIBlock["WORKFLOW"] != "N" && CModule::IncludeModule("workflow");
$bBizProc = is_array($arIBlock) && $arIBlock["BIZPROC"] == "Y" && IsModuleInstalled("bizproc");
if (array_key_exists("BP_PUBLISHED", $arFields)) {
if ($bBizProc) {
if ($arFields["BP_PUBLISHED"] == "Y") {
$arFields["WF_STATUS_ID"] = 1;
$arFields["WF_NEW"] = false;
} else {
$arFields["WF_STATUS_ID"] = 2;
$arFields["WF_NEW"] = "Y";
$arFields["BP_PUBLISHED"] = "N";
}
} else {
unset($arFields["BP_PUBLISHED"]);
}
}
if (array_key_exists("IBLOCK_SECTION_ID", $arFields)) {
if (!array_key_exists("IBLOCK_SECTION", $arFields)) {
$arFields["IBLOCK_SECTION"] = array($arFields["IBLOCK_SECTION_ID"]);
} elseif (is_array($arFields["IBLOCK_SECTION"]) && !in_array($arFields["IBLOCK_SECTION_ID"], $arFields["IBLOCK_SECTION"])) {
unset($arFields["IBLOCK_SECTION_ID"]);
}
}
$strWarning = "";
if ($bResizePictures) {
$arDef = $arIBlock["FIELDS"]["PREVIEW_PICTURE"]["DEFAULT_VALUE"];
if ($arDef["FROM_DETAIL"] === "Y" && is_array($arFields["DETAIL_PICTURE"]) && $arFields["DETAIL_PICTURE"]["size"] > 0 && ($arDef["UPDATE_WITH_DETAIL"] === "Y" || $arFields["PREVIEW_PICTURE"]["size"] <= 0)) {
$arNewPreview = $arFields["DETAIL_PICTURE"];
$arNewPreview["COPY_FILE"] = "Y";
if (isset($arFields["PREVIEW_PICTURE"]) && is_array($arFields["PREVIEW_PICTURE"]) && isset($arFields["PREVIEW_PICTURE"]["description"])) {
$arNewPreview["description"] = $arFields["PREVIEW_PICTURE"]["description"];
}
$arFields["PREVIEW_PICTURE"] = $arNewPreview;
}
if (array_key_exists("PREVIEW_PICTURE", $arFields) && is_array($arFields["PREVIEW_PICTURE"]) && $arDef["SCALE"] === "Y") {
$arNewPicture = CIBlock::ResizePicture($arFields["PREVIEW_PICTURE"], $arDef);
if (is_array($arNewPicture)) {
$arNewPicture["description"] = $arFields["PREVIEW_PICTURE"]["description"];
$arFields["PREVIEW_PICTURE"] = $arNewPicture;
} elseif ($arDef["IGNORE_ERRORS"] !== "Y") {
unset($arFields["PREVIEW_PICTURE"]);
$strWarning .= GetMessage("IBLOCK_FIELD_PREVIEW_PICTURE") . ": " . $arNewPicture . "<br>";
}
}
if (array_key_exists("PREVIEW_PICTURE", $arFields) && is_array($arFields["PREVIEW_PICTURE"]) && $arDef["USE_WATERMARK_FILE"] === "Y") {
if (strlen($arFields["PREVIEW_PICTURE"]["tmp_name"]) > 0 && ($arFields["PREVIEW_PICTURE"]["tmp_name"] === $arFields["DETAIL_PICTURE"]["tmp_name"] || $arFields["PREVIEW_PICTURE"]["COPY_FILE"] == "Y" && !$arFields["PREVIEW_PICTURE"]["copy"])) {
$tmp_name = CTempFile::GetFileName(basename($arFields["PREVIEW_PICTURE"]["tmp_name"]));
CheckDirPath($tmp_name);
copy($arFields["PREVIEW_PICTURE"]["tmp_name"], $tmp_name);
$arFields["PREVIEW_PICTURE"]["copy"] = true;
$arFields["PREVIEW_PICTURE"]["tmp_name"] = $tmp_name;
}
CIBLock::FilterPicture($arFields["PREVIEW_PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_FILE_POSITION"], "type" => "file", "size" => "real", "alpha_level" => 100 - min(max($arDef["WATERMARK_FILE_ALPHA"], 0), 100), "file" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_FILE"])));
}
if (array_key_exists("PREVIEW_PICTURE", $arFields) && is_array($arFields["PREVIEW_PICTURE"]) && $arDef["USE_WATERMARK_TEXT"] === "Y") {
if (strlen($arFields["PREVIEW_PICTURE"]["tmp_name"]) > 0 && ($arFields["PREVIEW_PICTURE"]["tmp_name"] === $arFields["DETAIL_PICTURE"]["tmp_name"] || $arFields["PREVIEW_PICTURE"]["COPY_FILE"] == "Y" && !$arFields["PREVIEW_PICTURE"]["copy"])) {
$tmp_name = CTempFile::GetFileName(basename($arFields["PREVIEW_PICTURE"]["tmp_name"]));
CheckDirPath($tmp_name);
copy($arFields["PREVIEW_PICTURE"]["tmp_name"], $tmp_name);
$arFields["PREVIEW_PICTURE"]["copy"] = true;
$arFields["PREVIEW_PICTURE"]["tmp_name"] = $tmp_name;
}
CIBLock::FilterPicture($arFields["PREVIEW_PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_TEXT_POSITION"], "type" => "text", "coefficient" => $arDef["WATERMARK_TEXT_SIZE"], "text" => $arDef["WATERMARK_TEXT"], "font" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_TEXT_FONT"]), "color" => $arDef["WATERMARK_TEXT_COLOR"]));
}
$arDef = $arIBlock["FIELDS"]["DETAIL_PICTURE"]["DEFAULT_VALUE"];
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"]) && $arDef["SCALE"] === "Y") {
$arNewPicture = CIBlock::ResizePicture($arFields["DETAIL_PICTURE"], $arDef);
if (is_array($arNewPicture)) {
$arNewPicture["description"] = $arFields["DETAIL_PICTURE"]["description"];
$arFields["DETAIL_PICTURE"] = $arNewPicture;
} elseif ($arDef["IGNORE_ERRORS"] !== "Y") {
unset($arFields["DETAIL_PICTURE"]);
$strWarning .= GetMessage("IBLOCK_FIELD_DETAIL_PICTURE") . ": " . $arNewPicture . "<br>";
}
}
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"]) && $arDef["USE_WATERMARK_FILE"] === "Y") {
if (strlen($arFields["DETAIL_PICTURE"]["tmp_name"]) > 0 && ($arFields["DETAIL_PICTURE"]["tmp_name"] === $arFields["PREVIEW_PICTURE"]["tmp_name"] || $arFields["DETAIL_PICTURE"]["COPY_FILE"] == "Y" && !$arFields["DETAIL_PICTURE"]["copy"])) {
$tmp_name = CTempFile::GetFileName(basename($arFields["DETAIL_PICTURE"]["tmp_name"]));
CheckDirPath($tmp_name);
copy($arFields["DETAIL_PICTURE"]["tmp_name"], $tmp_name);
$arFields["DETAIL_PICTURE"]["copy"] = true;
$arFields["DETAIL_PICTURE"]["tmp_name"] = $tmp_name;
}
CIBLock::FilterPicture($arFields["DETAIL_PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_FILE_POSITION"], "type" => "file", "size" => "real", "alpha_level" => 100 - min(max($arDef["WATERMARK_FILE_ALPHA"], 0), 100), "file" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_FILE"])));
}
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"]) && $arDef["USE_WATERMARK_TEXT"] === "Y") {
if (strlen($arFields["DETAIL_PICTURE"]["tmp_name"]) > 0 && ($arFields["DETAIL_PICTURE"]["tmp_name"] === $arFields["PREVIEW_PICTURE"]["tmp_name"] || $arFields["DETAIL_PICTURE"]["COPY_FILE"] == "Y" && !$arFields["DETAIL_PICTURE"]["copy"])) {
$tmp_name = CTempFile::GetFileName(basename($arFields["DETAIL_PICTURE"]["tmp_name"]));
CheckDirPath($tmp_name);
copy($arFields["DETAIL_PICTURE"]["tmp_name"], $tmp_name);
$arFields["DETAIL_PICTURE"]["copy"] = true;
$arFields["DETAIL_PICTURE"]["tmp_name"] = $tmp_name;
}
CIBLock::FilterPicture($arFields["DETAIL_PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_TEXT_POSITION"], "type" => "text", "coefficient" => $arDef["WATERMARK_TEXT_SIZE"], "text" => $arDef["WATERMARK_TEXT"], "font" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_TEXT_FONT"]), "color" => $arDef["WATERMARK_TEXT_COLOR"]));
}
}
//.........這裏部分代碼省略.........
示例5: PublishDocument
/**
* ћетод публикует документ. “о есть делает его доступным в публичной части сайта.
*
* @param string $documentId - код документа.
*/
public function PublishDocument($documentId)
{
global $DB;
$ID = intval($documentId);
$db_element = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_HISTORY" => "Y"), false, false, array("ID", "TIMESTAMP_X", "MODIFIED_BY", "DATE_CREATE", "CREATED_BY", "IBLOCK_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "SORT", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "WF_STATUS_ID", "WF_PARENT_ELEMENT_ID", "WF_NEW", "WF_COMMENTS", "IN_SECTIONS", "CODE", "TAGS", "XML_ID", "TMP_ID"));
if ($ar_element = $db_element->Fetch()) {
$PARENT_ID = intval($ar_element["WF_PARENT_ELEMENT_ID"]);
if ($PARENT_ID) {
// TODO: ≈сли в документе $documentId поле WF_PARENT_ELEMENT_ID не NULL, то при публикации нужно перенести данные
// (скопировать документ) из документа $documentId в документ WF_PARENT_ELEMENT_ID,
$obElement = new CIBlockElement();
$ar_element["WF_PARENT_ELEMENT_ID"] = false;
if ($ar_element["PREVIEW_PICTURE"]) {
$ar_element["PREVIEW_PICTURE"] = CFile::MakeFileArray($ar_element["PREVIEW_PICTURE"]);
} else {
$ar_element["PREVIEW_PICTURE"] = array("tmp_name" => "", "del" => "Y");
}
if ($ar_element["DETAIL_PICTURE"]) {
$ar_element["DETAIL_PICTURE"] = CFile::MakeFileArray($ar_element["DETAIL_PICTURE"]);
} else {
$ar_element["DETAIL_PICTURE"] = array("tmp_name" => "", "del" => "Y");
}
$ar_element["IBLOCK_SECTION"] = array();
if ($ar_element["IN_SECTIONS"] == "Y") {
$rsSections = CIBlockElement::GetElementGroups($ar_element["ID"], true, array('ID', 'IBLOCK_ELEMENT_ID'));
while ($arSection = $rsSections->Fetch()) {
$ar_element["IBLOCK_SECTION"][] = $arSection["ID"];
}
}
$ar_element["PROPERTY_VALUES"] = array();
$arProps =& $ar_element["PROPERTY_VALUES"];
//Delete old files
$rsProps = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $PARENT_ID, array("value_id" => "asc"), array("PROPERTY_TYPE" => "F", "EMPTY" => "N"));
while ($arProp = $rsProps->Fetch()) {
if (!array_key_exists($arProp["ID"], $arProps)) {
$arProps[$arProp["ID"]] = array();
}
$arProps[$arProp["ID"]][$arProp["PROPERTY_VALUE_ID"]] = array("VALUE" => array("tmp_name" => "", "del" => "Y"), "DESCRIPTION" => false);
}
//Add new proiperty values
$rsProps = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $ar_element["ID"], array("value_id" => "asc"));
$i = 0;
while ($arProp = $rsProps->Fetch()) {
$i++;
if (!array_key_exists($arProp["ID"], $arProps)) {
$arProps[$arProp["ID"]] = array();
}
if ($arProp["PROPERTY_VALUE_ID"]) {
if ($arProp["PROPERTY_TYPE"] == "F") {
$arProps[$arProp["ID"]]["n" . $i] = array("VALUE" => CFile::MakeFileArray($arProp["VALUE"]), "DESCRIPTION" => $arProp["DESCRIPTION"]);
} else {
$arProps[$arProp["ID"]]["n" . $i] = array("VALUE" => $arProp["VALUE"], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
}
}
$obElement->Update($PARENT_ID, $ar_element);
// вызвать CBPDocument::MergeDocuments(WF_PARENT_ELEMENT_ID, $documentId) дл¤ переноса состо¤ний и истории Ѕѕ,
CBPDocument::MergeDocuments(array("lists", "BizprocDocument", $PARENT_ID), array("lists", "BizprocDocument", $documentId));
// грохнуть документ $documentId,
CIBlockElement::Delete($ID);
// опубликовать документ WF_PARENT_ELEMENT_ID
CIBlockElement::WF_CleanUpHistoryCopies($PARENT_ID, 0);
$strSql = "update b_iblock_element set WF_STATUS_ID='1', WF_NEW=NULL WHERE ID=" . $PARENT_ID . " AND WF_PARENT_ELEMENT_ID IS NULL";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
CIBlockElement::UpdateSearch($PARENT_ID);
return $PARENT_ID;
} else {
// ≈сли WF_PARENT_ELEMENT_ID равно NULL, то все как раньше.
CIBlockElement::WF_CleanUpHistoryCopies($ID, 0);
$strSql = "update b_iblock_element set WF_STATUS_ID='1', WF_NEW=NULL WHERE ID=" . $ID . " AND WF_PARENT_ELEMENT_ID IS NULL";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
CIBlockElement::UpdateSearch($ID);
return $ID;
}
}
return false;
}
示例6: isset
function _ib_elm_add($arFields, $bWorkFlow = false, $bUpdateSearch = true, $bResizePictures = false)
{
global $USER_FIELD_MANAGER;
global $APPLICATION;
$bUF = isset($arFields['USER_FIELDS']);
if ($bUF) {
$UF_ENTITY = $this->GetUfEntity();
if (!$USER_FIELD_MANAGER->CheckFields($UF_ENTITY, 0, $arFields['USER_FIELDS'])) {
if (is_object($APPLICATION) && $APPLICATION->GetException()) {
$e = $APPLICATION->GetException();
$this->LAST_ERROR .= $e->GetString();
return false;
}
}
$handlerID = AddEventHandler('search', 'BeforeIndex', array($this, 'IndexUfValues'));
}
if ($bUpdateSearch && $bUF) {
$bUpdateSearch = false;
}
$el = new CIBlockElement();
$result = $el->Add($arFields, $bWorkFlow, $bUpdateSearch, $bResizePictures);
$ID = intval($result);
if ($ID <= 0) {
$this->LAST_ERROR = $el->LAST_ERROR;
return false;
} else {
if (isset($arFields['PROPERTY_VALUES']) && !$this->ValidatePropertyValues($ID, $arFields['PROPERTY_VALUES'], $arFields['IBLOCK_ID'])) {
$this->LAST_ERROR = GetMessage("WD_FILE_ERROR111");
$el->Delete($ID);
return false;
}
if ($bUF) {
$USER_FIELD_MANAGER->Update($UF_ENTITY, $ID, $arFields['USER_FIELDS']);
$el->UpdateSearch($ID, true);
}
$this->_onEvent('Add', $ID);
}
if ($bUF) {
RemoveEventHandler('search', 'BeforeIndex', $handlerID);
}
CWebDavDiskDispatcher::sendEventToOwners(null, array('IBLOCK_ID' => (int) $arFields['IBLOCK_ID'], 'ID' => (int) $arFields['IBLOCK_SECTION_ID']), 'add');
return (int) $result;
}