From b5bde93866e4e162151c17366c5f3b6bed4328c8 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 9 Dec 2013 21:55:25 +1300 Subject: [PATCH] add field to export that lists groups that a user is a member of. --- export.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/export.php b/export.php index 215191a..19f9619 100644 --- a/export.php +++ b/export.php @@ -90,6 +90,9 @@ if ($mform->is_submitted()) { } $data->tabhead[] = get_string('lastname'); $data->tabhead[] = get_string('firstname'); + if (!empty($cm->groupmode)) { + $data->tabhead[] = get_string('groups'); + } if (count($reportdata->sessions) > 0) { @@ -120,6 +123,15 @@ if ($mform->is_submitted()) { } $data->table[$i][] = $user->lastname; $data->table[$i][] = $user->firstname; + if (!empty($cm->groupmode)) { + $grouptext = ''; + $groupsraw = groups_get_all_groups($course->id, $user->id, 0, 'g.name'); + $groups = array(); + foreach ($groupsraw as $group) { + $groups[] = $group->name;; + } + $data->table[$i][] = implode(', ', $groups); + } $cellsgenerator = new user_sessions_cells_text_generator($reportdata, $user); $data->table[$i] = array_merge($data->table[$i], $cellsgenerator->get_cells(isset($formdata->includeremarks))); if ($reportdata->gradable) {