Example #1
0
 public function executeComponent()
 {
     $id = $this->getWorkflowId();
     $this->arResult = array('NeedAuth' => $this->isAuthorizationNeeded() ? 'Y' : 'N', 'FatalErrorMessage' => '', 'ErrorMessage' => '');
     if ($id) {
         $workflowState = \CBPStateService::getWorkflowState($id);
         if (!$workflowState) {
             $this->arResult['FatalErrorMessage'] = Loc::getMessage('BPWFI_WORKFLOW_NOT_FOUND');
         } else {
             $this->arResult['WorkflowState'] = $workflowState;
             $this->arResult['WorkflowTrack'] = \CBPTrackingService::DumpWorkflow($id);
             if ($workflowState['STARTED_BY'] && ($photo = $this->getStartedByPhoto($workflowState['STARTED_BY']))) {
                 $this->arResult['startedByPhotoSrc'] = $photo['src'];
             }
             $runtime = CBPRuntime::GetRuntime();
             $runtime->StartRuntime();
             /**
              * @var CBPDocumentService $documentService
              */
             $documentService = $runtime->GetService('DocumentService');
             try {
                 $this->arResult['DOCUMENT_NAME'] = $documentService->getDocumentName($workflowState['DOCUMENT_ID']);
                 $this->arResult['DOCUMENT_ICON'] = $documentService->getDocumentIcon($workflowState['DOCUMENT_ID']);
             } catch (Main\ArgumentException $e) {
                 $this->arResult['FatalErrorMessage'] = $e->getMessage();
             }
         }
     }
     $this->includeComponentTemplate();
     if ($this->arParams['SET_TITLE']) {
         $this->setPageTitle(Loc::getMessage('BPWFI_PAGE_TITLE'));
     }
 }
Example #2
0
 protected function processActionPerformActionBp()
 {
     if (!Loader::includeModule('bizproc')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_MODULE_NOT_INSTALLED'))));
     }
     $this->checkRequiredPostParams(array('iblockTypeId', 'iblockId', 'sectionId', 'workflowId', 'elementId', 'action'));
     if ($this->request->getPost('iblockTypeId') == COption::getOptionString('lists', 'livefeed_iblock_type_id')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_UNKNOWN_ERROR'))));
     }
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $this->iblockTypeId = $this->request->getPost('iblockTypeId');
     $this->iblockId = $this->request->getPost('iblockId');
     $this->sectionId = $this->request->getPost('sectionId');
     $workflowId = $this->request->getPost('workflowId');
     $elementId = $this->request->getPost('elementId');
     $action = $this->request->getPost('action');
     $this->documentStates = CBPDocument::getDocumentStates(BizProcDocument::generateDocumentComplexType($this->iblockTypeId, $this->iblockId), BizProcDocument::getDocumentComplexId($this->iblockTypeId, $elementId));
     if (isset($this->documentStates[$workflowId]['WORKFLOW_STATUS']) && $this->documentStates[$workflowId]['WORKFLOW_STATUS'] !== null) {
         $this->terminateWorkflow($workflowId, $elementId);
     }
     if ($action == 'delete') {
         if (CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser(), BizProcDocument::getDocumentComplexId($this->iblockTypeId, $elementId), array("DocumentStates" => $this->documentStates))) {
             CBPTaskService::DeleteByWorkflow($workflowId);
             CBPTrackingService::DeleteByWorkflow($workflowId);
             CBPStateService::DeleteWorkflow($workflowId);
         } else {
             $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_ACCESS_DENIED'))));
         }
         if ($this->errorCollection->hasErrors()) {
             $this->sendJsonErrorResponse();
         }
     }
     $this->sendJsonSuccessResponse(array('message' => Loc::getMessage('LISTS_LAC_MESSAGE_SUCCESS')));
 }
Example #3
0
	/**
	* Метод удаляет все связанные с документом записи.
	*
	* @param array $documentId - код документа в виде массива array(модуль, сущность, код_документа_в_модуле).
	* @param array $arErrors - массив ошибок, которые произошли при удалении в виде array(array("code" => код_ошибки, "message" => сообщение, "file" => путь_к_файлу), ...).
	*/
	public static function OnDocumentDelete($documentId, &$arErrors)
	{
		$arErrors = array();

		$arStates = CBPStateService::GetDocumentStates($documentId);
		foreach ($arStates as $workflowId => $arState)
		{
			if (strlen($arState["ID"]) > 0 && strlen($arState["WORKFLOW_STATUS"]) > 0)
				self::TerminateWorkflow($workflowId, $documentId, $arErrors);

			CBPTrackingService::DeleteByWorkflow($workflowId);
			CBPTaskService::DeleteByWorkflow($workflowId);
		}

		CBPStateService::DeleteByDocument($documentId);
		CBPHistoryService::DeleteByDocument($documentId);
	}
