Permalink
Browse files

Merge branch 'MDL-38061-23' of git://github.com/damyon/moodle into MO…

…ODLE_23_STABLE
  • Loading branch information...
2 parents b53e905 + 9b8afa9 commit 637611a7b3ef49497402f2074cedc0a0934784cc @danpoltawski danpoltawski committed Feb 25, 2013
Showing with 26 additions and 5 deletions.
  1. +11 −2 mod/assign/gradingtable.php
  2. +1 −1 mod/assign/locallib.php
  3. +5 −1 mod/assign/renderable.php
  4. +9 −1 mod/assign/renderer.php
@@ -88,7 +88,9 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
$params['assignmentid1'] = (int)$this->assignment->get_instance()->id;
$params['assignmentid2'] = (int)$this->assignment->get_instance()->id;
- $fields = user_picture::fields('u') . ', u.id as userid, ';
+ $extrauserfields = get_extra_user_fields($this->assignment->get_context());
+
+ $fields = user_picture::fields('u', $extrauserfields) . ', u.id as userid, ';
$fields .= 's.status as status, s.id as submissionid, s.timecreated as firstsubmission, s.timemodified as timesubmitted, ';
$fields .= 'g.id as gradeid, g.grade as grade, g.timemodified as timemarked, g.timecreated as firstmarked, g.mailed as mailed, g.locked as locked';
$from = '{user} u LEFT JOIN {assign_submission} s ON u.id = s.userid AND s.assignment = :assignmentid1' .
@@ -136,6 +138,10 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
// Fullname
$columns[] = 'fullname';
$headers[] = get_string('fullname');
+ foreach ($extrauserfields as $extrafield) {
+ $columns[] = $extrafield;
+ $headers[] = get_user_field_name($extrafield);
+ }
// Submission status
if ($assignment->is_any_submission_plugin_enabled()) {
@@ -194,6 +200,9 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
// set the columns
$this->define_columns($columns);
$this->define_headers($headers);
+ foreach ($extrauserfields as $extrafield) {
+ $this->column_class($extrafield, $extrafield);
+ }
// We require at least one unique column for the sort.
$this->sortable(true, 'userid');
$this->no_sorting('finalgrade');
@@ -610,7 +619,7 @@ function other_cols($colname, $row){
}
return '';
}
- return NULL;
+ return $row->$colname;
}
/**
View
@@ -1769,7 +1769,7 @@ private function view_single_grade_page($mform, $offset=0) {
}
$user = $DB->get_record('user', array('id' => $userid));
if ($user) {
- $o .= $this->output->render(new assign_user_summary($user, $this->get_course()->id, has_capability('moodle/site:viewfullnames', $this->get_course_context())));
+ $o .= $this->output->render(new assign_user_summary($user, $this->get_course()->id, has_capability('moodle/site:viewfullnames', $this->get_course_context()), get_extra_user_fields($this->get_context())));
}
$submission = $this->get_user_submission($userid, false);
// get the current grade
@@ -113,17 +113,21 @@ class assign_user_summary implements renderable {
public $courseid;
/** @var bool $viewfullnames */
public $viewfullnames = false;
+ /** @var array $extrauserfields */
+ public $extrauserfields;
/**
* Constructor
* @param stdClass $user
* @param int $courseid
* @param bool $viewfullnames
+ * @param array $extrauserfield
*/
- public function __construct(stdClass $user, $courseid, $viewfullnames) {
+ public function __construct(stdClass $user, $courseid, $viewfullnames, $extrauserfields) {
$this->user = $user;
$this->courseid = $courseid;
$this->viewfullnames = $viewfullnames;
+ $this->extrauserfields = $extrauserfields;
}
}
View
@@ -133,10 +133,18 @@ public function render_assign_user_summary(assign_user_summary $summary) {
$o .= $this->output->box_start('boxaligncenter usersummarysection');
$o .= $this->output->user_picture($summary->user);
$o .= $this->output->spacer(array('width'=>30));
+ $fullname = fullname($summary->user, $summary->viewfullnames);
+ $extrainfo = array();
+ foreach ($summary->extrauserfields as $extrafield) {
+ $extrainfo[] = $summary->user->$extrafield;
+ }
+ if (count($extrainfo)) {
+ $fullname .= ' (' . implode(', ', $extrainfo) . ')';
+ }
$o .= $this->output->action_link(new moodle_url('/user/view.php',
array('id' => $summary->user->id,
'course'=>$summary->courseid)),
- fullname($summary->user, $summary->viewfullnames));
+ $fullname);
$o .= $this->output->box_end();
$o .= $this->output->container_end();

0 comments on commit 637611a

Please sign in to comment.