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


PHP CBPDocument::killWorkflow方法代码示例

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


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

示例1: executeComponent

 public function executeComponent()
 {
     if ($this->arParams['SET_TITLE']) {
         $this->setPageTitle(Loc::getMessage('BPWI_PAGE_TITLE'));
     }
     if (!empty($_POST['ID']) && check_bitrix_sessid() && $this->isAdmin()) {
         foreach ((array) $_POST['ID'] as $id) {
             CBPDocument::killWorkflow($id);
         }
     }
     $selectFields = array('ID', 'MODIFIED', 'OWNER_ID', 'OWNED_UNTIL', 'WS_MODULE_ID' => $this->getFieldName('WS_MODULE_ID'), 'WS_ENTITY' => $this->getFieldName('WS_ENTITY'), 'WS_DOCUMENT_ID' => $this->getFieldName('WS_DOCUMENT_ID'));
     $gridColumns = $this->getGridOptions()->getVisibleColumns();
     $this->arResult['HEADERS'] = $this->getGridHeaders();
     $showDocumentName = false;
     foreach ($this->arResult['HEADERS'] as $h) {
         if ((count($gridColumns) <= 0 || in_array($h['id'], $gridColumns)) && !in_array($h['id'], $selectFields)) {
             if ($this->getFieldName($h['id'])) {
                 $selectFields[$h['id']] = $this->getFieldName($h['id']);
             } elseif ($h['id'] == 'IS_LOCKED' && !in_array('OWNED_UNTIL', $selectFields)) {
                 $selectFields['OWNED_UNTIL'] = $this->getFieldName('OWNED_UNTIL');
             } elseif ($h['id'] == 'WS_DOCUMENT_NAME') {
                 $showDocumentName = true;
             }
         }
     }
     if (isset($selectFields['WS_STARTED_BY'])) {
         $selectFields['WS_STARTED_USER_NAME'] = $this->getFieldName('WS_STARTED_USER_NAME');
         $selectFields['WS_STARTED_USER_LAST_NAME'] = $this->getFieldName('WS_STARTED_USER_LAST_NAME');
         $selectFields['WS_STARTED_USER_LOGIN'] = $this->getFieldName('WS_STARTED_USER_LOGIN');
     }
     $filter = array();
     $templatesFilter = array();
     $this->arResult['DOCUMENT_TYPES'] = $this->getDocumentTypes();
     if (!empty($_REQUEST['type']) && isset($this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']])) {
         $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ACTIVE'] = true;
         if (!empty($this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['MODULE_ID'])) {
             $filter = array('=' . $this->getFieldName('WS_MODULE_ID') => $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['MODULE_ID']);
             $templatesFilter = array('MODULE_ID' => $filter[$this->getFieldName('WS_MODULE_ID')]);
             if (!empty($this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ENTITY'])) {
                 $filter['=' . $this->getFieldName('WS_ENTITY')] = $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ENTITY'];
                 $templatesFilter['ENTITY'] = $this->arResult['DOCUMENT_TYPES'][$_REQUEST['type']]['ENTITY'];
             }
         } elseif ($_REQUEST['type'] == 'is_locked') {
             global $DB;
             $filter['<OWNED_UNTIL'] = date($DB->DateFormatToPHP(FORMAT_DATETIME), $this->getLockedTime());
         }
     } else {
         $this->arResult['DOCUMENT_TYPES']['*']['ACTIVE'] = true;
     }
     $templatesList = array('' => Loc::getMessage('BPWI_WORKFLOW_ID_ANY'));
     $dbResTmp = \CBPWorkflowTemplateLoader::GetList(array('NAME' => 'ASC'), $templatesFilter, false, false, array('ID', 'NAME'));
     while ($arResTmp = $dbResTmp->GetNext()) {
         $templatesList[$arResTmp['ID']] = $arResTmp['NAME'];
     }
     $this->arResult['FILTER'] = $this->getFilter();
     $this->arResult['FILTER'][] = array('id' => 'WS_WORKFLOW_TEMPLATE_ID', 'name' => Loc::getMessage('BPWI_WS_WORKFLOW_TEMPLATE_ID'), 'type' => 'list', 'items' => $templatesList);
     $gridFilter = $this->getGridOptions()->getFilter($this->arResult['FILTER']);
     $filter = $this->mergeFilters($filter, $gridFilter);
     if (!$this->isAdmin()) {
         global $USER;
         $filter['=' . $this->getFieldName('WS_STARTED_BY')] = $USER->getId();
     }
     list($currentPage, $pageSize, $offset) = $this->getPaginationInfo();
     $this->arResult['SORT'] = $this->getSorting();
     $this->arResult['CURRENT_PAGE'] = $currentPage;
     $this->arResult['SHOW_NEXT_PAGE'] = false;
     $this->arResult['RECORDS'] = array();
     $iterator = WorkflowInstanceTable::getList(array('order' => $this->arResult['SORT'], 'select' => $selectFields, 'filter' => $filter, 'limit' => $pageSize + 1, 'offset' => $offset));
     $rowsCount = 0;
     while ($row = $iterator->fetch()) {
         $rowsCount++;
         if ($rowsCount > $pageSize) {
             $this->arResult['SHOW_NEXT_PAGE'] = true;
             break;
         }
         $row['WS_WORKFLOW_TEMPLATE_ID'] = $row['WS_WORKFLOW_TEMPLATE_ID'] ? $templatesList[$row['WS_WORKFLOW_TEMPLATE_ID']] : null;
         $row['IS_LOCKED'] = $row['OWNED_UNTIL'] && $row['OWNED_UNTIL']->getTimestamp() < $this->getLockedTime();
         if (!empty($row['WS_STARTED_BY'])) {
             $row['WS_STARTED_BY'] = CUser::FormatName($this->arParams["NAME_TEMPLATE"], array('LOGIN' => $row['WS_STARTED_USER_LOGIN'], 'NAME' => $row['WS_STARTED_USER_NAME'], 'LAST_NAME' => $row['WS_STARTED_USER_LAST_NAME']), true) . " [" . $row['WS_STARTED_BY'] . "]";
         }
         $row['DOCUMENT_URL'] = $row['WS_DOCUMENT_NAME'] = '';
         if (!empty($row['WS_MODULE_ID'])) {
             $row['DOCUMENT_URL'] = CBPDocument::GetDocumentAdminPage(array($row['WS_MODULE_ID'], $row['WS_ENTITY'], $row['WS_DOCUMENT_ID']));
             if ($showDocumentName) {
                 $row['WS_DOCUMENT_NAME'] = CBPDocument::getDocumentName(array($row['WS_MODULE_ID'], $row['WS_ENTITY'], $row['WS_DOCUMENT_ID']));
             }
         }
         $rowActions = array(array("ICONCLASS" => "edit", "DEFAULT" => true, "TEXT" => Loc::getMessage("BPWI_OPEN_DOCUMENT"), "ONCLICK" => $row['DOCUMENT_URL'] ? "window.open('" . $row["DOCUMENT_URL"] . "');" : 'alert(\'' . Loc::getMessage('BPWI_NO_DOCUMENT') . '\')'));
         if ($this->isAdmin()) {
             $rowActions[] = array("ICONCLASS" => "delete", "TEXT" => Loc::getMessage("BPWI_DELETE_LABEL"), "ONCLICK" => "bxGrid_" . static::GRID_ID . ".DeleteItem('" . $row['ID'] . "', '" . Loc::getMessage("BPWI_DELETE_CONFIRM") . "')");
         }
         $this->arResult['RECORDS'][] = array('data' => $row, 'editable' => $this->isAdmin(), 'actions' => $rowActions);
     }
     $this->arResult['ROWS_COUNT'] = sizeof($this->arResult['RECORDS']);
     $this->arResult['GRID_ID'] = static::GRID_ID;
     $this->arResult['FILTER_PRESETS'] = $this->getFilterPresets();
     $this->arResult['EDITABLE'] = $this->isAdmin();
     $this->includeComponentTemplate();
 }
开发者ID:Satariall,项目名称:izurit,代码行数:99,代码来源:class.php


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