protected function getBizprocData() { $userId = $this->getUser()->getID(); $currentUserGroups = $this->getUser()->getUserGroupArray(); if (!$this->lists['ELEMENT_FIELDS'] || $this->lists['ELEMENT_FIELDS']['CREATED_BY'] == $userId) { $currentUserGroups[] = 'Author'; } $documentType = 'iblock_' . $this->iblockId; CBPDocument::addShowParameterInit('lists', 'only_users', $documentType); $this->lists['BIZPROC_FIELDS'] = array(); $bizprocIndex = 0; $documentStates = CBPDocument::getDocumentStates(array('lists', 'BizprocDocument', $documentType), null); $runtime = CBPRuntime::getRuntime(); $runtime->startRuntime(); $documentService = $runtime->getService('DocumentService'); foreach ($documentStates as $documentState) { $bizprocIndex++; $viewWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::StartWorkflow, $userId, array('lists', 'BizprocDocument', $documentType), array('sectionId' => 0, 'AllUserGroups' => $currentUserGroups, 'DocumentStates' => $documentStates, 'WorkflowId' => $documentState['ID'] > 0 ? $documentState['ID'] : $documentState['TEMPLATE_ID'])); if ($viewWorkflow) { $templateId = intval($documentState['TEMPLATE_ID']); $workflowParameters = $documentState['TEMPLATE_PARAMETERS']; if (!is_array($workflowParameters)) { $workflowParameters = array(); } if (strlen($documentState["ID"]) <= 0 && $templateId > 0) { $parametersValues = array(); $keys = array_keys($workflowParameters); foreach ($keys as $key) { $value = $workflowParameters[$key]["Default"]; if (!is_array($value)) { $parametersValues[$key] = htmlspecialcharsbx($value); } else { $keys1 = array_keys($value); foreach ($keys1 as $key1) { $parametersValues[$key][$key1] = htmlspecialcharsbx($value[$key1]); } } } foreach ($workflowParameters as $parameterKey => $arParameter) { $parameterKeyExt = "bizproc" . $templateId . "_" . $parameterKey; $html = $documentService->GetFieldInputControl(array('lists', 'BizprocDocument', $documentType), $arParameter, array("Form" => "start_workflow_form1", "Field" => $parameterKeyExt), $parametersValues[$parameterKey], false, true); $this->lists['BIZPROC_FIELDS'][$parameterKeyExt . $bizprocIndex] = array("id" => $parameterKeyExt . $bizprocIndex, "required" => $arParameter["Required"], "name" => $arParameter["Name"], "title" => $arParameter["Description"], "type" => "custom", "value" => $html, 'show' => 'Y'); } } } } }