11 public static function fillUsers(array $params = []): array
16 !isset($params[
'groupIdList'])
17 || !is_array($params[
'groupIdList'])
24 if (empty($groupIdList))
29 $scrumMasterIdList = ($params[
'scrumMasterIdList'] ?? []);
31 $query =
new Query(UserToGroupTable::getEntity());
39 'NAME' =>
'USER.NAME',
40 'LAST_NAME' =>
'USER.LAST_NAME',
41 'SECOND_NAME' =>
'USER.SECOND_NAME',
42 'LOGIN' =>
'USER.LOGIN',
43 'PERSONAL_PHOTO' =>
'USER.PERSONAL_PHOTO',
45 ->whereIn(
'GROUP_ID', $groupIdList)
47 ->exec()->fetchCollection();
50 foreach ($records as $record)
52 $user = $record->get(
'USER');
53 $imageIdList[$record->get(
'USER_ID')] = $user->get(
'PERSONAL_PHOTO');
57 $imageIdList = array_filter(
59 static function ($id) {
64 $avatars = Helper\UI\Grid\Workgroup\Members::getUserAvatars($imageIdList);
67 foreach ($members as $member)
69 $memberId = (int)$member[
'USER_ID'];
70 $groupId = (int)$member[
'GROUP_ID'];
72 $isScrumProject = isset($scrumMasterIdList[$groupId]);
76 $isScrumMaster = ($isScrumProject && $scrumMasterIdList[$groupId] === $memberId);
77 $isHead = ($isOwner || $isModerator);
79 if (!isset($membersData[$groupId]))
81 $membersData[$groupId] = [];
84 $membersData[$groupId][($isHead ?
'HEADS' :
'MEMBERS')][$memberId] = [
86 'IS_OWNER' => ($isOwner ?
'Y' :
'N'),
87 'IS_MODERATOR' => ($isModerator ?
'Y' :
'N'),
88 'IS_SCRUM_MASTER' => ($isScrumMaster ?
'Y' :
'N'),
89 'IS_AUTO_MEMBER' => $member[
'AUTO_MEMBER'],
90 'PHOTO' => ($avatars[($imageIdList[$memberId] ??
'')] ??
''),
94 foreach ($groupIdList as $groupId)
97 'HEADS' => ($membersData[$groupId][
'HEADS'] ?? []),
98 'MEMBERS' => ($membersData[$groupId][
'MEMBERS'] ?? []),