Example #4
0
    if (!empty($arParams["WORKFLOW_ID"])) {
        $arFilter["WORKFLOW_ID"] = $arParams["WORKFLOW_ID"];
    }
    $runtime = CBPRuntime::GetRuntime();
    $runtime->StartRuntime();
    $documentService = $runtime->GetService("DocumentService");
    $dbRecordsList = CBPTrackingService::GetList($hgridSort["sort"], $arFilter);
    while ($arRecord = $dbRecordsList->GetNext()) {
        if (strlen($arRecord["WORKFLOW_ID"]) > 0) {
            $arRecord["STATE"] = CBPStateService::GetWorkflowState($arRecord["WORKFLOW_ID"]);
            $arRecord["DOCUMENT_URL"] = CBPDocument::GetDocumentAdminPage($arRecord["STATE"]["DOCUMENT_ID"]);
            try {
                $dt = $documentService->GetDocumentType($arRecord["STATE"]["DOCUMENT_ID"]);
            } catch (Exception $e) {
            }
            $arRecord["ACTION_NOTE"] = CBPTrackingService::parseStringParameter($arRecord["ACTION_NOTE"], $dt);
        }
        $aActions = array();
        if (strlen($arRecord["DOCUMENT_URL"]) > 0) {
            $aActions[] = array("ICONCLASS" => "", "DEFAULT" => false, "TEXT" => GetMessage("BPTL_C_DOCUMENT"), "ONCLICK" => "window.open('" . $arRecord["DOCUMENT_URL"] . "');");
        }
        $arResult["H_RECORDS"][] = array("data" => $arRecord, "actions" => $aActions, "columns" => array(), "editable" => false);
    }
    $arResult["H_ROWS_COUNT"] = $dbRecordsList->SelectedRowsCount();
    $arResult["H_NAV_STRING"] = $dbRecordsList->GetPageNavStringEx($navComponentObject, GetMessage("INTS_TASKS_NAV"), "", false);
    $arResult["H_NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
    $arResult["H_NAV_RESULT"] = $dbRecordsList;
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    if (!$arParams['COUNTERS_ONLY']) {
        if ($arParams["SET_TITLE"] == "Y") {
Example #5
0
                    $result = GetMessage("BPABL_RES_4");
                    break;
                case CBPActivityExecutionResult::Uninitialized:
                    $result = GetMessage("BPABL_RES_5");
                    break;
                default:
                    $status = GetMessage("BPABL_RES_6");
            }
            $note = strlen($track["ACTION_NOTE"]) > 0 ? ": " . $track["ACTION_NOTE"] : "";
            $note = CBPTrackingService::parseStringParameter($note);
            echo str_replace(array("#ACTIVITY#", "#STATUS#", "#RESULT#", "#NOTE#"), array($name, $status, $result, $note), $strMessageTemplate);
            echo "<br />";
        }
        echo "<br><a href='" . htmlspecialcharsbx($APPLICATION->GetCurPageParam("admin_mode=N", array("admin_mode"))) . "'>" . GetMessage("BPABL_RES2SIMPLEMODE") . "</a>";
    } else {
        $dbResult = CBPTrackingService::GetList(array("ID" => "ASC"), array("WORKFLOW_ID" => $ID, "TYPE" => array(CBPTrackingType::Report, CBPTrackingType::Custom, CBPTrackingType::FaultActivity)), false, false, array("ID", "MODIFIED", "ACTION_NOTE"));
        while ($arResult = $dbResult->GetNext()) {
            echo "<i>" . $arResult["MODIFIED"] . "</i><br>" . CBPTrackingService::parseStringParameter($arResult["ACTION_NOTE"]) . "<br><br>";
        }
        echo "<a href='" . htmlspecialcharsbx($APPLICATION->GetCurPageParam("admin_mode=Y", array("admin_mode"))) . "'>" . GetMessage("BPABL_RES2ADMINMODE") . "</a>";
    }
    ?>
			</td>
		</tr>
	<?php 
    //$tabControl->Buttons();
    ?>
	<?php 
    $tabControl->End();
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
Example #6
0
 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;
                     case CBPActivityExecutionStatus::Canceling:
                         $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++;
         }
     }
 }
 public static function ClearOldAgent()
 {
     CBPTrackingService::ClearOld(COption::GetOptionString("bizproc", "log_cleanup_days", "90"));
     return "CBPTrackingService::ClearOldAgent();";
 }
