本文整理汇总了PHP中CBPDocument::terminateWorkflow方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::terminateWorkflow方法的具体用法?PHP CBPDocument::terminateWorkflow怎么用?PHP CBPDocument::terminateWorkflow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::terminateWorkflow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: terminateWorkflow
protected function terminateWorkflow($workflowId, $elementId)
{
$this->checkPermission();
if (!CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser(), BizProcDocument::getDocumentComplexId($this->iblockTypeId, $elementId), array("DocumentStates" => $this->documentStates))) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_ACCESS_DENIED'))));
}
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
if (CIBlockElementRights::userHasRightTo($this->iblockId, $elementId, "element_rights_edit")) {
$errors = array();
CBPDocument::terminateWorkflow($workflowId, BizProcDocument::getDocumentComplexId($this->iblockTypeId, $elementId), $errors);
foreach ($errors as $error) {
$this->errorCollection->add(array(new Error($error["message"])));
}
} else {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_ACCESS_DENIED'))));
}
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
}
示例2: completeWorkflow
/**
* @param string $workflowId
* @param string $iblockType
* @param int $elementId
* @param int $iblockId
* @param string $action Action stop or delete
* @return string error
*/
public static function completeWorkflow($workflowId, $iblockType, $elementId, $iblockId, $action)
{
if (!Loader::includeModule('bizproc')) {
return Loc::getMessage('LISTS_MODULE_BIZPROC_NOT_INSTALLED');
}
global $USER;
$userId = $USER->getID();
$documentType = BizprocDocument::generateDocumentComplexType($iblockType, $iblockId);
$documentId = BizprocDocument::getDocumentComplexId($iblockType, $elementId);
$documentStates = CBPDocument::getDocumentStates($documentType, $documentId);
$permission = CBPDocument::canUserOperateDocument($action == 'stop' ? CBPCanUserOperateOperation::StartWorkflow : CBPCanUserOperateOperation::CreateWorkflow, $userId, $documentId, array("DocumentStates" => $documentStates));
if (!$permission) {
return Loc::getMessage('LISTS_ACCESS_DENIED');
}
$stringError = '';
if ($action == 'stop') {
$errors = array();
CBPDocument::terminateWorkflow($workflowId, $documentId, $errors);
if (!empty($errors)) {
$stringError = '';
foreach ($errors as $error) {
$stringError .= $error['message'];
}
$listError[] = array('id' => 'stopBizproc', 'text' => $stringError);
}
} else {
$errors = array();
if (isset($documentStates[$workflowId]['WORKFLOW_STATUS']) && $documentStates[$workflowId]['WORKFLOW_STATUS'] !== null) {
CBPDocument::terminateWorkflow($workflowId, $documentId, $errors);
}
if (!empty($errors)) {
$stringError = '';
foreach ($errors as $error) {
$stringError .= $error['message'];
}
$listError[] = array('id' => 'stopBizproc', 'text' => $stringError);
} else {
CBPTaskService::deleteByWorkflow($workflowId);
CBPTrackingService::deleteByWorkflow($workflowId);
CBPStateService::deleteWorkflow($workflowId);
}
}
if (empty($listError) && Loader::includeModule('socialnetwork') && $iblockType == COption::getOptionString("lists", "livefeed_iblock_type_id")) {
$sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
$resultQuery = CSocNetLog::getList(array(), array('EVENT_ID' => 'lists_new_element', 'SOURCE_ID' => $sourceId), false, false, array('ID'));
while ($log = $resultQuery->fetch()) {
CSocNetLog::delete($log['ID']);
}
}
if (!empty($listError)) {
$errorObject = new CAdminException($listError);
$stringError = $errorObject->getString();
}
return $stringError;
}