本文整理汇总了PHP中CBPDocument::TerminateWorkflow方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::TerminateWorkflow方法的具体用法?PHP CBPDocument::TerminateWorkflow怎么用?PHP CBPDocument::TerminateWorkflow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::TerminateWorkflow方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute()
{
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
CBPDocument::TerminateWorkflow($this->GetWorkflowInstanceId(), $documentId, $arErrorsTmp);
throw new Exception("TerminateActivity");
return CBPActivityExecutionStatus::Closed;
}
示例2: isset
include($_SERVER["DOCUMENT_ROOT"].$arIBTYPE["EDIT_FILE_BEFORE"]);
}
if (
$bBizproc
&& $canWrite
&& $historyId <= 0
&& $ID > 0
&& $REQUEST_METHOD=="GET"
&& isset($_REQUEST["stop_bizproc"]) && strlen($_REQUEST["stop_bizproc"]) > 0
&& check_bitrix_sessid()
)
{
CBPDocument::TerminateWorkflow(
$_REQUEST["stop_bizproc"],
array(MODULE_ID, ENTITY, $ID),
$ar
);
if (!empty($ar))
{
$str = "";
foreach ($ar as $a)
$str .= $a["message"];
$error = new _CIBlockError(2, "STOP_BP_ERROR", $str);
}
else
{
LocalRedirect($APPLICATION->GetCurPageParam("", array("stop_bizproc", "sessid")));
}
}
示例3: array
} else {
$arResult["SECTION_ID"] = false;
}
$tab_name = $arResult["FORM_ID"] . "_active_tab";
//Assume there was no error
$bVarsFromForm = false;
//Form submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && !$arResult["IS_SOCNET_GROUP_CLOSED"] && ($arParams["CAN_EDIT"] || $ELEMENT_ID > 0 && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ELEMENT_ID, "element_delete"))) {
$obList->ActualizeDocumentAdminPage(str_replace(array("#list_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_ELEMENT_URL"]));
//When Save or Apply buttons was pressed
if (isset($_POST["action"]) && $_POST["action"] == "stop_bizproc") {
if (isset($_POST["stop_bizproc"]) && strlen($_POST["stop_bizproc"]) && $bBizproc) {
$strError = "";
if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $arResult["ELEMENT_ID"], "element_rights_edit")) {
$arErrorsTmp = array();
CBPDocument::TerminateWorkflow($_POST["stop_bizproc"], BizprocDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), $arErrorsTmp);
foreach ($arErrorsTmp as $a) {
$strError .= $a["message"] . "<br />";
}
} else {
$strError .= GetMessage("CC_BLEE_ACCESS_DENIED") . "<br />";
}
if ($strError) {
ShowError($strError);
$bVarsFromForm = true;
} else {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["ELEMENT_FIELDS"]["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: GetMessage
}
} else {
$arResult["ErrorMessage"] .= GetMessage("BPWC_WLC_MISSING_DOCUMENT") . ". ";
}
} else {
$arResult["ErrorMessage"] .= GetMessage("BPWC_WLC_MISSING_BP") . ". ";
}
if (strlen($arResult["ErrorMessage"]) <= 0) {
LocalRedirect($APPLICATION->GetCurPageParam("", array("sessid", "stop_bizproc_id", "process_state_event", "bizproc_event", "bizproc_id", "delete_bizproc_id")));
}
}
}
if ($_SERVER["REQUEST_METHOD"] == "GET" && strlen($_REQUEST["stop_bizproc_id"]) > 0 && check_bitrix_sessid() && $arResult["AllowAdmin"]) {
$arState = CBPStateService::GetWorkflowState($_REQUEST["stop_bizproc_id"]);
if (count($arState) > 0) {
CBPDocument::TerminateWorkflow($_REQUEST["stop_bizproc_id"], $arState["DOCUMENT_ID"], $arErrorsTmp);
if (count($arErrorsTmp) > 0) {
foreach ($arErrorsTmp as $e) {
$arResult["ErrorMessage"] .= $e["message"] . ". ";
}
}
} else {
$arResult["ErrorMessage"] .= GetMessage("BPWC_WLC_MISSING_BP") . ". ";
}
if (strlen($arResult["ErrorMessage"]) <= 0) {
LocalRedirect($APPLICATION->GetCurPageParam("", array("sessid", "stop_bizproc_id", "delete_bizproc_id")));
}
}
if ($_SERVER["REQUEST_METHOD"] == "GET" && strlen($_REQUEST["delete_bizproc_id"]) > 0 && check_bitrix_sessid() && $arResult["AllowAdmin"]) {
$arState = CBPStateService::GetWorkflowState($_REQUEST["delete_bizproc_id"]);
if (count($arState) > 0) {
示例5: LocalRedirect
if ($_REQUEST["AJAX_CALL"] != "Y" || !empty($_REQUEST["bxajaxid"])) {
LocalRedirect($url);
}
$APPLICATION->RestartBuffer();
echo CUtil::PhpToJSObject(array("result" => $res["LOCK_STATUS"], "status" => $status));
die;
}
/********************************************************************
/ LOCK
********************************************************************/
$CHILD_ID = false;
$this->IncludeComponentLang("action.php");
if (!check_bitrix_sessid()) {
$arError[] = array("id" => "bad_sessid", "text" => GetMessage("WD_ERROR_BAD_SESSID"));
} elseif ($ob->workflow == "bizproc" && strlen($_REQUEST["stop_bizproc"]) > 0) {
CBPDocument::TerminateWorkflow($_REQUEST["stop_bizproc"], array("webdav", $arParams["BIZPROC"]["ENTITY"], $arParams["ELEMENT_ID"]), $ar);
foreach ($ar as $a) {
$arError[] = array("id" => "bizproc", "text" => $a["message"]);
}
} elseif ($arParams["ACTION"] == "CLONE") {
global $DB;
$DB->startTransaction();
$options = array("clone" => true, "PARENT_ELEMENT_ID" => $arParams["ELEMENT_ID"], "FILE_NAME" => $arResult["ELEMENT"]["NAME"], "NAME" => !empty($_REQUEST["NAME"]) ? $_REQUEST["NAME"] : $arResult["ELEMENT"]["NAME"], "WF_STATUS_ID" => "2", "PREVIEW_TEXT" => trim($_REQUEST["PREVIEW_TEXT"]), "arFile" => $_FILES[$ob->file_prop]);
if (!$ob->put_commit($options) || $options["ELEMENT_ID"] <= 0) {
$DB->rollback();
$arError[] = array("id" => "clone_error", "text" => $ob->LAST_ERROR);
} else {
$DB->commit();
$ob->UNLOCK($tmp = array("element_id" => $arParams["ELEMENT_ID"]));
$arParams["ELEMENT_ID"] = $options["ELEMENT_ID"];
}
示例6: array
}
} else {
$arResult["SECTION_ID"] = false;
}
//Assume there was no error
$bVarsFromForm = false;
//Form submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && ($arParams["CAN_EDIT"] || $ELEMENT_ID > 0 && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ELEMENT_ID, "element_delete"))) {
$obList->ActualizeDocumentAdminPage(str_replace(array("#list_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_ELEMENT_URL"]));
//When Save or Apply buttons was pressed
if (isset($_POST["action"]) && $_POST["action"] == "stop_bizproc") {
if (isset($_POST["stop_bizproc"]) && strlen($_POST["stop_bizproc"]) && $bBizproc) {
$strError = "";
if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $arResult["ELEMENT_ID"], "element_rights_edit")) {
$arErrorsTmp = array();
CBPDocument::TerminateWorkflow($_POST["stop_bizproc"], array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), $arErrorsTmp);
foreach ($arErrorsTmp as $a) {
$strError .= $a["message"] . "<br />";
}
} else {
$strError .= GetMessage("CC_BLEE_ACCESS_DENIED") . "<br />";
}
if ($strError) {
ShowError($strError);
$bVarsFromForm = true;
} else {
$url = CHTTP::urlAddParams(str_replace(array("#list_id#", "#section_id#", "#element_id#", "#group_id#"), array($arResult["IBLOCK_ID"], intval($arResult["ELEMENT_FIELDS"]["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);
示例7: array
$arResult["ERROR_MESSAGE"] = "";
$arParams["StartWorkflowPermission"] = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $USER->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates)) ? "Y" : "N";
$arParams["StopWorkflowPermission"] = $arParams["StartWorkflowPermission"];
$arParams["DropWorkflowPermission"] = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates)) ? "Y" : "N";
/********************************************************************
Action
********************************************************************/
if (!((!empty($_REQUEST["action"]) || $_SERVER['REQUEST_METHOD'] == "POST") && check_bitrix_sessid())) {
} elseif (!empty($_POST["cancel"]) && !empty($arParams["back_url"])) {
LocalRedirect($arParams["back_url"]);
} else {
if ($_REQUEST["action"] == "stop_bizproc") {
if ($arParams["StopWorkflowPermission"] != "Y") {
$arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
} else {
CBPDocument::TerminateWorkflow($_REQUEST["id"], $arParams["DOCUMENT_ID"], $ar);
if (count($ar) > 0) {
$str = "";
foreach ($ar as $a) {
$str .= $a["message"];
}
$arError[] = array("id" => "stop_bizproc", "text" => $str);
}
}
} elseif ($_REQUEST["action"] == "del_bizproc") {
if ($arParams["DropWorkflowPermission"] != "Y") {
$arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
} else {
CBPTrackingService::DeleteByWorkflow($_REQUEST["id"]);
CBPStateService::DeleteWorkflow($_REQUEST["id"]);
}
示例8: processActionStopBizProc
public function processActionStopBizProc()
{
$this->checkRequiredPostParams(array('fileId', 'idBizProc'));
if (!Loader::includeModule("bizproc")) {
$this->errorCollection->addOne(new Error(Loc::getMessage('DISK_FILE_VIEW_BIZPROC_LOAD')));
}
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$fileId = (int) $this->request->getPost('fileId');
/** @var File $file */
$file = File::loadById($fileId);
if (!$file) {
$this->errorCollection->addOne(new Error(Loc::getMessage('DISK_FILE_VIEW_ERROR_COULD_NOT_FIND_OBJECT'), self::ERROR_COULD_NOT_FIND_OBJECT));
$this->sendJsonErrorResponse();
}
$documentData = array('DISK' => array('DOCUMENT_ID' => \Bitrix\Disk\BizProcDocument::getDocumentComplexId($fileId)), 'WEBDAV' => array('DOCUMENT_ID' => \Bitrix\Disk\BizProcDocumentCompatible::getDocumentComplexId($fileId)));
$webdavFileId = $file->getXmlId();
if (!empty($webdavFileId)) {
$documentData['OLD_FILE_COMMON'] = array('DOCUMENT_ID' => array('webdav', 'CIBlockDocumentWebdav', $webdavFileId));
$documentData['OLD_FILE_GROUP'] = array('DOCUMENT_ID' => array('webdav', 'CIBlockDocumentWebdavSocnet', $webdavFileId));
}
$workflowId = $this->request->getPost('idBizProc');
$error = array();
foreach ($documentData as $nameModule => $data) {
$availabilityProcess = CBPDocument::GetDocumentState($data['DOCUMENT_ID'], $workflowId);
if (!empty($availabilityProcess)) {
if (CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getId(), $data['DOCUMENT_ID'])) {
CBPDocument::TerminateWorkflow($workflowId, $data['DOCUMENT_ID'], $error);
}
}
}
if ($error) {
$this->errorCollection->addOne(new Error(array_shift($error)));
$this->sendJsonErrorResponse();
}
$this->sendJsonSuccessResponse();
}
示例9: showBizProc
protected function showBizProc($documentData)
{
$this->arResult['BIZPROC_PERMISSION'] = array();
$this->arResult['BIZPROC_PERMISSION']['START'] = CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID']);
$this->arResult['BIZPROC_PERMISSION']['VIEW'] = CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID']);
$this->arResult['BIZPROC_PERMISSION']['STOP'] = $this->arResult['BIZPROC_PERMISSION']['START'];
$this->arResult['BIZPROC_PERMISSION']['DROP'] = CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID']);
foreach ($documentData as $nameModuleId => $data) {
$temporary[$nameModuleId] = CBPDocument::getDocumentStates($data['DOCUMENT_TYPE'], $data['DOCUMENT_ID']);
}
if (isset($temporary['OLD_FILE'])) {
$allBizProcArray = array_merge($temporary['DISK'], $temporary['WEBDAV'], $temporary['OLD_FILE']);
} else {
$allBizProcArray = array_merge($temporary['DISK'], $temporary['WEBDAV']);
}
if (!empty($allBizProcArray)) {
$userGroup = $this->getUser()->getUserGroupArray();
$userGroup[] = 'author';
if ($this->request->isPost() && intval($this->request->getPost('bizproc_index')) > 0) {
$bizProcWorkflowId = array();
$bizprocIndex = intval($this->request->getPost('bizproc_index'));
for ($i = 1; $i <= $bizprocIndex; $i++) {
$bpId = trim($this->request->getPost("bizproc_id_" . $i));
$bpTemplateId = intval($this->request->getPost("bizproc_template_id_" . $i));
$bpEvent = trim($this->request->getPost("bizproc_event_" . $i));
if (strlen($bpId) > 0) {
if (!array_key_exists($bpId, $allBizProcArray)) {
continue;
}
} else {
if (!array_key_exists($bpTemplateId, $allBizProcArray)) {
continue;
}
$bpId = $bizProcWorkflowId[$bpTemplateId];
}
if (strlen($bpEvent) > 0) {
$errors = array();
CBPDocument::sendExternalEvent($bpId, $bpEvent, array("Groups" => $userGroup, "User" => $this->getUser()->getId()), $errors);
} else {
$errors = array();
foreach ($allBizProcArray as $idBizProc => $bizProcArray) {
if ($idBizProc == $bpId) {
CBPDocument::TerminateWorkflow($bpId, $bizProcArray['DOCUMENT_ID'], $errors);
}
}
}
if (!empty($errors)) {
foreach ($errors as $error) {
$this->arResult['ERROR_MESSAGE'] = $error['message'];
}
} else {
LocalRedirect($this->arResult['PATH_TO_FILE_VIEW'] . "#tab-bp");
}
}
}
$this->arResult['BIZPROC_LIST'] = array();
$count = 1;
foreach ($allBizProcArray as $idBizProc => $bizProcArray) {
if (intVal($bizProcArray["WORKFLOW_STATUS"]) < 0 || $idBizProc <= 0) {
continue;
} else {
if (!CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID'], array("DocumentStates" => $bizProcArray, "WorkflowId" => $bizProcArray["ID"] > 0 ? $bizProcArray["ID"] : $bizProcArray["TEMPLATE_ID"]))) {
continue;
}
}
$groups = CBPDocument::getAllowableUserGroups($documentData['DISK']['DOCUMENT_TYPE']);
foreach ($groups as $key => $val) {
$groups[strtolower($key)] = $val;
}
$users = array();
$dmpWorkflow = CBPTrackingService::getList(array("ID" => "DESC"), array("WORKFLOW_ID" => $idBizProc, "TYPE" => array(CBPTrackingType::Report, CBPTrackingType::Custom, CBPTrackingType::FaultActivity)), false, array("nTopCount" => 5), array("ID", "TYPE", "MODIFIED", "ACTION_NOTE", "ACTION_TITLE", "ACTION_NAME", "EXECUTION_STATUS", "EXECUTION_RESULT"));
while ($track = $dmpWorkflow->getNext()) {
$messageTemplate = "";
switch ($track["TYPE"]) {
case 1:
$messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_1");
break;
case 2:
$messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_2");
break;
case 3:
$messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_3");
break;
case 4:
$messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_4");
break;
case 5:
$messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_5");
break;
default:
$messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_6");
}
$name = strlen($track["ACTION_TITLE"]) > 0 ? $track["ACTION_TITLE"] : $track["ACTION_NAME"];
switch ($track["EXECUTION_STATUS"]) {
case CBPActivityExecutionStatus::Initialized:
$status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_1");
break;
case CBPActivityExecutionStatus::Executing:
$status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_2");
break;
//.........这里部分代码省略.........