Example #8
0
    if (!is_array($arResult["arWorkflowState"]) || count($arResult["arWorkflowState"]) <= 0) {
        $arError[] = array("id" => "error", "text" => GetMessage("BPABL_INVALID_WF"));
    } else {
        $bCanView = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), $arResult["arWorkflowState"]["DOCUMENT_ID"], array("WorkflowId" => $arParams["ID"], "DocumentStates" => array($arParams["ID"] => $arResult["arWorkflowState"]), "UserGroups" => $arParams["USER_GROUPS"]));
        if (!$bCanView) {
            $arError[] = array("id" => "access denied", "text" => GetMessage("BPABL_NO_PERMS"));
        }
    }
    if (!empty($arError)) {
        $e = new CAdminException($arError);
        ShowError($e->GetString());
        return false;
    }
    /********************************************************************
    					Data
    	********************************************************************/
    $arResult["arWorkflowTrack"] = CBPTrackingService::DumpWorkflow($arParams["ID"]);
    /********************************************************************
    					/Data
    	********************************************************************/
    $this->IncludeComponentTemplate();
    /********************************************************************
    					Standart operations
    	********************************************************************/
    if ($arParams["SET_TITLE"] == "Y") {
        $APPLICATION->SetTitle(str_replace("#ID#", $arParams["ID"], GetMessage("BPABL_TITLE")));
    }
    /********************************************************************
    					/Standart operations
    	********************************************************************/
}
Example #9
0
     }
     if (in_array($key, array("NAME", "CREATED_BY_PRINTABLE", "TIMESTAMP_X"))) {
         continue;
     }
     if (in_array($value["BaseType"], array("user"))) {
         continue;
     }
     $arFieldsTmp[] = array("id" => $key, "name" => $value["Name"], "type" => "label");
 }
 $arTabs[] = array("id" => "tab2", "name" => GetMessage("BPWC_WNCT_TAB2"), "title" => GetMessage("BPWC_WNCT_TAB2"), "icon" => "", "fields" => $arFieldsTmp);
 $arResultGrid["GRID_ID"] = "form_bp_grid_" . implode("_", $arResult["DocumentType"]);
 $gridOptions = new CGridOptions($arResultGrid["GRID_ID"]);
 $arSort = $gridOptions->GetSorting(array("sort" => array("id" => "desc"), "vars" => array("by" => "by", "order" => "order")));
 $arNav = $gridOptions->GetNavParams(array("nPageSize" => 20));
 $arSortArg = each($arSort["sort"]);
 $dbTrack = CBPTrackingService::GetList($arSort["sort"], array("WORKFLOW_ID" => $arResult["BP"]["DOCUMENT_STATE"]["ID"], "TYPE" => array(CBPTrackingType::Custom, CBPTrackingType::FaultActivity, CBPTrackingType::Report)));
 $dbTrack->NavStart($arNav["nPageSize"]);
 $GLOBALS["__bwl_ParseStringParameterTmp1_arAllowableUserGroups"] = CBPDocument::GetAllowableUserGroups($arResult["DocumentType"]);
 function __bwl_ParseStringParameterTmp1($matches)
 {
     $result = "";
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
             $result = $GLOBALS["__bwl_ParseStringParameterTmp1_arAllowableUserGroups"][$user];
         }
     } elseif ($matches[1] == "group") {
         $result = $GLOBALS["__bwl_ParseStringParameterTmp1_arAllowableUserGroups"][$matches[2]];
Example #10
0
            case CBPActivityExecutionResult::Succeeded:
                $result = GetMessage("BPABL_RES_2");
                break;
            case CBPActivityExecutionResult::Canceled:
                $result = GetMessage("BPABL_RES_3");
                break;
            case CBPActivityExecutionResult::Faulted:
                $result = GetMessage("BPABL_RES_4");
                break;
            case CBPActivityExecutionResult::Uninitialized:
                $result = GetMessage("BPABL_RES_5");
                break;
            default:
                $status = GetMessage("BPABL_RES_6");
        }
        $note = CBPTrackingService::parseStringParameter($arTrack["ACTION_NOTE"], $documentType);
        $modified_by = "";
        if (intval($arTrack["MODIFIED_BY"]) > 0) {
            $dbUserTmp = CUser::GetByID($arTrack["MODIFIED_BY"]);
            $arUserTmp = $dbUserTmp->GetNext();
            $modified_by = CUser::FormatName($arParams["NAME_TEMPLATE"], $arUserTmp, true);
            $modified_by .= " [" . $arTrack["MODIFIED_BY"] . "]";
        }
        $aCols = array("date" => $date, "name" => $name, "type" => $type, "status" => $status, "result" => $result, "note" => $note, "modified_by" => $modified_by);
        $aActions = array();
        $arResult["RECORDS"][] = array("data" => $arTrack, "actions" => $aActions, "columns" => $aCols, "editable" => false);
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    if ($arParams["SET_TITLE"] == "Y") {
        $APPLICATION->SetTitle(GetMessage("BPABL_PAGE_TITLE") . ": " . $arResult["BP"]["NAME"]);
Example #11
0
 public static function killWorkflow($workflowId, $terminate = true, $documentId = null)
 {
     $errors = array();
     if ($terminate) {
         static::TerminateWorkflow($workflowId, $documentId, $errors);
     }
     \Bitrix\Bizproc\WorkflowInstanceTable::delete($workflowId);
     CBPTaskService::DeleteByWorkflow($workflowId);
     CBPTrackingService::DeleteByWorkflow($workflowId);
     CBPStateService::DeleteWorkflow($workflowId);
     return $errors;
 }
Example #12
0
 /**
  * @param string $workflowId
  * @param string $iblockType
  * @param int $elementId
  * @param int $iblockId
  * @param string $action Action stop or delete
  * @return string error
  */
 public static function completeWorkflow($workflowId, $iblockType, $elementId, $iblockId, $action)
 {
     if (!Loader::includeModule('bizproc')) {
         return Loc::getMessage('LISTS_MODULE_BIZPROC_NOT_INSTALLED');
     }
     global $USER;
     $userId = $USER->getID();
     $documentType = BizprocDocument::generateDocumentComplexType($iblockType, $iblockId);
     $documentId = BizprocDocument::getDocumentComplexId($iblockType, $elementId);
     $documentStates = CBPDocument::getDocumentStates($documentType, $documentId);
     $permission = CBPDocument::canUserOperateDocument($action == 'stop' ? CBPCanUserOperateOperation::StartWorkflow : CBPCanUserOperateOperation::CreateWorkflow, $userId, $documentId, array("DocumentStates" => $documentStates));
     if (!$permission) {
         return Loc::getMessage('LISTS_ACCESS_DENIED');
     }
     $stringError = '';
     if ($action == 'stop') {
         $errors = array();
         CBPDocument::terminateWorkflow($workflowId, $documentId, $errors);
         if (!empty($errors)) {
             $stringError = '';
             foreach ($errors as $error) {
                 $stringError .= $error['message'];
             }
             $listError[] = array('id' => 'stopBizproc', 'text' => $stringError);
         }
     } else {
         $errors = array();
         if (isset($documentStates[$workflowId]['WORKFLOW_STATUS']) && $documentStates[$workflowId]['WORKFLOW_STATUS'] !== null) {
             CBPDocument::terminateWorkflow($workflowId, $documentId, $errors);
         }
         if (!empty($errors)) {
             $stringError = '';
             foreach ($errors as $error) {
                 $stringError .= $error['message'];
             }
             $listError[] = array('id' => 'stopBizproc', 'text' => $stringError);
         } else {
             CBPTaskService::deleteByWorkflow($workflowId);
             CBPTrackingService::deleteByWorkflow($workflowId);
             CBPStateService::deleteWorkflow($workflowId);
         }
     }
     if (empty($listError) && Loader::includeModule('socialnetwork') && $iblockType == COption::getOptionString("lists", "livefeed_iblock_type_id")) {
         $sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
         $resultQuery = CSocNetLog::getList(array(), array('EVENT_ID' => 'lists_new_element', 'SOURCE_ID' => $sourceId), false, false, array('ID'));
         while ($log = $resultQuery->fetch()) {
             CSocNetLog::delete($log['ID']);
         }
     }
     if (!empty($listError)) {
         $errorObject = new CAdminException($listError);
         $stringError = $errorObject->getString();
     }
     return $stringError;
 }
Example #13
0
    $arResultGrid["GRID_ID"] = "form_bp_grid_" . implode("_", $arResult["DocumentType"]);
    $gridOptions = new CGridOptions($arResultGrid["GRID_ID"]);
    $arSort = $gridOptions->GetSorting(array("sort" => array("id" => "desc"), "vars" => array("by" => "by", "order" => "order")));
    $arNav = $gridOptions->GetNavParams(array("nPageSize" => 20));
    $arSortArg = each($arSort["sort"]);
    $dbTrack = CBPTrackingService::GetList($arSort["sort"], array("WORKFLOW_ID" => $arResult["BP"]["DOCUMENT_STATE"]["ID"], "TYPE" => array(CBPTrackingType::Custom, CBPTrackingType::FaultActivity, CBPTrackingType::Report)));
    $dbTrack->NavStart($arNav["nPageSize"]);
    $arRowsTmp = array();
    while ($arTrackRecord = $dbTrack->GetNext()) {
        foreach ($arTrackRecord as $key => $value) {
            if ($key != 'ACTION_NOTE' && CheckDateTime($value)) {
                $arTrackRecord[$key] = FormatDateFromDB($value);
            }
        }
        $note = $arTrackRecord["ACTION_NOTE"];
        $note = CBPTrackingService::parseStringParameter($note, $arResult["DocumentType"]);
        $arCols = array("ACTION_NOTE" => $note);
        $arRowsTmp[] = array("data" => $arTrackRecord, "actions" => array(), "columns" => $arCols, "editable" => false);
    }
    $arResultGrid["ROWS"] = $arRowsTmp;
    $arResultGrid["ROWS_COUNT"] = $dbTrack->SelectedRowsCount();
    $arResultGrid["SORT"] = $arSort["sort"];
    $arResultGrid["SORT_VARS"] = $arSort["vars"];
    $dbTrack->bShowAll = false;
    $arResultGrid["NAV_OBJECT"] = $dbTrack;
    ob_start();
    $APPLICATION->IncludeComponent("bitrix:main.interface.grid", "", array("GRID_ID" => $arResultGrid["GRID_ID"], "HEADERS" => array(array("id" => "MODIFIED", "name" => GetMessage("BPWC_WNCT_TL_DATE"), "sort" => "MODIFIED", "default" => true, "editable" => false), array("id" => "ACTION_TITLE", "name" => GetMessage("BPWC_WNCT_TL_NAME"), "default" => true, "editable" => false), array("id" => "ACTION_NOTE", "name" => GetMessage("BPWC_WNCT_TL_NOTE"), "default" => true, "editable" => false)), "SORT" => $arResultGrid["SORT"], "SORT_VARS" => $arResultGrid["SORT_VARS"], "ROWS" => $arResultGrid["ROWS"], "FOOTER" => array(array("title" => GetMessage("BPWC_WNCT_TL_TOTAL"), "value" => $arResultGrid["ROWS_COUNT"])), "ACTIONS" => array(), "ACTION_ALL_ROWS" => false, "EDITABLE" => false, "NAV_OBJECT" => $arResultGrid["NAV_OBJECT"], "AJAX_MODE" => "N", "AJAX_OPTION_JUMP" => "N", "AJAX_OPTION_STYLE" => "Y", "FORM_ID" => $arResult["FORM_ID"], "TAB_ID" => "tab3"), $component);
    $gridTmp = ob_get_clean();
    $arTabs[] = array("id" => "tab3", "name" => GetMessage("BPWC_WNCT_TL_HISTORY"), "title" => GetMessage("BPWC_WNCT_TL_HISTORY"), "icon" => "", "fields" => array(array("id" => "GRID", "name" => GetMessage("BPWC_WNCT_TL_HISTORY"), "type" => "custom", "value" => $gridTmp, "colspan" => true)));
    $APPLICATION->IncludeComponent("bitrix:main.interface.form", "", array("FORM_ID" => $arResult["FORM_ID"], "TABS" => $arTabs, "BUTTONS" => array("custom_html" => "", "standard_buttons" => false), "DATA" => $arResult["BP"], "THEME_GRID_ID" => "user_grid", "SHOW_SETTINGS" => "Y", "AJAX_MODE" => "N", "AJAX_OPTION_JUMP" => "N", "AJAX_OPTION_STYLE" => "Y"), $component);
}
Example #14
0
 public function processActionDeleteBizProc()
 {
     $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((int) $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');
     foreach ($documentData as $nameModule => $data) {
         $availabilityProcess = CBPDocument::GetDocumentState($data['DOCUMENT_ID'], $workflowId);
         if (!empty($availabilityProcess)) {
             if (CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getId(), $data['DOCUMENT_ID'])) {
                 CBPTrackingService::deleteByWorkflow($workflowId);
                 CBPTaskService::deleteByWorkflow($workflowId);
                 /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                 CBPStateService::deleteWorkflow($workflowId);
             }
         }
     }
     $this->sendJsonSuccessResponse();
 }
