Fix gradebook double column see BT#14972

pull/2729/head
Julio Montoya 7 years ago
parent 235822c154
commit 12ff957d38
  1. 7
      main/gradebook/index.php
  2. 21
      main/gradebook/lib/fe/gradebooktable.class.php

@ -919,7 +919,6 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
$loadStats = []; $loadStats = [];
$teacher = api_is_allowed_to_edit(null, true); $teacher = api_is_allowed_to_edit(null, true);
if (!$teacher) { if (!$teacher) {
if (api_get_setting('gradebook_detailed_admin_view') === 'true') { if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
$loadStats = [1, 2, 3]; $loadStats = [1, 2, 3];
@ -948,15 +947,17 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
4 => 'class="text-center"', 4 => 'class="text-center"',
]; ];
} else { } else {
if (empty($model)) { /*if (empty($model)) {
$gradebookTable->td_attributes = [ $gradebookTable->td_attributes = [
3 => 'class="text-right"', 3 => 'class="text-right"',
4 => 'class="text-center"', 4 => 'class="text-center"',
]; ];
if (!empty($loadStats)) {
for ($z = 5; $z < count($loadStats); $z++) { for ($z = 5; $z < count($loadStats); $z++) {
$gradebookTable->td_attributes[$z] = 'class="text-center"'; $gradebookTable->td_attributes[$z] = 'class="text-center"';
} }
}
} else { } else {
$gradebookTable->td_attributes = [ $gradebookTable->td_attributes = [
3 => 'class="text-right"', 3 => 'class="text-right"',
@ -966,7 +967,7 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
if ($action == 'export_table') { if ($action == 'export_table') {
unset($gradebookTable->td_attributes[7]); unset($gradebookTable->td_attributes[7]);
} }*/
} }
$table = $gradebookTable->return_table(); $table = $gradebookTable->return_table();

@ -111,7 +111,10 @@ class GradebookTable extends SortableTable
'', '',
'width="100px"' 'width="100px"'
); );
if (!$this->teacherView) {
$this->set_header($column++, get_lang('Result'), false); $this->set_header($column++, get_lang('Result'), false);
}
if (empty($model)) { if (empty($model)) {
if (in_array(1, $this->loadStats)) { if (in_array(1, $this->loadStats)) {
@ -464,7 +467,6 @@ class GradebookTable extends SortableTable
} }
} else { } else {
$row[] = $scoreToDisplay; $row[] = $scoreToDisplay;
if (!empty($this->cats)) { if (!empty($this->cats)) {
if ($this->exportToPdf == false) { if ($this->exportToPdf == false) {
$row[] = $this->build_edit_column($item); $row[] = $this->build_edit_column($item);
@ -574,6 +576,7 @@ class GradebookTable extends SortableTable
if (!is_null($value_data)) { if (!is_null($value_data)) {
// Result // Result
$row[] = $value_data; $row[] = $value_data;
$best = isset($data['best']) ? $data['best'] : null; $best = isset($data['best']) ? $data['best'] : null;
$average = isset($data['average']) ? $data['average'] : null; $average = isset($data['average']) ? $data['average'] : null;
$ranking = isset($data['ranking']) ? $data['ranking'] : null; $ranking = isset($data['ranking']) ? $data['ranking'] : null;
@ -700,6 +703,7 @@ class GradebookTable extends SortableTable
SCORE_DIV SCORE_DIV
); );
if (!empty($this->loadStats)) {
$row = [ $row = [
null, null,
'<h3>'.get_lang('Total').'</h3>', '<h3>'.get_lang('Total').'</h3>',
@ -709,8 +713,13 @@ class GradebookTable extends SortableTable
$row[] = null; $row[] = null;
} }
$row[] = $main_weight; //$row[] = $main_weight;
$row[] = $totalResult; //$row[] = $totalResult;
$row[] = null;
$row[] = null;
} else {
$row = [];
}
if (in_array(1, $this->loadStats)) { if (in_array(1, $this->loadStats)) {
$totalRanking = []; $totalRanking = [];
@ -742,13 +751,11 @@ class GradebookTable extends SortableTable
if ($invalidateRanking) { if ($invalidateRanking) {
$totalRanking = null; $totalRanking = null;
} }
$row[] = $totalRanking; $row[] = $totalRanking;
} }
if (in_array(2, $this->loadStats)) { if (in_array(2, $this->loadStats)) {
// Overwrite main weight // Overwrite main weight
$totalBest[1] = $main_weight; $totalBest[1] = $main_weight;
$totalBest = $scoredisplay->display_score( $totalBest = $scoredisplay->display_score(
$totalBest, $totalBest,
SCORE_DIV, SCORE_DIV,
@ -770,9 +777,11 @@ class GradebookTable extends SortableTable
$row[] = $totalAverage; $row[] = $totalAverage;
} }
if (!empty($row)) {
$sortable_data[] = $row; $sortable_data[] = $row;
} }
} }
}
// Warning messages // Warning messages
$view = isset($_GET['view']) ? $_GET['view'] : null; $view = isset($_GET['view']) ? $_GET['view'] : null;
@ -862,7 +871,7 @@ class GradebookTable extends SortableTable
if (!$this->teacherView) { if (!$this->teacherView) {
$rowTotal = []; $rowTotal = [];
$rowTotal[] = ' '; $rowTotal[] = ' ';
$rowTotal[] = get_lang('FinalScore'); $rowTotal[] = '<strong>'.get_lang('FinalScore').'</strong>';
if (!$this->exportToPdf) { if (!$this->exportToPdf) {
$rowTotal[] = ' '; $rowTotal[] = ' ';

Loading…
Cancel
Save