本文整理汇总了PHP中CBPDocument::GetDocumentState方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::GetDocumentState方法的具体用法?PHP CBPDocument::GetDocumentState怎么用?PHP CBPDocument::GetDocumentState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPDocument
的用法示例。
在下文中一共展示了CBPDocument::GetDocumentState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}