- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/lib/automation/component/base.php
- Класс: BitrixBizprocAutomationComponentBase
- Вызов: Base::getRobotViewData
static function getRobotViewData($robot, array $documentType): array
{
$availableRobots = BitrixBizprocAutomationEngineTemplate::getAvailableRobots($documentType);
$result = [
'responsibleLabel' => '',
'responsibleUrl' => '',
'responsibleId' => 0,
];
$type = mb_strtolower($robot['Type']);
if (isset($availableRobots[$type]) && isset($availableRobots[$type]['ROBOT_SETTINGS']))
{
$settings = $availableRobots[$type]['ROBOT_SETTINGS'];
if (!empty($settings['RESPONSIBLE_TO_HEAD']) && $robot['Properties'][$settings['RESPONSIBLE_TO_HEAD']] === 'Y')
{
$result['responsibleLabel'] = Loc::getMessage('BIZPROC_AUTOMATION_COMPONENT_BASE_TO_HEAD');
}
if (isset($settings['RESPONSIBLE_PROPERTY']))
{
$users = static::getUsersFromResponsibleProperty($robot, $settings['RESPONSIBLE_PROPERTY']);
$usersLabel = CBPHelper::UsersArrayToString($users, [], $documentType, false);
if ($result['responsibleLabel'] && $usersLabel)
{
$result['responsibleLabel'] .= ', ';
}
$result['responsibleLabel'] .= $usersLabel;
if ($users && count($users) === 1 && $users[0] && mb_strpos($users[0], 'user_') === 0)
{
$id = (int) CBPHelper::StripUserPrefix($users[0]);
$result['responsibleUrl'] = CComponentEngine::MakePathFromTemplate(
'/company/personal/user/#user_id#/',
array('user_id' => $id)
);
$result['responsibleId'] = $id;
}
}
}
return $result;
}