Example #15
0
 }
 $arResult["H_GRID_ID"] = "bizproc_tasksListH_" . $arParams["USER_ID"];
 $hgridOptions = new CGridOptions($arResult["H_GRID_ID"]);
 $hgridColumns = $hgridOptions->GetVisibleColumns();
 $hgridSort = $hgridOptions->GetSorting(array("sort" => array("ID" => "desc")));
 $arResult["H_HEADERS"] = array(array("id" => "MODIFIED", "name" => GetMessage("BPATL_MODIFIED"), "default" => true, "sort" => ""), array("id" => "ACTION_NOTE", "name" => GetMessage("BPATL_DESCRIPTION"), "default" => true, "sort" => ""));
 $arResult["H_SORT"] = $hgridSort["sort"];
 $arResult["H_RECORDS"] = array();
 $arFilter = array("MODIFIED_BY" => $arParams["USER_ID"]);
 if (!empty($arParams["WORKFLOW_ID"])) {
     $arFilter["WORKFLOW_ID"] = $arParams["WORKFLOW_ID"];
 }
 $runtime = CBPRuntime::GetRuntime();
 $runtime->StartRuntime();
 $documentService = $runtime->GetService("DocumentService");
 $dbRecordsList = CBPTrackingService::GetList($hgridSort["sort"], $arFilter);
 while ($arRecord = $dbRecordsList->GetNext()) {
     if (strlen($arRecord["WORKFLOW_ID"]) > 0) {
         $arRecord["STATE"] = CBPStateService::GetWorkflowState($arRecord["WORKFLOW_ID"]);
         $arRecord["DOCUMENT_URL"] = CBPDocument::GetDocumentAdminPage($arRecord["STATE"]["DOCUMENT_ID"]);
         try {
             $dt = $documentService->GetDocumentType($arRecord["STATE"]["DOCUMENT_ID"]);
         } catch (Exception $e) {
         }
         $arRecord["ACTION_NOTE"] = preg_replace_callback("/\\{=([A-Za-z0-9_]+)\\:([A-Za-z0-9_]+)\\}/i", create_function('$matches', 'return __bwl_ParseStringParameterTmp1($matches, array("' . $dt[0] . '", "' . $dt[1] . '", "' . $dt[2] . '"));'), $arRecord["ACTION_NOTE"]);
     }
     $aActions = array();
     if (strlen($arRecord["DOCUMENT_URL"]) > 0) {
         $aActions[] = array("ICONCLASS" => "", "DEFAULT" => false, "TEXT" => GetMessage("BPTL_C_DOCUMENT"), "ONCLICK" => "window.open('" . $arRecord["DOCUMENT_URL"] . "');");
     }
     $arResult["H_RECORDS"][] = array("data" => $arRecord, "actions" => $aActions, "columns" => array(), "editable" => false);
Example #16
0
     if (substr($key, -5) == "_from") {
         $op = ">=";
         $newKey = substr($key, 0, -5);
     } elseif (substr($key, -3) == "_to") {
         $op = "<=";
         $newKey = substr($key, 0, -3);
     } else {
         $op = "";
         $newKey = $key;
     }
     $arFilter[$op . $newKey] = $value;
 }
 $arResult["HEADERS"] = array(array("id" => "date", "name" => GetMessage("BPWC_WLCT_F_DATE"), "sort" => "ID", "default" => true), array("id" => "name", "name" => GetMessage("BPWC_WLCT_F_NAME"), "default" => true), array("id" => "type", "name" => GetMessage("BPWC_WLCT_F_TYPE"), "default" => $arResult["AdminMode"]), array("id" => "status", "name" => GetMessage("BPWC_WLCT_F_STATUS"), "default" => $arResult["AdminMode"]), array("id" => "result", "name" => GetMessage("BPWC_WLCT_F_RESULT"), "default" => $arResult["AdminMode"]), array("id" => "note", "name" => GetMessage("BPWC_WLCT_F_NOTE"), "default" => true), array("id" => "modified_by", "name" => GetMessage("BPWC_WLCT_F_MODIFIED_BY"), "default" => false));
 $arResult["RECORDS"] = array();
 $level = 0;
 $dbTrack = CBPTrackingService::GetList($gridSort["sort"], $arFilter);
 while ($arTrack = $dbTrack->GetNext()) {
     $prefix = "";
     if (!$arResult["AdminMode"]) {
         if ($arTrack["TYPE"] != CBPTrackingType::Custom && $arTrack["TYPE"] != CBPTrackingType::FaultActivity && $arTrack["TYPE"] != CBPTrackingType::Report) {
             continue;
         }
     }
     /*else
     		{
     			if ($arTrack["TYPE"] == CBPTrackingType::CloseActivity)
     			{
     				$level--;
     				$prefix = str_repeat("&nbsp;&nbsp;", $level > 0 ? $level : 0);
     			}
     			elseif ($arTrack["TYPE"] == CBPTrackingType::ExecuteActivity)
Example #17
0
}
foreach ($arDocumentStates as $arDocumentState) {
    $bizProcIndex++;
    if (intVal($arDocumentState["WORKFLOW_STATUS"]) < 0 || $arDocumentState["ID"] <= 0) {
        continue;
    } elseif (!CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]))) {
        continue;
    }
    if (isset($arParams["TASK_ID"]) && $arParams["TASK_ID"] !== $arDocumentState["ID"]) {
        continue;
    }
    $arTasks = array();
    $arDumpWorkflow = array();
    $arTasks = CBPDocument::GetUserTasksForWorkflow($USER->GetID(), $arDocumentState["ID"]);
    if (strlen($arDocumentState["WORKFLOW_STATUS"]) > 0) {
        $dbDmpWorkflow = CBPTrackingService::GetList(array("ID" => "DESC"), array("WORKFLOW_ID" => $arDocumentState["ID"], "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 = $dbDmpWorkflow->GetNext()) {
            $strMessageTemplate = "";
            switch ($track["TYPE"]) {
                case 1:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_1");
                    break;
                case 2:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_2");
                    break;
                case 3:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_3");
                    break;
                case 4:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_4");
                    break;
Example #18
0
         $arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
     } else {
         CBPDocument::TerminateWorkflow($_REQUEST["id"], $arParams["DOCUMENT_ID"], $ar);
         if (count($ar) > 0) {
             $str = "";
             foreach ($ar as $a) {
                 $str .= $a["message"];
             }
             $arError[] = array("id" => "stop_bizproc", "text" => $str);
         }
     }
 } elseif ($_REQUEST["action"] == "del_bizproc") {
     if ($arParams["DropWorkflowPermission"] != "Y") {
         $arError[] = array("id" => "access_denied", "text" => GetMessage("BPADH_NO_PERMS"));
     } else {
         CBPTrackingService::DeleteByWorkflow($_REQUEST["id"]);
         CBPStateService::DeleteWorkflow($_REQUEST["id"]);
     }
 } elseif ($_SERVER['REQUEST_METHOD'] == "POST" && intval($_REQUEST["bizproc_index"]) > 0) {
     $arBizProcWorkflowId = array();
     $bizprocIndex = intval($_REQUEST["bizproc_index"]);
     for ($i = 1; $i <= $bizprocIndex; $i++) {
         $bpId = trim($_REQUEST["bizproc_id_" . $i]);
         $bpTemplateId = intval($_REQUEST["bizproc_template_id_" . $i]);
         $bpEvent = trim($_REQUEST["bizproc_event_" . $i]);
         if (strlen($bpEvent) > 0) {
             if (strlen($bpId) > 0) {
                 if (!array_key_exists($bpId, $arDocumentStates)) {
                     continue;
                 }
             } else {
Example #19
0
		</table>
	</li>
<?php 
}
foreach ($arDocumentStates as $arDocumentState) {
    $bizProcIndex++;
    if (intVal($arDocumentState["WORKFLOW_STATUS"]) < 0 || $arDocumentState["ID"] <= 0) {
        continue;
    } elseif (!CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), $arParams["DOCUMENT_ID"], array("DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]))) {
        continue;
    }
    $arTasks = array();
    $arDumpWorkflow = array();
    $arTasks = CBPDocument::GetUserTasksForWorkflow($USER->GetID(), $arDocumentState["ID"]);
    if (strlen($arDocumentState["WORKFLOW_STATUS"]) > 0) {
        $arDmpWorkflow = array_reverse(CBPTrackingService::DumpWorkflow($arDocumentState["ID"]));
        $track = $tmp = reset($arDmpWorkflow);
        do {
            $strMessageTemplate = "";
            switch ($track["TYPE"]) {
                case 1:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_1");
                    break;
                case 2:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_2");
                    break;
                case 3:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_3");
                    break;
                case 4:
                    $strMessageTemplate = GetMessage("BPABL_TYPE_4");
Example #20
0
        if ($arParams[$name] <= 0) {
            $arParams[$name] = trim($_REQUEST[$nameLower]);
        }
        if ($arParams[$name] <= 0) {
            foreach ($_REQUEST as $key => $value) {
                if (strtolower($key) == $nameLower) {
                    $arParams[$name] = trim($_REQUEST[$key]);
                    break;
                }
            }
        }
    }
}
BPWSInitParam($arParams, "WORKFLOW_ID");
$arResult["NeedAuth"] = "N";
$arResult["FatalErrorMessage"] = "";
$arResult["ErrorMessage"] = "";
global $USER;
if (!$USER->IsAuthorized()) {
    $arResult["NeedAuth"] = "Y";
} elseif (strlen($arParams["WORKFLOW_ID"]) <= 0) {
    $arResult["FatalErrorMessage"] .= "Не указан код рабочего потока" . ". ";
} else {
    $arResult["WorkflowState"] = CBPStateService::GetWorkflowState($arParams["WORKFLOW_ID"]);
    if ($arResult["WorkflowState"]) {
        $arResult["WorkflowTrack"] = CBPTrackingService::DumpWorkflow($arParams["WORKFLOW_ID"]);
    } else {
        $arResult["FatalErrorMessage"] .= "Рабочий поток не найден" . ". ";
    }
}
$this->IncludeComponentTemplate();
Example #21
0
$arParams["PATH_TO_BIZPROC_EDIT"] = trim($arParams["PATH_TO_BIZPROC_EDIT"]);
if (strlen($arParams["PATH_TO_BIZPROC_EDIT"]) <= 0) {
    $arParams["PATH_TO_BIZPROC_EDIT"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=bizproc_edit&" . $arParams["TASK_VAR"] . "=#task_id#");
}
if (!$GLOBALS["USER"]->IsAuthorized()) {
    $arResult["NEED_AUTH"] = "Y";
} else {
    if ($arParams["SET_TITLE"] == "Y") {
        $APPLICATION->SetTitle(GetMessage("SONET_BIZPROC_TITLE"));
    }
    if ($arParams["SET_NAV_CHAIN"] != "N") {
        $APPLICATION->AddChainItem(GetMessage("SONET_BIZPROC_TITLE"));
    }
    $dbResultList = CBPTaskService::GetList(array("MODIFIED" => "DESC"), array("USER_ID" => $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS"));
    while ($arResultItem = $dbResultList->GetNext()) {
        if (strlen($arResultItem["DESCRIPTION"]) > 100) {
            $arResultItem["DESCRIPTION"] = substr($arResultItem["DESCRIPTION"], 0, 97) . "...";
        }
        $arResultItem["EditUrl"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BIZPROC_EDIT"], array("task_id" => $arResultItem["ID"]));
        $arResult["TASKS"][] = $arResultItem;
    }
    $dbTracking = CBPTrackingService::GetList(array("MODIFIED" => "DESC"), array("MODIFIED_BY" => $USER->GetID()));
    while ($arTracking = $dbTracking->GetNext()) {
        if (strlen($arTracking["WORKFLOW_ID"]) > 0) {
            $arTracking["STATE"] = CBPStateService::GetWorkflowState($arTracking["WORKFLOW_ID"]);
            $arTracking["STATE"]["Url"] = CBPDocument::GetDocumentAdminPage($arTracking["STATE"]["DOCUMENT_ID"]);
        }
        $arResult["TRACKING"][] = $arTracking;
    }
}
$this->IncludeComponentTemplate();
Example #22
0
                    $result = GetMessage("BPABL_RES_4");
                    break;
                case CBPActivityExecutionResult::Uninitialized:
                    $result = GetMessage("BPABL_RES_5");
                    break;
                default:
                    $status = GetMessage("BPABL_RES_6");
            }
            $note = strlen($track["ACTION_NOTE"]) > 0 ? ": " . $track["ACTION_NOTE"] : "";
            $note = preg_replace_callback("/\\{=([A-Za-z0-9_]+)\\:([A-Za-z0-9_]+)\\}/i", "__bwl_ParseStringParameterTmp", $note);
            echo str_replace(array("#ACTIVITY#", "#STATUS#", "#RESULT#", "#NOTE#"), array($name, $status, $result, $note), $strMessageTemplate);
            echo "<br />";
        }
        echo "<br><a href='" . htmlspecialcharsbx($APPLICATION->GetCurPageParam("admin_mode=N", array("admin_mode"))) . "'>" . GetMessage("BPABL_RES2SIMPLEMODE") . "</a>";
    } else {
        $dbResult = CBPTrackingService::GetList(array("ID" => "ASC"), array("WORKFLOW_ID" => $ID, "TYPE" => array(CBPTrackingType::Report, CBPTrackingType::Custom, CBPTrackingType::FaultActivity)), false, false, array("ID", "MODIFIED", "ACTION_NOTE"));
        while ($arResult = $dbResult->GetNext()) {
            echo "<i>" . $arResult["MODIFIED"] . "</i><br>" . preg_replace_callback("/\\{=([A-Za-z0-9_]+)\\:([A-Za-z0-9_]+)\\}/i", "__bwl_ParseStringParameterTmp", $arResult["ACTION_NOTE"]) . "<br><br>";
        }
        echo "<a href='" . htmlspecialcharsbx($APPLICATION->GetCurPageParam("admin_mode=Y", array("admin_mode"))) . "'>" . GetMessage("BPABL_RES2ADMINMODE") . "</a>";
    }
    ?>
			</td>
		</tr>
	<?php 
    //$tabControl->Buttons();
    ?>
	<?php 
    $tabControl->End();
}
?>