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