Fix export gradebook to pdf - refs BT#14687 #2609

pull/2606/head
Angel Fernando Quiroz Campos 7 years ago
parent 4d67dfb66a
commit c51000cb5c
  1. 49
      main/gradebook/lib/fe/gradebooktable.class.php

@ -683,6 +683,19 @@ class GradebookTable extends SortableTable
SCORE_DIV SCORE_DIV
); );
$row = [
null,
'<h3>'.get_lang('Total').'</h3>',
];
if (!$this->exportToPdf) {
$row[] = null;
}
$row[] = $main_weight;
$row[] = $totalResult;
if (in_array(1, $this->loadStats)) {
$totalRanking = []; $totalRanking = [];
$invalidateRanking = true; $invalidateRanking = true;
$average = 0; $average = 0;
@ -708,6 +721,9 @@ class GradebookTable extends SortableTable
$totalRanking = null; $totalRanking = null;
} }
$row[] = $totalRanking;
}
if (in_array(2, $this->loadStats)) {
// Overwrite main weight // Overwrite main weight
$totalBest[1] = $main_weight; $totalBest[1] = $main_weight;
@ -717,8 +733,9 @@ class GradebookTable extends SortableTable
SCORE_BOTH, SCORE_BOTH,
true true
); );
$row[] = $totalBest;
if ($this->exportToPdf || $this->loadStats) { }
if (in_array(3, $this->loadStats)) {
// Overwrite main weight // Overwrite main weight
$totalAverage[0] = $average / count($this->studentList); $totalAverage[0] = $average / count($this->studentList);
$totalAverage[1] = $main_weight; $totalAverage[1] = $main_weight;
@ -729,37 +746,9 @@ class GradebookTable extends SortableTable
SCORE_BOTH, SCORE_BOTH,
true true
); );
}
if ($this->exportToPdf) {
$row = [
null,
'<h3>'.get_lang('Total').'</h3>',
$main_weight,
$totalResult,
$totalRanking,
$totalBest,
$totalAverage,
];
} else {
$row = [
null,
'<h3>'.get_lang('Total').'</h3>',
null,
$main_weight,
$totalResult,
];
if (in_array(1, $this->loadStats)) {
$row[] = $totalRanking;
}
if (in_array(2, $this->loadStats)) {
$row[] = $totalBest;
}
if (in_array(3, $this->loadStats)) {
$row[] = $totalAverage; $row[] = $totalAverage;
} }
}
$sortable_data[] = $row; $sortable_data[] = $row;
} }

Loading…
Cancel
Save