MDL-76150 gradereport_grader: Display category name cell like 2 columns

This commit is contained in:
Shamim Rezaie
2023-04-05 11:25:15 +01:00
committed by Paul Holden
parent 21aee2b968
commit 880a67aba1
2 changed files with 48 additions and 5 deletions
+6 -5
View File
@@ -808,16 +808,20 @@ class grade_report_grader extends grade_report {
$categorycell = new html_table_cell();
$categorycell->attributes['class'] = 'category ' . $catlevel;
$categorycell->colspan = $colspan;
$categorycell->text = $this->get_course_header($element);
$categorycell->header = true;
$categorycell->scope = 'col';
$statusicons = $this->gtree->set_grade_status_icons($element);
if ($statusicons) {
$categorycell->text .= $statusicons;
$categorycell->attributes['class'] .= ' statusicons';
}
$context = new stdClass();
$context->courseheader = $this->get_course_header($element);
$context->actionmenu = $this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr);
$context->statusicons = $statusicons;
$categorycell->text = $OUTPUT->render_from_template('gradereport_grader/categorycell', $context);
$headingrow->cells[] = $categorycell;
}
} else {
@@ -1541,8 +1545,6 @@ class grade_report_grader extends grade_report {
* @return string HTML
*/
protected function get_course_header($element) {
$actionmenu = $this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr);
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
$showing = get_string('showingaggregatesonly', 'grades');
} else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
@@ -1562,7 +1564,6 @@ class grade_report_grader extends grade_report {
$courseheader .= html_writer::div($showing, 'sr-only', [
'id' => $describedbyid
]);
$courseheader .= $actionmenu;
return $courseheader;
}
@@ -0,0 +1,42 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template gradereport_grader/headercell
Header cell template
Example context (json):
{
"headerlink": "<a class='gradeitemheader' href='index.php?id=2&amp;sortitemid=2'><img class='icon itemicon' src='http://moodlesite/theme/image.php/boost/assign/1680563323/monologo' alt='Assignment' />Assignment 1</a>",
"arrow": "<a title='Descending' aria-label='Descending' href='index.php?id=2&amp;sortitemid=2'><i class='icon fa fa-sort-desc fa-fw sorticon' aria-hidden='true' ></i></a>",
"singleview": "<div class='action-menu moodle-actionmenu grader' id='action-menu-8' data-enhance='moodle-core-actionmenu'></div>",
"statusicons": "<div class='grade_icons'><i class='icon fa fa-lock fa-fw text-muted' title='Locked' role='img' aria-label='Locked'></i></div>"
}
}}
<div class="d-flex flex-column h-100">
<div class="d-flex">
<div>
{{{courseheader}}}
</div>
<div>
{{{actionmenu}}}
</div>
</div>
<div class="d-flex flex-grow-1 align-items-end">
{{{statusicons}}}
</div>
</div>