• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/form/schedule/scheduleform.php
  • Класс: BitrixTimemanFormScheduleScheduleForm
  • Вызов: ScheduleForm::fillAssignments
private function fillAssignments($assignmentsName, $userIdsName, $departmentsIdsName, $setIsForAllUsers = false)
{
	if (!is_array($this->$assignmentsName))
	{
		return;
	}
	$userIds = [];
	$departmentsIds = [];
	foreach ($this->$assignmentsName as $codeId)
	{
		if (!is_string($codeId))
		{
			continue;
		}
		if ($setIsForAllUsers && $codeId === static::ALL_USERS)
		{
			$this->isForAllUsers = true;
		}
		elseif (EntityCodesHelper::isUser($codeId))
		{
			$userIds[EntityCodesHelper::getUserId($codeId)] = true;
		}
		elseif (EntityCodesHelper::isDepartment($codeId))
		{
			$departmentsIds[EntityCodesHelper::getDepartmentId($codeId)] = true;
		}
	}
	$this->$departmentsIdsName = array_unique(array_merge($this->$departmentsIdsName, array_keys($departmentsIds)));
	$this->$userIdsName = array_unique(array_merge($this->$userIdsName, array_keys($userIds)));
}