Merge branch 'MDL-59367-master' of git://github.com/damyon/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 25 Jul 2017 07:02:55 +0000 (15:02 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 25 Jul 2017 07:02:55 +0000 (15:02 +0800)
1  2 
user/classes/participants_table.php
user/lib.php

@@@ -201,9 -221,34 +216,34 @@@ class participants_table extends \table
      public function col_fullname($data) {
          global $OUTPUT;
  
 -        return $OUTPUT->user_picture($data, array('size' => 35, 'courseid' => $this->course->id)) . ' ' . fullname($data);
 +        return $OUTPUT->user_picture($data, array('size' => 35, 'courseid' => $this->course->id, 'includefullname' => true));
      }
  
+     /**
+      * User roles column.
+      *
+      * @param \stdClass $data
+      * @return string
+      */
+     public function col_roles($data) {
+         global $OUTPUT;
+         $roles = get_user_roles($this->context, $data->id, true, 'c.contextlevel DESC, r.sortorder ASC');
+         $getrole = function($role) {
+             return $role->roleid;
+         };
+         $ids = array_values(array_unique(array_map($getrole, $roles)));
+         $editable = new \core_user\output\user_roles_editable($this->course,
+                                                               $this->context,
+                                                               $data,
+                                                               $this->allroles,
+                                                               $this->assignableroles,
+                                                               $ids);
+         return $OUTPUT->render_from_template('core/inplace_editable', $editable->export_for_template($OUTPUT));
+     }
      /**
       * Generate the groups column.
       *
diff --cc user/lib.php
Simple merge