- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/lib/util.php
- Класс: BitrixCalendarUtil
- Вызов: Util::convertCodesToEntities
static function convertCodesToEntities($codeList = [])
{
$entityList = [];
if (is_array($codeList))
{
foreach($codeList as $code)
{
if ($code === 'UA')
{
$entityList[] = [
'entityId' => 'meta-user',
'id' => 'all-users'
];
}
elseif (mb_substr($code, 0, 1) == 'U')
{
$entityList[] = [
'entityId' => 'user',
'id' => intval(mb_substr($code, 1))
];
}
if (mb_substr($code, 0, 2) == 'DR')
{
$entityList[] = [
'entityId' => 'department',
'id' => intval(mb_substr($code, 2))
];
}
elseif (preg_match('/^SG([0-9]+)_?([AEKMO])?$/', $code, $match) && isset($match[2]))
{
// todo May need to be removed/rewrite after creating new roles in projects.
$entityList[] = [
'entityId' => 'project-roles',
'id' => mb_substr($code, 2)
];
}
elseif (mb_substr($code, 0, 2) == 'SG')
{
$entityList[] = [
'entityId' => 'project',
'id' => intval(mb_substr($code, 2))
];
}
}
}
return $entityList;
}