CBPRestActivity::getPropertiesDialog

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPRestActivity
  4. getPropertiesDialog
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/restactivity.php
  • Класс: CBPRestActivity
  • Вызов: CBPRestActivity::getPropertiesDialog
static function getPropertiesDialog(
	$documentType,
	$activityName,
	$workflowTemplate,
	$workflowParameters,
	$workflowVariables,
	$currentValues = null,
	$formName = ""
)
{
	if (!Loader::includeModule('rest'))
	{
		return false;
	}

	$activityData = self::getRestActivityData();

	$dbRes = BitrixRestAppTable::getList([
		'select' => ['ID'],
		'filter' => [
			'=CLIENT_ID' => $activityData['APP_ID'],
		],
	]);
	$application = $dbRes->fetch();

	if ($application)
	{
		$activityData['APP_ID_INT'] = $application['ID'];
	}

	$dialog = new BitrixBizprocActivityPropertiesDialog(__FILE__, [
		'documentType' => $documentType,
		'activityName' => $activityName,
		'workflowTemplate' => $workflowTemplate,
		'workflowParameters' => $workflowParameters,
		'workflowVariables' => $workflowVariables,
		'currentValues' => $currentValues,
		'formName' => $formName,
	]);

	$map = [
		'AuthUserId' => [
			'Name' => Loc::getMessage("BPRA_PD_USER_ID"),
			'FieldName' => 'authuserid',
			'Type' => 'user',
			'Default' => 'user_' . $activityData['AUTH_USER_ID'],
		],
		'SetStatusMessage' => [
			'Name' => 'SetStatusMessage',
			'FieldName' => 'setstatusmessage',
			'Type' => 'bool',
		],
		'StatusMessage' => [
			'Name' => 'StatusMessage',
			'FieldName' => 'statusmessage',
			'Type' => 'text',
			'Default' => Loc::getMessage('BPRA_DEFAULT_STATUS_MESSAGE'),
		],
		'UseSubscription' => [
			'Name' => 'StatusMessage',
			'FieldName' => 'usesubscription',
			'Type' => 'bool',
			'Default' => $activityData['USE_SUBSCRIPTION'],
		],
		'TimeoutDuration' => [
			'Name' => 'StatusMessage',
			'FieldName' => 'timeoutduration',
			'Type' => 'int',
		],
		'TimeoutDurationType' => [
			'Name' => 'StatusMessage',
			'FieldName' => 'timeoutdurationtype',
			'Type' => 'string',
			'Default' => 's',
		],
	];

	$properties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : [];
	foreach ($properties as $name => $property)
	{
		if (!array_key_exists($name, $map))
		{
			$map[$name] = [
				'Name' => RestActivityTable::getLocalization($property['NAME'], LANGUAGE_ID),
				'Description' => RestActivityTable::getLocalization($property['DESCRIPTION'] ?? '', LANGUAGE_ID),
				'FieldName' => static::PROPERTY_NAME_PREFIX . mb_strtolower($name),
				'Type' => $property['TYPE'] ?? 'string',
				'Required' => $property['REQUIRED'] ?? false,
				'Multiple' => $property['MULTIPLE'] ?? false,
				'Default' => $property['DEFAULT'] ?? null,
				'Options' => $property['OPTIONS'] ?? null,
			];
		}
	}

	$appPlacement = null;
	if (!empty($activityData['APP_ID_INT']))
	{
		$appPlacement = self::getAppPlacement($activityData['APP_ID_INT'], $activityData['CODE']);
	}

	$dialog
		->setMap($map)
		->setRuntimeData([
			'ACTIVITY_DATA' => $activityData,
			'IS_ADMIN' => static::checkAdminPermissions(),
			'APP_PLACEMENT' => $appPlacement,
		])
		->setRenderer([__CLASS__, 'renderPropertiesDialog']);

	return $dialog;
}

Добавить комментарий