本文整理匯總了PHP中CIBlockElement::WF_SetMove方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIBlockElement::WF_SetMove方法的具體用法?PHP CIBlockElement::WF_SetMove怎麽用?PHP CIBlockElement::WF_SetMove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::WF_SetMove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Update
//.........這裏部分代碼省略.........
}
if (array_key_exists("DETAIL_PICTURE", $arFields)) {
if (is_array($arFields["DETAIL_PICTURE"])) {
if (strlen($arFields["DETAIL_PICTURE"]["name"]) <= 0 && strlen($arFields["DETAIL_PICTURE"]["del"]) <= 0) {
if (array_key_exists("description", $arFields["DETAIL_PICTURE"])) {
$arFile = CFile::GetFileArray($ar_wf_element["DETAIL_PICTURE"]);
if ($arFields["DETAIL_PICTURE"]["description"] != $arFile["DESCRIPTION"]) {
//Description updated, so it's new file
$arNewFile = CFile::MakeFileArray($ar_wf_element["DETAIL_PICTURE"]);
$arNewFile["description"] = $arFields["DETAIL_PICTURE"]["description"];
$arNewFile["MODULE_ID"] = "iblock";
$arFields["DETAIL_PICTURE"] = $arNewFile;
} else {
$arFields["DETAIL_PICTURE"] = $ar_wf_element["DETAIL_PICTURE"];
}
} else {
//File was not changed at all
$arFields["DETAIL_PICTURE"] = $ar_wf_element["DETAIL_PICTURE"];
}
} else {
unset($arFields["DETAIL_PICTURE"]["old_file"]);
}
}
} else {
$arFields["DETAIL_PICTURE"] = $ar_wf_element["DETAIL_PICTURE"];
}
$NID = $this->Add($arFields);
if ($NID > 0) {
if ($arFields["WF_STATUS_ID"] == 1) {
$DB->Query("UPDATE b_iblock_element SET TIMESTAMP_X=TIMESTAMP_X, WF_NEW=null WHERE ID=" . $ID);
$DB->Query("UPDATE b_iblock_element SET TIMESTAMP_X=TIMESTAMP_X, WF_NEW=null WHERE WF_PARENT_ELEMENT_ID=" . $ID);
$ar_wf_element["WF_NEW"] = false;
}
if ($this->bWF_SetMove) {
CIBlockElement::WF_SetMove($NID, $LAST_ID);
}
if ($ar_element["WF_STATUS_ID"] != 1 && $ar_wf_element["WF_STATUS_ID"] != $arFields["WF_STATUS_ID"] && $arFields["WF_STATUS_ID"] != 1) {
$DB->Query("UPDATE b_iblock_element SET TIMESTAMP_X=TIMESTAMP_X, WF_STATUS_ID=" . $arFields["WF_STATUS_ID"] . " WHERE ID=" . $ID);
}
}
//element was not published, so keep original
if (is_set($arFields, "WF_STATUS_ID") && $arFields["WF_STATUS_ID"] != 1 && $ar_element["WF_STATUS_ID"] == 1 || !is_set($arFields, "WF_STATUS_ID") && $ar_wf_element["WF_STATUS_ID"] != 1) {
CIBlockElement::WF_CleanUpHistoryCopies($ID);
return true;
}
$arFields['WF_PARENT_ELEMENT_ID'] = false;
$rs = $DB->Query("SELECT PREVIEW_PICTURE, DETAIL_PICTURE from b_iblock_element WHERE ID = " . $NID);
$ar_new_element = $rs->Fetch();
} else {
$ar_new_element = false;
}
if ($ar_new_element) {
if (!intval($ar_new_element["PREVIEW_PICTURE"])) {
$arFields["PREVIEW_PICTURE"] = false;
} else {
$arFields["PREVIEW_PICTURE"] = $ar_new_element["PREVIEW_PICTURE"];
}
if (!intval($ar_new_element["DETAIL_PICTURE"])) {
$arFields["DETAIL_PICTURE"] = false;
} else {
$arFields["DETAIL_PICTURE"] = $ar_new_element["DETAIL_PICTURE"];
}
if (is_array($arFields["PROPERTY_VALUES"]) && count($arFields["PROPERTY_VALUES"]) > 0) {
$i = 0;
$db_prop = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arFields["IBLOCK_ID"], "CHECK_PERMISSIONS" => "N", "PROPERTY_TYPE" => "F"));
while ($arProp = $db_prop->Fetch()) {
示例2: Add
//.........這裏部分代碼省略.........
}
$IBLOCK_SECTION_ID = $arFields["IBLOCK_SECTION_ID"];
unset($arFields["IBLOCK_SECTION_ID"]);
$ID = $DB->Add("b_iblock_element", $arFields, array("DETAIL_TEXT", "SEARCHABLE_CONTENT"), "iblock");
if (array_key_exists("PREVIEW_PICTURE", $arFields)) {
$arFields["PREVIEW_PICTURE_ID"] = $arFields["PREVIEW_PICTURE"];
$arFields["PREVIEW_PICTURE"] = $SAVED_PREVIEW_PICTURE;
}
if (array_key_exists("DETAIL_PICTURE", $arFields)) {
$arFields["DETAIL_PICTURE_ID"] = $arFields["DETAIL_PICTURE"];
$arFields["DETAIL_PICTURE"] = $SAVED_DETAIL_PICTURE;
}
if (CIBlockElement::GetIBVersion($arFields["IBLOCK_ID"]) == 2) {
$DB->Query("INSERT INTO b_iblock_element_prop_s" . $arFields["IBLOCK_ID"] . "(IBLOCK_ELEMENT_ID)VALUES(" . $ID . ")");
}
if (!isset($arFields["XML_ID"]) || strlen($arFields["XML_ID"]) <= 0) {
$arFields["XML_ID"] = $ID;
$DB->Query("UPDATE b_iblock_element SET XML_ID = " . $ID . " WHERE ID = " . $ID);
}
if (is_set($arFields, "PROPERTY_VALUES")) {
CIBlockElement::SetPropertyValues($ID, $arFields["IBLOCK_ID"], $arFields["PROPERTY_VALUES"]);
}
if (is_set($arFields, "IBLOCK_SECTION")) {
CIBlockElement::SetElementSection($ID, $arFields["IBLOCK_SECTION"], true, $arIBlock["RIGHTS_MODE"] === "E" ? $arIBlock["ID"] : 0, $IBLOCK_SECTION_ID);
}
if ($arIBlock["RIGHTS_MODE"] === "E") {
$obElementRights = new CIBlockElementRights($arIBlock["ID"], $ID);
if (!is_set($arFields, "IBLOCK_SECTION") || empty($arFields["IBLOCK_SECTION"])) {
$obElementRights->ChangeParents(array(), array(0));
}
if (array_key_exists("RIGHTS", $arFields) && is_array($arFields["RIGHTS"])) {
$obElementRights->SetRights($arFields["RIGHTS"]);
}
}
if (array_key_exists("IPROPERTY_TEMPLATES", $arFields)) {
$ipropTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($arIBlock["ID"], $ID);
$ipropTemplates->set($arFields["IPROPERTY_TEMPLATES"]);
}
if ($bUpdateSearch) {
CIBlockElement::UpdateSearch($ID);
}
\Bitrix\Iblock\PropertyIndex\Manager::updateElementIndex($arIBlock["ID"], $ID);
if (!isset($arFields["WF_PARENT_ELEMENT_ID"]) && $arIBlock["FIELDS"]["LOG_ELEMENT_ADD"]["IS_REQUIRED"] == "Y") {
$USER_ID = is_object($USER) ? intval($USER->GetID()) : 0;
$arEvents = GetModuleEvents("main", "OnBeforeEventLog", true);
if (empty($arEvents) || ExecuteModuleEventEx($arEvents[0], array($USER_ID)) === false) {
$rsElement = CIBlockElement::GetList(array(), array("=ID" => $ID), false, false, array("LIST_PAGE_URL", "NAME", "CODE"));
$arElement = $rsElement->GetNext();
$res = array("ID" => $ID, "CODE" => $arElement["CODE"], "NAME" => $arElement["NAME"], "ELEMENT_NAME" => $arIBlock["ELEMENT_NAME"], "USER_ID" => $USER_ID, "IBLOCK_PAGE_URL" => $arElement["LIST_PAGE_URL"]);
CEventLog::Log("IBLOCK", "IBLOCK_ELEMENT_ADD", "iblock", $arIBlock["ID"], serialize($res));
}
}
if ($bWorkFlow && intval($arFields["WF_PARENT_ELEMENT_ID"]) <= 0) {
// It is completly new element - so make it copy
unset($arFields["WF_NEW"]);
$arFields["WF_PARENT_ELEMENT_ID"] = $ID;
$arNewFields = $arFields;
$arNewFields["PREVIEW_PICTURE"] = $COPY_PREVIEW_PICTURE;
$arNewFields["DETAIL_PICTURE"] = $COPY_DETAIL_PICTURE;
if (is_array($arNewFields["PROPERTY_VALUES"])) {
$i = 0;
$db_prop = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arFields["IBLOCK_ID"], "CHECK_PERMISSIONS" => "N", "PROPERTY_TYPE" => "F"));
while ($arProp = $db_prop->Fetch()) {
$i++;
unset($arNewFields["PROPERTY_VALUES"][$arProp["CODE"]]);
unset($arNewFields["PROPERTY_VALUES"][$arProp["ID"]]);
$arNewFields["PROPERTY_VALUES"][$arProp["ID"]] = array();
}
if ($i > 0) {
$props = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $ID, "sort", "asc", array("PROPERTY_TYPE" => "F", "EMPTY" => "N"));
while ($arProp = $props->Fetch()) {
$arNewFields["PROPERTY_VALUES"][$arProp["ID"]][$arProp['PROPERTY_VALUE_ID']] = array("VALUE" => $arProp["VALUE"], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
}
}
$WF_ID = $this->Add($arNewFields);
if ($this->bWF_SetMove) {
CIBlockElement::WF_SetMove($WF_ID);
}
}
$Result = $ID;
$arFields["ID"] =& $ID;
$_SESSION["SESS_RECOUNT_DB"] = "Y";
self::$elementIblock[$ID] = $arIBlock['ID'];
}
if (isset($arFields["PREVIEW_PICTURE"]) && is_array($arFields["PREVIEW_PICTURE"]) && isset($arFields["PREVIEW_PICTURE"]["COPY_FILE"]) && $arFields["PREVIEW_PICTURE"]["COPY_FILE"] == "Y" && $arFields["PREVIEW_PICTURE"]["copy"]) {
@unlink($arFields["PREVIEW_PICTURE"]["tmp_name"]);
@rmdir(dirname($arFields["PREVIEW_PICTURE"]["tmp_name"]));
}
if (isset($arFields["DETAIL_PICTURE"]) && is_array($arFields["DETAIL_PICTURE"]) && isset($arFields["DETAIL_PICTURE"]["COPY_FILE"]) && $arFields["DETAIL_PICTURE"]["COPY_FILE"] == "Y" && $arFields["DETAIL_PICTURE"]["copy"]) {
@unlink($arFields["DETAIL_PICTURE"]["tmp_name"]);
@rmdir(dirname($arFields["DETAIL_PICTURE"]["tmp_name"]));
}
$arFields["RESULT"] =& $Result;
foreach (GetModuleEvents("iblock", "OnAfterIBlockElementAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
CIBlock::clearIblockTagCache($arIBlock['ID']);
return $Result;
}