本文整理汇总了PHP中CIBlockElement::updateSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::updateSearch方法的具体用法?PHP CIBlockElement::updateSearch怎么用?PHP CIBlockElement::updateSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::updateSearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 ($element = $db_element->fetch()) {
$parentId = intval($element["WF_PARENT_ELEMENT_ID"]);
if ($parentId) {
$elementObject = new CIBlockElement();
$element["WF_PARENT_ELEMENT_ID"] = false;
if ($element["PREVIEW_PICTURE"]) {
$element["PREVIEW_PICTURE"] = CFile::makeFileArray($element["PREVIEW_PICTURE"]);
} else {
$element["PREVIEW_PICTURE"] = array("tmp_name" => "", "del" => "Y");
}
if ($element["DETAIL_PICTURE"]) {
$element["DETAIL_PICTURE"] = CFile::makeFileArray($element["DETAIL_PICTURE"]);
} else {
$element["DETAIL_PICTURE"] = array("tmp_name" => "", "del" => "Y");
}
$element["IBLOCK_SECTION"] = array();
if ($element["IN_SECTIONS"] == "Y") {
$sectionsQuery = CIBlockElement::getElementGroups($element["ID"], true, array('ID', 'IBLOCK_ELEMENT_ID'));
while ($section = $sectionsQuery->fetch()) {
$element["IBLOCK_SECTION"][] = $section["ID"];
}
}
$element["PROPERTY_VALUES"] = array();
$props =& $element["PROPERTY_VALUES"];
//Delete old files
$propsQuery = CIBlockElement::getProperty($element["IBLOCK_ID"], $parentId, array("value_id" => "asc"), array("PROPERTY_TYPE" => "F", "EMPTY" => "N"));
while ($prop = $propsQuery->fetch()) {
if (!array_key_exists($prop["ID"], $props)) {
$props[$prop["ID"]] = array();
}
$props[$prop["ID"]][$prop["PROPERTY_VALUE_ID"]] = array("VALUE" => array("tmp_name" => "", "del" => "Y"), "DESCRIPTION" => false);
}
//Add new proiperty values
$propsQuery = CIBlockElement::getProperty($element["IBLOCK_ID"], $element["ID"], array("value_id" => "asc"));
$i = 0;
while ($prop = $propsQuery->fetch()) {
$i++;
if (!array_key_exists($prop["ID"], $props)) {
$props[$prop["ID"]] = array();
}
if ($prop["PROPERTY_VALUE_ID"]) {
if ($prop["PROPERTY_TYPE"] == "F") {
$props[$prop["ID"]]["n" . $i] = array("VALUE" => CFile::makeFileArray($prop["VALUE"]), "DESCRIPTION" => $prop["DESCRIPTION"]);
} else {
$props[$prop["ID"]]["n" . $i] = array("VALUE" => $prop["VALUE"], "DESCRIPTION" => $prop["DESCRIPTION"]);
}
}
}
$elementObject->update($parentId, $element);
CBPDocument::mergeDocuments(array("lists", get_called_class(), $parentId), array("lists", get_called_class(), $documentId));
CIBlockElement::delete($ID);
CIBlockElement::wF_CleanUpHistoryCopies($parentId, 0);
$strSql = "update b_iblock_element set WF_STATUS_ID='1', WF_NEW=NULL WHERE ID=" . $parentId . " AND WF_PARENT_ELEMENT_ID IS NULL";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
CIBlockElement::updateSearch($parentId);
return $parentId;
} else {
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;
}