Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-61290_master' of https://github.com/aanabit/moodle
  • Loading branch information
David Monllao committed Jul 31, 2018
2 parents f967e67 + 4a6cd05 commit 77f9983
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions mod/feedback/classes/responses_table.php
Expand Up @@ -113,8 +113,12 @@ public function __construct(mod_feedback_structure $feedbackstructure, $group =
*/
protected function init($group = 0) {

$tablecolumns = array('userpic', 'fullname');
$tableheaders = array(get_string('userpic'), get_string('fullnameuser'));
$tablecolumns = array('userpic', 'fullname', 'groups');
$tableheaders = array(
get_string('userpic'),
get_string('fullnameuser'),
get_string('groups')
);

$extrafields = get_extra_user_fields($this->get_context());
$ufields = user_picture::fields('u', $extrafields, $this->useridfield);
Expand Down Expand Up @@ -258,6 +262,21 @@ public function col_courseid($row) {
return $name;
}

/**
* Prepares column groups for display
* @param array $row
* @return string
*/
public function col_groups($row) {
$groups = '';
if ($usergrps = groups_get_all_groups($this->feedbackstructure->get_cm()->course, $row->userid, 0, 'name')) {
foreach ($usergrps as $group) {
$groups .= format_string($group->name). ' ';
}
}
return trim($groups);
}

/**
* Adds common values to the table that do not change the number or order of entries and
* are only needed when outputting or downloading data.
Expand Down

0 comments on commit 77f9983

Please sign in to comment.