本文整理汇总了PHP中CBPDocument::AddDocumentToHistory方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::AddDocumentToHistory方法的具体用法?PHP CBPDocument::AddDocumentToHistory怎么用?PHP CBPDocument::AddDocumentToHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::AddDocumentToHistory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processActionCheckDataElementCreation
//.........这里部分代码省略.........
$props[$field["ID"]][$fileId]["del"] = "Y";
}
}
}
} elseif ($field["PROPERTY_TYPE"] == "N") {
if (is_array($_POST[$fieldId]) && !array_key_exists("VALUE", $_POST[$fieldId])) {
$props[$field["ID"]] = array();
foreach ($_POST[$fieldId] as $key => $value) {
if (is_array($value)) {
if (strlen($value["VALUE"])) {
$value = str_replace(" ", "", str_replace(",", ".", $value["VALUE"]));
if (!is_numeric($value)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
$this->sendJsonErrorResponse();
}
$props[$field["ID"]][$key] = doubleval($value);
}
} else {
if (strlen($value)) {
$value = str_replace(" ", "", str_replace(",", ".", $value));
if (!is_numeric($value)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
$this->sendJsonErrorResponse();
}
$props[$field["ID"]][$key] = doubleval($value);
}
}
}
} else {
if (is_array($_POST[$fieldId])) {
if (strlen($_POST[$fieldId]["VALUE"])) {
$value = str_replace(" ", "", str_replace(",", ".", $_POST[$fieldId]["VALUE"]));
if (!is_numeric($value)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
$this->sendJsonErrorResponse();
}
$props[$field["ID"]] = doubleval($value);
}
} else {
if (strlen($_POST[$fieldId])) {
$value = str_replace(" ", "", str_replace(",", ".", $_POST[$fieldId]));
if (!is_numeric($value)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
$this->sendJsonErrorResponse();
}
$props[$field["ID"]] = doubleval($value);
}
}
}
} else {
$props[$field["ID"]] = $_POST[$fieldId];
}
}
$elementData["MODIFIED_BY"] = $this->getUser()->getID();
unset($elementData["TIMESTAMP_X"]);
if (!empty($props)) {
$elementData["PROPERTY_VALUES"] = $props;
}
$documentStates = CBPDocument::GetDocumentStates($documentType, null);
$userId = $this->getUser()->getId();
$write = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $userId, $documentType, array('AllUserGroups' => array(), 'DocumentStates' => $documentStates));
if (!$write) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_ACCESS_DENIED_STATUS'))));
$this->sendJsonErrorResponse();
}
$bizprocParametersValues = array();
foreach ($documentStates as $documentState) {
if (strlen($documentState["ID"]) <= 0) {
$errors = array();
$bizprocParametersValues[$documentState['TEMPLATE_ID']] = CBPDocument::StartWorkflowParametersValidate($documentState['TEMPLATE_ID'], $documentState['TEMPLATE_PARAMETERS'], $documentType, $errors);
$stringError = '';
foreach ($errors as $e) {
$stringError .= $e['message'] . '<br />';
}
}
}
if (!empty($stringError)) {
$this->errorCollection->add(array(new Error($stringError)));
$this->sendJsonErrorResponse();
}
$objectElement = new CIBlockElement();
$idElement = $objectElement->Add($elementData, false, true, true);
if ($idElement) {
$bizProcWorkflowId = array();
foreach ($documentStates as $documentState) {
if (strlen($documentState["ID"]) <= 0) {
$errorsTmp = array();
$bizProcWorkflowId[$documentState['TEMPLATE_ID']] = CBPDocument::StartWorkflow($documentState['TEMPLATE_ID'], array('lists', 'BizprocDocument', $idElement), array_merge($bizprocParametersValues[$documentState['TEMPLATE_ID']], array('TargetUser' => 'user_' . intval($this->getUser()->getID()))), $errorsTmp);
}
}
if (!empty($errorsTmp)) {
$documentStates = null;
CBPDocument::AddDocumentToHistory(array('lists', 'BizprocDocument', $idElement), $elementData['NAME'], $this->getUser()->getID());
}
} else {
$this->errorCollection->add(array(new Error($objectElement->LAST_ERROR)));
$this->sendJsonErrorResponse();
}
$this->sendJsonSuccessResponse(array());
}
示例2:
$bpEvent,
array("Groups" => $arCurrentUserGroups, "User" => $USER->GetID()),
$arErrorTmp
);
if (!empty($arErrorsTmp))
{
foreach ($arErrorsTmp as $e)
$strWarning .= $e["message"]."<br />";
}
}
}
}
$arDocumentStates = null;
CBPDocument::AddDocumentToHistory(array(MODULE_ID, ENTITY, $ID), $BP_HISTORY_NAME, $GLOBALS["USER"]->GetID());
}
}
}
if($strWarning == '')
{
if(!$customTabber->Action())
{
if ($ex = $APPLICATION->GetException())
$strWarning .= $ex->GetString();
else
$strWarning .= "Error. ";
}
}
示例3: array
} else {
if (!array_key_exists($bpTemplateId, $arDocumentStates)) {
continue;
}
$bpId = $arBizProcWorkflowId[$bpTemplateId];
}
$arErrorTmp = array();
CBPDocument::SendExternalEvent($bpId, $bpEvent, array("Groups" => $arCurrentUserGroups, "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
foreach ($arErrorsTmp as $e) {
$strWarning .= $e["message"] . "<br />";
}
}
}
}
$arDocumentStates = null;
CBPDocument::AddDocumentToHistory(BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), $arElement["NAME"], $GLOBALS["USER"]->GetID());
}
}
if (!$strError) {
//Successfull update
//And go to proper page
if (isset($_POST["save"])) {
LocalRedirect($arResult["~LIST_SECTION_URL"]);
} elseif ($lists_perm < CListPermissions::CAN_READ && !CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_read")) {
LocalRedirect($arResult["~LIST_SECTION_URL"]);
} else {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($_POST["IBLOCK_SECTION_ID"]), $arResult["ELEMENT_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_ELEMENT_URL"]), array($tab_name => $_POST[$tab_name]), array("skip_empty" => true, "encode" => true));
if (isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0) {
$url = CHTTP::urlAddParams($url, array("list_section_id" => ""));
}
LocalRedirect($url);
示例4: array
}
if ($bBizproc && count($arResult["ERRORS"]) == 0) {
$arBizProcWorkflowId = array();
foreach ($arDocumentStates as $arDocumentState) {
if (strlen($arDocumentState["ID"]) <= 0) {
$arErrorsTmp = array();
$arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow($arDocumentState["TEMPLATE_ID"], array("iblock", "CIBlockDocument", $arParams["ID"]), $arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], $arErrorsTmp);
foreach ($arErrorsTmp as $e) {
$arResult["ERRORS"][] = $e["message"];
}
}
}
}
if ($bBizproc && count($arResult["ERRORS"]) == 0) {
$arDocumentStates = null;
CBPDocument::AddDocumentToHistory(array("iblock", "CIBlockDocument", $arParams["ID"]), $arUpdateValues["NAME"], $USER->GetID());
}
// redirect to element edit form or to elements list
if (count($arResult["ERRORS"]) == 0) {
if (!empty($_REQUEST["iblock_submit_c"])) {
if (strlen($arParams["LIST_URL"]) > 0) {
$sRedirectUrl = $arParams["LIST_URL"];
} else {
if (strlen($SEF_URL) > 0) {
$SEF_URL = str_replace("edit=Y", "", $SEF_URL);
$SEF_URL = str_replace("?&", "?", $SEF_URL);
$SEF_URL = str_replace("&&", "&", $SEF_URL);
$sRedirectUrl = $SEF_URL;
} else {
$sRedirectUrl = $APPLICATION->GetCurPageParam("", array("edit", "CODE"), $get_index_page = false);
}
示例5: array
case "delete":
if ($arParams["MODULE_ID"] == "webdav") {
if (CBPDocument::CanUserOperateDocument(CBPWebDavCanUserOperateOperation::DeleteDocument, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("UserGroups" => $GLOBALS["USER"]->GetUserGroupArray()))) {
CBPHistoryService::Delete($ID, $arParams["DOCUMENT_ID"]);
} else {
$arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
}
} else {
CBPHistoryService::Delete($ID, $arParams["DOCUMENT_ID"]);
}
break;
case "recover":
if ($arParams["MODULE_ID"] == "webdav" && isset($arParams["OBJECT"])) {
$arParams['OBJECT']->IsDir(array('element_id' => $arParams["DOCUMENT_ID"][2]));
if (($arParams["OBJECT"]->workflow == 'bizproc' || $arParams["OBJECT"]->workflow == 'bizproc_limited') && $arParams['OBJECT']->arParams['not_found'] == false) {
CBPDocument::AddDocumentToHistory($arParams['DOCUMENT_ID'], $arParams['OBJECT']->arParams["element_name"], $GLOBALS["USER"]->GetID());
if (method_exists('CIBlockDocumentWebdav', 'TruncateHistory')) {
CIBlockDocumentWebdav::TruncateHistory($arParams['OBJECT']->wfParams['DOCUMENT_TYPE'], $arParams["DOCUMENT_ID"][2]);
}
}
}
try {
if (!CBPHistoryService::RecoverDocumentFromHistory($ID)) {
$arError[] = array("id" => "not recover", "text" => GetMessage("BPADH_RECOVERY_ERROR"));
}
} catch (Exception $e) {
$arError[] = array("id" => "not recover", "text" => $e->getMessage());
}
break;
}
if (!empty($arError)) {
示例6: CloneElement
/**
* Метод клонирует документ.
*
* @param string $documentId - ID документа.
* @param string $arFields - поля для замены.
*/
public function CloneElement($ID, $arFields = array(), $arParams = array())
{
global $DB;
$ID = intval($ID);
$CHILD_ID = parent::CloneElement($ID, $arFields);
if ($CHILD_ID > 0) {
$db_res = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("IBLOCK_ID", "ID", "NAME"));
$arParent = $db_res->Fetch();
CBPDocument::AddDocumentToHistory(array("webdav", "CIBlockDocumentWebdavSocnet", $CHILD_ID), str_replace(array("#ID#", "#NAME#", "#PARENT_ID#", "#PARENT_NAME#"), array($CHILD_ID, $arFields["NAME"], $ID, $arParent["NAME"]), GetMessage("IBD_TEXT_002")), $GLOBALS["USER"]->GetID());
}
return $CHILD_ID;
}
示例7: AddDocumentToHistory
function AddDocumentToHistory($docID, $fileName)
{
global $USER;
$documentId = $this->wfParams["DOCUMENT_TYPE"];
$documentId[2] = $docID;
$userID = $USER->GetID();
$rDoc = CIBlockElement::GetList(array(), array('ID' => $docID), false, false, array('MODIFIED_BY'));
if ($rDoc && ($arDoc = $rDoc->Fetch())) {
$userID = $arDoc['MODIFIED_BY'];
}
$historyDoc = CWebdavDocumentHistory::IsHistoryUpdate($documentId);
$historyIndex = false;
if ($historyDoc) {
$historyIndex = CWebdavDocumentHistory::UpdateDocumentHistory($documentId, $historyDoc['ID']);
} else {
$historyIndex = CBPDocument::AddDocumentToHistory($documentId, $fileName, $userID);
}
return $historyIndex;
}
示例8: array
} else {
if (!array_key_exists($bpTemplateId, $arDocumentStates)) {
continue;
}
$bpId = $arBizProcWorkflowId[$bpTemplateId];
}
$arErrorTmp = array();
CBPDocument::SendExternalEvent($bpId, $bpEvent, array("Groups" => $arCurrentUserGroups, "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
foreach ($arErrorsTmp as $e) {
$strWarning .= $e["message"] . "<br />";
}
}
}
}
$arDocumentStates = null;
CBPDocument::AddDocumentToHistory(array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), $arElement["NAME"], $GLOBALS["USER"]->GetID());
}
}
if (!$strError) {
//Successfull update
$tab_name = $arResult["FORM_ID"] . "_active_tab";
//And go to proper page
if (isset($_POST["save"])) {
LocalRedirect($arResult["~LIST_SECTION_URL"]);
} elseif ($lists_perm < CListPermissions::CAN_READ && !CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_read")) {
LocalRedirect($arResult["~LIST_SECTION_URL"]);
} else {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($_POST["IBLOCK_SECTION_ID"]), $arResult["ELEMENT_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_ELEMENT_URL"]), array($tab_name => $_POST[$tab_name]), array("skip_empty" => true, "encode" => true));
if (isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0) {
$url = CHTTP::urlAddParams($url, array("list_section_id" => ""));
}