MDL-76603 mod_assign: Move advanced grading grades out of the tables

This commit is contained in:
Shamim Rezaie 2023-02-09 23:01:14 +11:00 committed by Jun Pataleta
parent 74b103b218
commit 48b7dc597b
4 changed files with 39 additions and 22 deletions

View file

@ -448,6 +448,11 @@ class renderer extends \plugin_renderer_base {
$o .= \html_writer::table($t); $o .= \html_writer::table($t);
$o .= $this->output->box_end(); $o .= $this->output->box_end();
if (!empty($status->gradingcontrollergrade)) {
$o .= $this->output->heading(get_string('gradebreakdown', 'assign'), 4);
$o .= $status->gradingcontrollergrade;
}
$o .= $this->output->container_end(); $o .= $this->output->container_end();
return $o; return $o;
} }
@ -813,13 +818,6 @@ class renderer extends \plugin_renderer_base {
$this->add_table_row_tuple($t, $cell1content, $cell2content, [], $cell2attributes); $this->add_table_row_tuple($t, $cell1content, $cell2content, [], $cell2attributes);
} }
// Grading criteria preview.
if (!empty($status->gradingcontrollerpreview)) {
$cell1content = get_string('gradingmethodpreview', 'assign');
$cell2content = $status->gradingcontrollerpreview;
$this->add_table_row_tuple($t, $cell1content, $cell2content, [], []);
}
// Last modified. // Last modified.
if ($submission) { if ($submission) {
$cell1content = get_string('timemodified', 'assign'); $cell1content = get_string('timemodified', 'assign');
@ -860,6 +858,12 @@ class renderer extends \plugin_renderer_base {
$o .= \html_writer::table($t); $o .= \html_writer::table($t);
$o .= $this->output->box_end(); $o .= $this->output->box_end();
// Grading criteria preview.
if (!empty($status->gradingcontrollerpreview)) {
$o .= $this->output->heading(get_string('gradingmethodpreview', 'assign'), 4);
$o .= $status->gradingcontrollerpreview;
}
$o .= $this->output->container_end(); $o .= $this->output->container_end();
return $o; return $o;
} }

View file

@ -284,6 +284,7 @@ $string['gradedby'] = 'Graded by';
$string['gradedfollowupsubmit'] = 'Graded - follow-up submission received'; $string['gradedfollowupsubmit'] = 'Graded - follow-up submission received';
$string['gradedon'] = 'Graded on'; $string['gradedon'] = 'Graded on';
$string['gradebelowzero'] = 'Grade must be greater than or equal to zero.'; $string['gradebelowzero'] = 'Grade must be greater than or equal to zero.';
$string['gradebreakdown'] = 'Grade breakdown';
$string['gradeabovemaximum'] = 'Grade must be less than or equal to {$a}.'; $string['gradeabovemaximum'] = 'Grade must be less than or equal to {$a}.';
$string['gradelocked'] = 'This grade is locked or overridden in the gradebook.'; $string['gradelocked'] = 'This grade is locked or overridden in the gradebook.';
$string['gradeoutof'] = 'Grade out of {$a}'; $string['gradeoutof'] = 'Grade out of {$a}';

View file

@ -5440,15 +5440,19 @@ class assign {
$grader = null; $grader = null;
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions'); $gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
$gradingcontrollergrade = '';
if ($hasgrade) { if ($hasgrade) {
if ($controller = $gradingmanager->get_active_controller()) { if ($controller = $gradingmanager->get_active_controller()) {
$menu = make_grades_menu($this->get_instance()->grade); $menu = make_grades_menu($this->get_instance()->grade);
$controller->set_grade_range($menu, $this->get_instance()->grade > 0); $controller->set_grade_range($menu, $this->get_instance()->grade > 0);
$gradefordisplay = $controller->render_grade($PAGE, $gradingcontrollergrade = $controller->render_grade(
$grade->id, $PAGE,
$gradingitem, $grade->id,
$gradebookgrade->str_long_grade, $gradingitem,
$cangrade); '',
$cangrade
);
$gradefordisplay = $gradebookgrade->str_long_grade;
} else { } else {
$gradefordisplay = $this->display_grade($gradebookgrade->grade, false); $gradefordisplay = $this->display_grade($gradebookgrade->grade, false);
} }
@ -5475,15 +5479,18 @@ class assign {
if ($grade) { if ($grade) {
\mod_assign\event\feedback_viewed::create_from_grade($this, $grade)->trigger(); \mod_assign\event\feedback_viewed::create_from_grade($this, $grade)->trigger();
} }
$feedbackstatus = new assign_feedback_status($gradefordisplay, $feedbackstatus = new assign_feedback_status(
$gradeddate, $gradefordisplay,
$grader, $gradeddate,
$this->get_feedback_plugins(), $grader,
$grade, $this->get_feedback_plugins(),
$this->get_course_module()->id, $grade,
$this->get_return_action(), $this->get_course_module()->id,
$this->get_return_params(), $this->get_return_action(),
$viewfullnames); $this->get_return_params(),
$viewfullnames,
$gradingcontrollergrade
);
// Show the grader's identity if 'Hide Grader' is disabled or has the 'Show Hidden Grader' capability. // Show the grader's identity if 'Hide Grader' is disabled or has the 'Show Hidden Grader' capability.
$showgradername = ( $showgradername = (

View file

@ -291,6 +291,8 @@ class assign_feedback_status implements renderable {
public $returnparams = array(); public $returnparams = array();
/** @var bool canviewfullnames */ /** @var bool canviewfullnames */
public $canviewfullnames = false; public $canviewfullnames = false;
/** @var string gradingcontrollergrade The grade information rendered by a grade controller */
public $gradingcontrollergrade;
/** /**
* Constructor * Constructor
@ -303,6 +305,7 @@ class assign_feedback_status implements renderable {
* @param string $returnaction The action required to return to this page * @param string $returnaction The action required to return to this page
* @param array $returnparams The list of params required to return to this page * @param array $returnparams The list of params required to return to this page
* @param bool $canviewfullnames * @param bool $canviewfullnames
* @param string $gradingcontrollergrade The grade information rendered by a grade controller
*/ */
public function __construct($gradefordisplay, public function __construct($gradefordisplay,
$gradeddate, $gradeddate,
@ -312,7 +315,8 @@ class assign_feedback_status implements renderable {
$coursemoduleid, $coursemoduleid,
$returnaction, $returnaction,
$returnparams, $returnparams,
$canviewfullnames) { $canviewfullnames,
$gradingcontrollergrade = '') {
$this->gradefordisplay = $gradefordisplay; $this->gradefordisplay = $gradefordisplay;
$this->gradeddate = $gradeddate; $this->gradeddate = $gradeddate;
$this->grader = $grader; $this->grader = $grader;
@ -322,6 +326,7 @@ class assign_feedback_status implements renderable {
$this->returnaction = $returnaction; $this->returnaction = $returnaction;
$this->returnparams = $returnparams; $this->returnparams = $returnparams;
$this->canviewfullnames = $canviewfullnames; $this->canviewfullnames = $canviewfullnames;
$this->gradingcontrollergrade = $gradingcontrollergrade;
} }
} }