Skip to content

Commit

Permalink
MDL-76603 mod_assign: Move advanced grading grades out of the tables
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies authored and junpataleta committed Mar 10, 2023
1 parent 74b103b commit 48b7dc5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
18 changes: 11 additions & 7 deletions mod/assign/classes/output/renderer.php
Expand Up @@ -448,6 +448,11 @@ public function render_assign_feedback_status(\assign_feedback_status $status) {
$o .= \html_writer::table($t);
$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();
return $o;
}
Expand Down Expand Up @@ -813,13 +818,6 @@ public function render_assign_submission_status(assign_submission_status $status
$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.
if ($submission) {
$cell1content = get_string('timemodified', 'assign');
Expand Down Expand Up @@ -860,6 +858,12 @@ public function render_assign_submission_status(assign_submission_status $status
$o .= \html_writer::table($t);
$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();
return $o;
}
Expand Down
1 change: 1 addition & 0 deletions mod/assign/lang/en/assign.php
Expand Up @@ -284,6 +284,7 @@
$string['gradedfollowupsubmit'] = 'Graded - follow-up submission received';
$string['gradedon'] = 'Graded on';
$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['gradelocked'] = 'This grade is locked or overridden in the gradebook.';
$string['gradeoutof'] = 'Grade out of {$a}';
Expand Down
35 changes: 21 additions & 14 deletions mod/assign/locallib.php
Expand Up @@ -5440,15 +5440,19 @@ public function get_assign_feedback_status_renderable($user) {
$grader = null;
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');

$gradingcontrollergrade = '';
if ($hasgrade) {
if ($controller = $gradingmanager->get_active_controller()) {
$menu = make_grades_menu($this->get_instance()->grade);
$controller->set_grade_range($menu, $this->get_instance()->grade > 0);
$gradefordisplay = $controller->render_grade($PAGE,
$grade->id,
$gradingitem,
$gradebookgrade->str_long_grade,
$cangrade);
$gradingcontrollergrade = $controller->render_grade(
$PAGE,
$grade->id,
$gradingitem,
'',
$cangrade
);
$gradefordisplay = $gradebookgrade->str_long_grade;
} else {
$gradefordisplay = $this->display_grade($gradebookgrade->grade, false);
}
Expand All @@ -5475,15 +5479,18 @@ public function get_assign_feedback_status_renderable($user) {
if ($grade) {
\mod_assign\event\feedback_viewed::create_from_grade($this, $grade)->trigger();
}
$feedbackstatus = new assign_feedback_status($gradefordisplay,
$gradeddate,
$grader,
$this->get_feedback_plugins(),
$grade,
$this->get_course_module()->id,
$this->get_return_action(),
$this->get_return_params(),
$viewfullnames);
$feedbackstatus = new assign_feedback_status(
$gradefordisplay,
$gradeddate,
$grader,
$this->get_feedback_plugins(),
$grade,
$this->get_course_module()->id,
$this->get_return_action(),
$this->get_return_params(),
$viewfullnames,
$gradingcontrollergrade
);

// Show the grader's identity if 'Hide Grader' is disabled or has the 'Show Hidden Grader' capability.
$showgradername = (
Expand Down
7 changes: 6 additions & 1 deletion mod/assign/renderable.php
Expand Up @@ -291,6 +291,8 @@ class assign_feedback_status implements renderable {
public $returnparams = array();
/** @var bool canviewfullnames */
public $canviewfullnames = false;
/** @var string gradingcontrollergrade The grade information rendered by a grade controller */
public $gradingcontrollergrade;

/**
* Constructor
Expand All @@ -303,6 +305,7 @@ class assign_feedback_status implements renderable {
* @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 bool $canviewfullnames
* @param string $gradingcontrollergrade The grade information rendered by a grade controller
*/
public function __construct($gradefordisplay,
$gradeddate,
Expand All @@ -312,7 +315,8 @@ public function __construct($gradefordisplay,
$coursemoduleid,
$returnaction,
$returnparams,
$canviewfullnames) {
$canviewfullnames,
$gradingcontrollergrade = '') {
$this->gradefordisplay = $gradefordisplay;
$this->gradeddate = $gradeddate;
$this->grader = $grader;
Expand All @@ -322,6 +326,7 @@ public function __construct($gradefordisplay,
$this->returnaction = $returnaction;
$this->returnparams = $returnparams;
$this->canviewfullnames = $canviewfullnames;
$this->gradingcontrollergrade = $gradingcontrollergrade;
}
}

Expand Down

0 comments on commit 48b7dc5

Please sign in to comment.