本文整理汇总了PHP中CIBlockElement::update方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::update方法的具体用法?PHP CIBlockElement::update怎么用?PHP CIBlockElement::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
function update($newsID, $data)
{
global $USER;
$el = new CIBlockElement();
$arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_SUB_STOCK_ID, "ACTIVE_TO" => date("d.m.Y", strtotime($data['ACTIVE_TO'])), "ACTIVE_FROM" => date("d.m.Y", strtotime($data['ACTIVE_FROM'])), "NAME" => trim(strip_tags($data['NAME'])), "PREVIEW_TEXT" => trim($data['PREVIEW_TEXT']));
return $el->update($newsID, $arLoadProductArray);
}
示例2: update
function update($newsID, $data)
{
global $USER;
$el = new CIBlockElement();
$arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_SUB_NEWS_ID, "DATE_ACTIVE_FROM" => $data['ACTIVE_FROM'], "NAME" => trim(strip_tags($data['NAME'])), "DETAIL_TEXT" => trim($data['DETAIL_TEXT']));
return $el->update($newsID, $arLoadProductArray);
}
示例3: 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;
}
示例4: uniqualizeElement
protected function uniqualizeElement(array &$droppedElement, $targetSectionId)
{
$mainPartName = $droppedElement['NAME'];
$newName = $mainPartName;
$countNonUnique = 0;
while (!$this->isUniqueName($newName, $droppedElement['IBLOCK_ID'], $targetSectionId)) {
$this->abortIfNeeded();
$countNonUnique++;
$newName = strstr($mainPartName, '.', true) . " ({$countNonUnique})" . strstr($mainPartName, '.');
}
if ($countNonUnique) {
$droppedElement['NAME'] = $newName;
$updateElement = new CIBlockElement();
$updateElement->update($droppedElement['ID'], array('NAME' => $droppedElement['NAME']));
}
return;
}
示例5: published
function published($eventID)
{
global $USER;
$el = new CIBlockElement();
$arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_SUB_EVENT_ID, "ACTIVE" => "Y");
CIBlockElement::SetPropertyValueCode($eventID, "PUBLIC", array('VALUE' => PROP_EVENT_PUBLIC));
return $el->update($eventID, $arLoadProductArray);
}