Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/activities/bitrix/terminateactivity/ |
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/activities/bitrix/terminateactivity/terminateactivity.php |
<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die(); class CBPTerminateActivity extends CBPActivity { public function __construct($name) { parent::__construct($name); $this->arProperties = array('Title' => '', 'StateTitle' => ''); } public function Execute() { $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); CBPDocument::TerminateWorkflow( $this->GetWorkflowInstanceId(), $documentId, $arErrorsTmp, (string) $this->StateTitle ); throw new Exception("TerminateActivity"); return CBPActivityExecutionStatus::Closed; } public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); } public static function GetPropertiesDialog($documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = "") { $runtime = CBPRuntime::GetRuntime(); if (!is_array($arWorkflowParameters)) $arWorkflowParameters = array(); if (!is_array($arWorkflowVariables)) $arWorkflowVariables = array(); if (!is_array($arCurrentValues)) { $arCurrentValues = array("state_title" => ''); $arCurrentActivity = &CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName); if (is_array($arCurrentActivity["Properties"])) { $arCurrentValues["state_title"] = $arCurrentActivity["Properties"]["StateTitle"]; } } if (empty($arCurrentValues["state_title"])) $arCurrentValues["state_title"] = GetMessage('BPTA1_STATE_TITLE'); return $runtime->ExecuteResourceFile( __FILE__, "properties_dialog.php", array( "arCurrentValues" => $arCurrentValues, "formName" => $formName, ) ); } public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors) { $arErrors = array(); $runtime = CBPRuntime::GetRuntime(); $arProperties = array( "StateTitle" => $arCurrentValues["state_title"] ); $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser)); if (count($arErrors) > 0) return false; $arCurrentActivity = &CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName); $arCurrentActivity["Properties"] = $arProperties; return true; } } ?>