Skip to content

Commit

Permalink
Grupos: Add emails in export - refs BT#20475
Browse files Browse the repository at this point in the history
  • Loading branch information
cfasanando committed Jan 10, 2023
1 parent 2efeb86 commit c321b1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main/inc/lib/groupmanager.lib.php
Expand Up @@ -2789,6 +2789,7 @@ public static function exportCategoriesAndGroupsToArray($groupId = null, $loadUs
if ($loadUsers) {
$data[0][] = 'students';
$data[0][] = 'tutors';
$data[0][] = 'emails';
}

if (false == $loadUsers) {
Expand Down Expand Up @@ -2827,16 +2828,19 @@ public static function exportCategoriesAndGroupsToArray($groupId = null, $loadUs

$users = self::getStudents($groupInfo['iid']);
$userList = [];
$emailList = [];
foreach ($users as $user) {
$user = api_get_user_info($user['user_id']);
$userList[] = $user['username'];
$emailList[] = $user['email'];
}

$tutors = self::getTutors($groupInfo);
$tutorList = [];
foreach ($tutors as $user) {
$user = api_get_user_info($user['user_id']);
$tutorList[] = $user['username'];
$emailList[] = $user['email'];
}

$userListToString = null;
Expand Down Expand Up @@ -2869,6 +2873,9 @@ public static function exportCategoriesAndGroupsToArray($groupId = null, $loadUs
if ($loadUsers) {
$data[$count][] = $userListToString;
$data[$count][] = $tutorListToString;
if (!empty($emailList)) {
$data[$count][] = implode(',', $emailList);
}
}

if (!empty($groupId)) {
Expand Down

0 comments on commit c321b1a

Please sign in to comment.