public function LoadReport($workflowId) { $result = array(); $dbResult = CBPTrackingService::GetList(array("ID" => "ASC"), array("WORKFLOW_ID" => $workflowId, "TYPE" => CBPTrackingType::Report), false, false, array("ID", "MODIFIED", "ACTION_NOTE")); while ($arResult = $dbResult->GetNext()) { $result[] = $arResult; } return $result; }
$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();
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(" ", $level > 0 ? $level : 0); } elseif ($arTrack["TYPE"] == CBPTrackingType::ExecuteActivity)
} 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;
} $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);
$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";
} 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]];