Skip to content

Commit

Permalink
MDL-75423 gradereport_singleview: swap position of grade and range cols
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies authored and Mihail Geshoski committed Nov 10, 2022
1 parent 3daabd6 commit bdb16ee
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
19 changes: 13 additions & 6 deletions grade/report/singleview/classes/local/screen/grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ public function original_headers() {
return [
'', // For filter icon.
get_string('fullnameuser', 'core'),
get_string('range', 'grades'),
get_string('grade', 'grades'),
get_string('range', 'grades'),
get_string('feedback', 'grades'),
$this->make_toggle_links('override'),
$this->make_toggle_links('exclude')
Expand Down Expand Up @@ -219,16 +219,23 @@ public function format_line($item): array {
$grade->label = $fullname;
$userpic = $OUTPUT->user_picture($item, ['link' => false, 'visibletoscreenreaders' => false]);

$formatteddefinition = $this->format_definition($grade);

$line = [
$OUTPUT->action_icon($this->format_link('user', $item->id), new pix_icon('t/editstring', ''), null,
['title' => $iconstring, 'aria-label' => $iconstring]),
html_writer::link($url, $userpic . $fullname),
$this->item_range()
$formatteddefinition['finalgrade'],
$this->item_range(),
$formatteddefinition['feedback'],
$formatteddefinition['override'],
$formatteddefinition['exclude'],
];
$lineclasses = [
"action",
"user",
"range"
'action',
'user',
'grade',
'range',
];
$outputline = [];
$i = 0;
Expand All @@ -245,7 +252,7 @@ public function format_line($item): array {
$i++;
}

return $this->format_definition($outputline, $grade);
return $outputline;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions grade/report/singleview/classes/local/screen/tablelike.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public function set_definition(array $overwrite): tablelike {

/**
* Get a element to generate the HTML for this table row
* @param array $line This is a list of lines in the table (modified)
* @param grade_grade $grade The grade.
* @return array
*/
public function format_definition(array $line, grade_grade $grade): array {
public function format_definition(grade_grade $grade): array {
$line = [];
foreach ($this->definition() as $i => $field) {
// Table tab index.
$tab = ($i * $this->total) + $this->index;
Expand All @@ -151,11 +151,11 @@ public function format_definition(array $line, grade_grade $grade): array {

// Singleview users without proper permissions should be presented
// disabled checkboxes for the Exclude grade attribute.
if ($field == 'exclude' && !has_capability('moodle/grade:manage', $this->context)){
if ($field == 'exclude' && !has_capability('moodle/grade:manage', $this->context)) {
$html->disabled = true;
}

$line[] = $html;
$line[$field] = $html;
}
return $line;
}
Expand Down
21 changes: 14 additions & 7 deletions grade/report/singleview/classes/local/screen/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public function original_headers(): array {
'', // For filter icon.
get_string('assessmentname', 'gradereport_singleview'),
get_string('gradecategory', 'grades'),
get_string('range', 'grades'),
get_string('grade', 'grades'),
get_string('range', 'grades'),
get_string('feedback', 'grades'),
$this->make_toggle_links('override'),
$this->make_toggle_links('exclude')
Expand Down Expand Up @@ -186,18 +186,25 @@ public function format_line($item): array {
$itemlabel = $this->structure->get_element_header($gradetreeitem, true, false, false, false, true);
$grade->label = $item->get_name();

$formatteddefinition = $this->format_definition($grade);

$line = [
$OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', ''), null,
['title' => $iconstring, 'aria-label' => $iconstring]),
$this->format_icon($item) . $lockicon . $itemlabel,
$this->category($item),
new range($item)
$formatteddefinition['finalgrade'],
new range($item),
$formatteddefinition['feedback'],
$formatteddefinition['override'],
$formatteddefinition['exclude'],
];
$lineclasses = [
"action",
"gradeitem",
"category",
"range"
'action',
'gradeitem',
'category',
'grade',
'range',
];

$outputline = [];
Expand All @@ -215,7 +222,7 @@ public function format_line($item): array {
$i++;
}

return $this->format_definition($outputline, $grade);
return $outputline;
}

/**
Expand Down

0 comments on commit bdb16ee

Please sign in to comment.