/** * Retrieve the recipient list for all ugroup_id * * @return Array */ private function getRecipientsFromUgroups() { $recipients = array(); $uGroupManager = new UGroupManager(); $ugroups = $this->getUgroups(true); foreach ($ugroups as $ugroupId) { if ($ugroupId < 100) { $members = $uGroupManager->getDynamicUGroupsMembers($ugroupId, $this->getTracker()->getGroupId()); } else { $uGroup = $uGroupManager->getById($ugroupId); $members = $uGroup->getMembers(); } foreach ($members as $user) { $recipients[$user->getId()] = $user; } } return $recipients; }
/** * Retrieve the recipient list for all ugroup_id's * * @return Array */ public function getRecipients() { $recipients = array(); $uGroupManager = new UGroupManager(); $um = UserManager::instance(); $ugroups = $this->getUgroups(true); foreach ($ugroups as $ugroupId) { if ($ugroupId < 100) { $members = $uGroupManager->getDynamicUGroupsMembers($ugroupId, $this->getTracker()->getGroupId()); if ($members && !$members->isError()) { foreach ($members as $member) { $user = $um->getUserById($member['user_id']); $recipients[$user->getId()] = $user; } } } else { $uGroup = $uGroupManager->getById($ugroupId); $members = $uGroup->getMembers(); foreach ($members as $user) { $recipients[$user->getId()] = $user; } } } return $recipients; }