MDL-20307 - add view fullname capabilities to display fullname in gradebook and participant list

This commit is contained in:
Rossiani Wijaya
2010-02-04 04:37:31 +00:00
parent df9fe21b58
commit edef4cd2e1
4 changed files with 24 additions and 15 deletions
+9 -8
View File
@@ -657,7 +657,7 @@ class grade_report_grader extends grade_report {
$hidden = ' hidden ';
}
$headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
$headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
//MDL-21088 - IE 7 ignores nowraps on tds or ths so we this in a span with a nowrap on it.
$headerhtml .= '<th class=" '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex)"><span>'
.shorten_text($headerlink) . $arrow;
@@ -687,6 +687,7 @@ class grade_report_grader extends grade_report {
$showuserimage = $this->get_pref('showuserimage');
$showuseridnumber = $this->get_pref('showuseridnumber');
$fixedstudents = $this->is_fixed_students();
$canviewfullname = has_capability('moodle/site:viewfullnames', $this->context);
// Preload scale objects for items with a scaleid
$scales_list = '';
@@ -736,19 +737,18 @@ class grade_report_grader extends grade_report {
$userreportcell = '';
$userreportcellcolspan = '';
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
$a->user = fullname($user);
$a->user = fullname($user, $canviewfullname);
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
$userreportcell = '<th class="header userreport"><a href="'.$CFG->wwwroot.'/grade/report/'.$CFG->grade_profilereport.'/index.php?id='.$this->courseid.'&amp;userid='.$user->id.'">'
.'<img src="'.$CFG->pixpath.'/t/grades.gif" alt="'.$strgradesforuser.'" title="'.$strgradesforuser.'" /></a></th>';
}
else {
} else {
$userreportcellcolspan = 'colspan=2';
}
$studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
.'<th class="c'.$columncount++.' user" scope="row" onclick="set_row(this.parentNode.rowIndex);" '.$userreportcellcolspan.' >'.$user_pic
.'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->course->id.'">'
.fullname($user)."</a></th>$userreportcell\n";
.fullname($user, $canviewfullname)."</a></th>$userreportcell\n";
if ($showuseridnumber) {
$studentshtml .= '<th class="c'.$columncount++.' useridnumber" onclick="set_row(this.parentNode.rowIndex);">'.
@@ -944,7 +944,8 @@ class grade_report_grader extends grade_report {
$strsortdesc = $this->get_lang_string('sortdesc', 'grades');
$strfirstname = $this->get_lang_string('firstname');
$strlastname = $this->get_lang_string('lastname');
$canviewfullname = has_capability('moodle/site:viewfullnames', $this->context);
if ($this->sortitemid === 'lastname') {
if ($this->sortorder == 'ASC') {
$lastarrow = print_arrow('up', $strsortasc, true);
@@ -1023,7 +1024,7 @@ class grade_report_grader extends grade_report {
$userreportcell = '';
$userreportcellcolspan = '';
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
$a->user = fullname($user);
$a->user = fullname($user, $canviewfullname);
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
$userreportcell = '<th class="userreport"><a href="'.$CFG->wwwroot.'/grade/report/'.$CFG->grade_profilereport.'/index.php?id='.$this->courseid.'&amp;userid='.$user->id.'">'
.'<img src="'.$CFG->pixpath.'/t/grades.gif" alt="'.$strgradesforuser.'" title="'.$strgradesforuser.'" /></a></th>';
@@ -1035,7 +1036,7 @@ class grade_report_grader extends grade_report {
$studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
.'<th class="c0 user" scope="row" onclick="set_row(this.parentNode.rowIndex);" '.$userreportcellcolspan.' >'.$user_pic
.'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->course->id.'">'
.fullname($user)."</a></th>$userreportcell\n";
.fullname($user, $canviewfullname)."</a></th>$userreportcell\n";
if ($showuseridnumber) {
$studentshtml .= '<th class="c0 useridnumber" onclick="set_row(this.parentNode.rowIndex);">'. $user->idnumber."</th>\n";
+1 -1
View File
@@ -1300,7 +1300,7 @@ class assignment_base {
}
}
$userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser) . '</a>';
$userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $this->context)) . '</a>';
$row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
if ($uses_outcomes) {
$row[] = $outcomes;
+2 -2
View File
@@ -466,10 +466,10 @@ class quiz_report extends quiz_default_report {
}
if (!$download){
$userlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$attempt->userid.
'&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
'&amp;course='.$course->id.'">'.fullname($attempt,has_capability('moodle/site:viewfullnames', $context)).'</a>';
$row[] = $userlink;
} else {
$row[] = fullname($attempt);
$row[] = fullname($attempt, has_capability('moodle/site:viewfullnames', $context));
}
if (in_array('idnumber', $columns)){
+12 -4
View File
@@ -679,7 +679,7 @@
if ($userlist) {
$usersprinted = array();
$usersprinted = array();
while ($user = rs_fetch_next_record($userlist)) {
if (in_array($user->id, $usersprinted)) { /// Prevent duplicates by r.hidden - MDL-13935
continue;
@@ -717,11 +717,19 @@
} else {
$usercontext = $user->context;
}
$contextcanviewdetails = has_capability('moodle/user:viewdetails', $context);
$usercontextcanviewdetails = has_capability('moodle/user:viewdetails', $usercontext);
if ($piclink = ($USER->id == $user->id || has_capability('moodle/user:viewdetails', $context) || has_capability('moodle/user:viewdetails', $usercontext))) {
$profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.fullname($user).'</a></strong>';
if ($piclink = ($USER->id == $user->id || $contextcanviewdetails || $usercontextcanviewdetails)) {
if ($usercontextcanviewdetails) {
$canviewfullname = has_capability('moodle/site:viewfullnames', $usercontext);
} else {
$canviewfullname = has_capability('moodle/site:viewfullnames', $context);
}
$profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.fullname($user, $canviewfullname).'</a></strong>';
} else {
$profilelink = '<strong>'.fullname($user).'</strong>';
$profilelink = '<strong>'.fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</strong>';
}
$data = array (