mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-37635-23' of git://github.com/damyon/moodle into MOODLE_23_STABLE
This commit is contained in:
commit
6f4c3571b8
2 changed files with 52 additions and 27 deletions
|
@ -2180,8 +2180,12 @@ class assign {
|
||||||
$this->get_instance()->id,
|
$this->get_instance()->id,
|
||||||
$user->id);
|
$user->id);
|
||||||
|
|
||||||
|
$gradingitem = null;
|
||||||
|
$gradebookgrade = '-';
|
||||||
|
if (isset($gradinginfo->items[0])) {
|
||||||
$gradingitem = $gradinginfo->items[0];
|
$gradingitem = $gradinginfo->items[0];
|
||||||
$gradebookgrade = $gradingitem->grades[$user->id];
|
$gradebookgrade = $gradingitem->grades[$user->id];
|
||||||
|
}
|
||||||
|
|
||||||
// check to see if all feedback plugins are empty
|
// check to see if all feedback plugins are empty
|
||||||
$emptyplugins = true;
|
$emptyplugins = true;
|
||||||
|
@ -2196,24 +2200,34 @@ class assign {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!($gradebookgrade->hidden) && ($gradebookgrade->grade !== null || !$emptyplugins)) {
|
$cangrade = has_capability('mod/assign:grade', $this->get_context());
|
||||||
|
// If there is feedback or a visible grade, show the summary.
|
||||||
|
if ((!empty($gradebookgrade->grade) && ($cangrade || !$gradebookgrade->hidden)) ||
|
||||||
|
!$emptyplugins) {
|
||||||
|
|
||||||
$gradefordisplay = '';
|
$gradefordisplay = null;
|
||||||
|
$gradeddate = null;
|
||||||
|
$grader = null;
|
||||||
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
|
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
|
||||||
|
|
||||||
|
// Only show the grade if it is not hidden in gradebook.
|
||||||
|
if (!empty($gradebookgrade->grade) && ($cangrade || !$gradebookgrade->hidden)) {
|
||||||
if ($controller = $gradingmanager->get_active_controller()) {
|
if ($controller = $gradingmanager->get_active_controller()) {
|
||||||
$controller->set_grade_range(make_grades_menu($this->get_instance()->grade));
|
$controller->set_grade_range(make_grades_menu($this->get_instance()->grade));
|
||||||
$gradefordisplay = $controller->render_grade($PAGE,
|
$gradefordisplay = $controller->render_grade($PAGE,
|
||||||
$grade->id,
|
$grade->id,
|
||||||
$gradingitem,
|
$gradingitem,
|
||||||
$gradebookgrade->str_long_grade,
|
$gradebookgrade->str_long_grade,
|
||||||
has_capability('mod/assign:grade', $this->get_context()));
|
$cangrade);
|
||||||
} else {
|
} else {
|
||||||
$gradefordisplay = $this->display_grade($gradebookgrade->grade, false);
|
$gradefordisplay = $this->display_grade($gradebookgrade->grade, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gradeddate = $gradebookgrade->dategraded;
|
$gradeddate = $gradebookgrade->dategraded;
|
||||||
|
if (isset($grade->grader)) {
|
||||||
$grader = $DB->get_record('user', array('id'=>$grade->grader));
|
$grader = $DB->get_record('user', array('id'=>$grade->grader));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$feedbackstatus = new assign_feedback_status($gradefordisplay,
|
$feedbackstatus = new assign_feedback_status($gradefordisplay,
|
||||||
$gradeddate,
|
$gradeddate,
|
||||||
|
@ -3093,11 +3107,20 @@ class assign {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_all_capabilities(array('gradereport/grader:view', 'moodle/grade:viewall'), $this->get_course_context())) {
|
if (has_all_capabilities(array('gradereport/grader:view', 'moodle/grade:viewall'), $this->get_course_context())) {
|
||||||
|
$usergrade = '-';
|
||||||
|
if (isset($gradinginfo->items[0]->grades[$userid]->str_grade)) {
|
||||||
|
$usergrade = $gradinginfo->items[0]->grades[$userid]->str_grade;
|
||||||
|
}
|
||||||
$gradestring = $this->output->action_link(new moodle_url('/grade/report/grader/index.php',
|
$gradestring = $this->output->action_link(new moodle_url('/grade/report/grader/index.php',
|
||||||
array('id'=>$this->get_course()->id)),
|
array('id'=>$this->get_course()->id)),
|
||||||
$gradinginfo->items[0]->grades[$userid]->str_grade);
|
$usergrade);
|
||||||
} else {
|
} else {
|
||||||
$gradestring = $gradinginfo->items[0]->grades[$userid]->str_grade;
|
$usergrade = '-';
|
||||||
|
if (isset($gradinginfo->items[0]->grades[$userid]) &&
|
||||||
|
!$grading_info->items[0]->grades[$userid]->hidden) {
|
||||||
|
$usergrade = $gradinginfo->items[0]->grades[$userid]->str_grade;
|
||||||
|
}
|
||||||
|
$gradestring = $usergrade;
|
||||||
}
|
}
|
||||||
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assign').':', $gradestring);
|
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assign').':', $gradestring);
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,7 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||||
$o .= $this->output->box_start('boxaligncenter feedbacktable');
|
$o .= $this->output->box_start('boxaligncenter feedbacktable');
|
||||||
$t = new html_table();
|
$t = new html_table();
|
||||||
|
|
||||||
|
if (isset($status->gradefordisplay)) {
|
||||||
$row = new html_table_row();
|
$row = new html_table_row();
|
||||||
$cell1 = new html_table_cell(get_string('grade'));
|
$cell1 = new html_table_cell(get_string('grade'));
|
||||||
$cell2 = new html_table_cell($status->gradefordisplay);
|
$cell2 = new html_table_cell($status->gradefordisplay);
|
||||||
|
@ -314,6 +315,7 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||||
$cell2 = new html_table_cell(userdate($status->gradeddate));
|
$cell2 = new html_table_cell(userdate($status->gradeddate));
|
||||||
$row->cells = array($cell1, $cell2);
|
$row->cells = array($cell1, $cell2);
|
||||||
$t->data[] = $row;
|
$t->data[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
if ($status->grader) {
|
if ($status->grader) {
|
||||||
$row = new html_table_row();
|
$row = new html_table_row();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue