当前位置: 首页>>代码示例>>PHP>>正文


PHP CBPDocument::getAllowableEvents方法代码示例

本文整理汇总了PHP中CBPDocument::getAllowableEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::getAllowableEvents方法的具体用法?PHP CBPDocument::getAllowableEvents怎么用?PHP CBPDocument::getAllowableEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPDocument的用法示例。


在下文中一共展示了CBPDocument::getAllowableEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showBizProc


//.........这里部分代码省略.........
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_3");
                         break;
                     case CBPActivityExecutionStatus::Closed:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_4");
                         break;
                     case CBPActivityExecutionStatus::Faulting:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_5");
                         break;
                     default:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_6");
                 }
                 switch ($track["EXECUTION_RESULT"]) {
                     case CBPActivityExecutionResult::None:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_1");
                         break;
                     case CBPActivityExecutionResult::Succeeded:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_2");
                         break;
                     case CBPActivityExecutionResult::Canceled:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_3");
                         break;
                     case CBPActivityExecutionResult::Faulted:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_4");
                         break;
                     case CBPActivityExecutionResult::Uninitialized:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_5");
                         break;
                     default:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_6");
                 }
                 $note = strlen($track["ACTION_NOTE"]) > 0 ? ": " . $track["ACTION_NOTE"] : "";
                 $pattern = array("#ACTIVITY#", "#STATUS#", "#RESULT#", "#NOTE#");
                 $replaceArray = array($name, $status, $result, $note);
                 if (!empty($track["ACTION_NAME"]) && !empty($track["ACTION_TITLE"])) {
                     $pattern[] = $track["ACTION_NAME"];
                     $replaceArray[] = $track["ACTION_TITLE"];
                 }
                 $messageTemplate = str_replace($pattern, $replaceArray, $messageTemplate);
                 if (preg_match_all("/(?<=\\{\\=user\\:)([^\\}]+)(?=\\})/is", $messageTemplate, $arMatches)) {
                     $pattern = array();
                     $replacement = array();
                     foreach ($arMatches[0] as $user) {
                         $user = preg_quote($user);
                         if (in_array("/\\{\\=user\\:" . $user . "\\}/is", $pattern)) {
                             continue;
                         }
                         $replace = "";
                         if (array_key_exists(strtolower($user), $groups)) {
                             $replace = $groups[strtolower($user)];
                         } elseif (array_key_exists(strtoupper($user), $groups)) {
                             $replace = $groups[strtoupper($user)];
                         } else {
                             $id = intVal(str_replace("user_", "", $user));
                             if (!array_key_exists($id, $users)) {
                                 $dbRes = \CUser::getByID($id);
                                 $users[$id] = false;
                                 if ($dbRes && ($arUser = $dbRes->getNext())) {
                                     $name = \CUser::formatName($this->arParams["NAME_TEMPLATE"], $arUser);
                                     $arUser["FULL_NAME"] = empty($name) ? $arUser["LOGIN"] : $name;
                                     $users[$id] = $arUser;
                                 }
                             }
                             if (!empty($users[$id])) {
                                 $replace = "<a href=\"" . \CComponentEngine::makePathFromTemplate('/company/personal/user/#USER_ID#/', array("USER_ID" => $id)) . "\">" . $users[$id]["FULL_NAME"] . "</a>";
                             }
                         }
                         if (!empty($replace)) {
                             $pattern[] = "/\\{\\=user\\:" . $user . "\\}/is";
                             $pattern[] = "/\\{\\=user\\:user\\_" . $user . "\\}/is";
                             $replacement[] = $replace;
                             $replacement[] = $replace;
                         }
                     }
                     $messageTemplate = preg_replace($pattern, $replacement, $messageTemplate);
                 }
                 $this->arResult['BIZPROC_LIST'][$count]['DUMP_WORKFLOW'][] = $messageTemplate;
             }
             $tasks = CBPDocument::getUserTasksForWorkflow($this->getUser()->getId(), $idBizProc);
             $events = CBPDocument::getAllowableEvents($this->getUser()->getId(), $userGroup, $bizProcArray);
             if (!empty($tasks)) {
                 foreach ($tasks as $task) {
                     $urlTaskBizproc = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_DISK_TASK'], array("ID" => $task['ID']));
                     $urlTaskBizproc .= "?back_url=" . urlencode($this->getApplication()->getCurPage()) . "&file=" . $this->file->getName();
                     $this->arResult['BIZPROC_LIST'][$count]['TASK']['URL'] = $urlTaskBizproc;
                     $this->arResult['BIZPROC_LIST'][$count]['TASK']['TASK_ID'] = $task['ID'];
                     $this->arResult['BIZPROC_LIST'][$count]['TASK']['TASK_NAME'] = $task['NAME'];
                 }
             }
             $this->arResult['BIZPROC_LIST'][$count]['ID'] = $bizProcArray['ID'];
             $this->arResult['BIZPROC_LIST'][$count]['WORKFLOW_STATUS'] = $bizProcArray["WORKFLOW_STATUS"];
             $this->arResult['BIZPROC_LIST'][$count]['TEMPLATE_ID'] = $bizProcArray['TEMPLATE_ID'];
             $this->arResult['BIZPROC_LIST'][$count]['TEMPLATE_NAME'] = $bizProcArray['TEMPLATE_NAME'];
             $this->arResult['BIZPROC_LIST'][$count]['STATE_MODIFIED'] = $bizProcArray['STATE_MODIFIED'];
             $this->arResult['BIZPROC_LIST'][$count]['STATE_TITLE'] = $bizProcArray['STATE_TITLE'];
             $this->arResult['BIZPROC_LIST'][$count]['STATE_NAME'] = $bizProcArray['STATE_NAME'];
             $this->arResult['BIZPROC_LIST'][$count]['EVENTS'] = $events;
             $count++;
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:class.php


注:本文中的CBPDocument::getAllowableEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。