當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CBPDocument::getAllowableUserGroups方法代碼示例

本文整理匯總了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;
//.........這裏部分代碼省略.........
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:101,代碼來源:class.php


注:本文中的CBPDocument::getAllowableUserGroups方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。