Add total table see BT#15826

pull/2990/head
Julio Montoya 6 years ago
parent 6b599f8cc6
commit 250227b6c2
  1. 32
      main/mySpace/access_details_session.php

@ -131,7 +131,6 @@ if ($form->validate()) {
); );
$partialDuration = 0; $partialDuration = 0;
foreach ($result as $item) { foreach ($result as $item) {
$record = [ $record = [
customDate($item['login'], true), customDate($item['login'], true),
@ -238,11 +237,13 @@ if ($form->validate()) {
$table->setCellContents($row, $column++, customDate($minLogin)); $table->setCellContents($row, $column++, customDate($minLogin));
$table->setCellContents($row, $column++, customDate($maxLogin)); $table->setCellContents($row, $column++, customDate($maxLogin));
$table->setCellContents($row, $column++, api_format_time($totalDuration, 'js')); $table->setCellContents($row, $column++, api_format_time($totalDuration, 'js'));
$content = Display::page_subheader3(get_lang('Total')).$table->toHtml(); $totalTable = Display::page_subheader3(get_lang('Total')).$table->toHtml();
$courseSessionTable = '';
$courseSessionTableData = [];
foreach ($report as $sessionId => $data) { foreach ($report as $sessionId => $data) {
foreach ($data['courses'] as $courseId => $courseData) { foreach ($data['courses'] as $courseId => $courseData) {
$content .= Display::page_subheader3($data['name'][$courseId]); $courseSessionTable .= Display::page_subheader3($data['name'][$courseId]);
$table = new HTML_Table(['class' => 'data_table']); $table = new HTML_Table(['class' => 'data_table']);
$headers = [ $headers = [
get_lang('StartDate'), get_lang('StartDate'),
@ -262,19 +263,40 @@ if ($form->validate()) {
foreach ($record as $item) { foreach ($record as $item) {
$table->setCellContents($row, $column++, $item); $table->setCellContents($row, $column++, $item);
if ($row == $countData) { if ($row == $countData) {
$courseSessionTableData[$data['name'][$courseId]] = $row;
$table->setRowAttributes($row, ['style' => 'font-weight:bold']); $table->setRowAttributes($row, ['style' => 'font-weight:bold']);
} }
} }
$row++; $row++;
} }
$content .= $table->toHtml(); $courseSessionTable .= $table->toHtml();
} }
} }
$table = new HTML_Table(['class' => 'data_table']);
$headers = [
get_lang('Course'),
get_lang('TotalDuration'),
];
$row = 0;
$column = 0;
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
$column++;
}
$row++;
foreach ($courseSessionTableData as $name => $duration) {
$column = 0;
$table->setCellContents($row, $column++, $name);
$table->setCellContents($row, $column++, api_format_time($duration, 'js'));
$row++;
}
$totalCourseSessionTable = $table->toHtml();
$tpl = new Template('', false, false, false, true, false, false); $tpl = new Template('', false, false, false, true, false, false);
$tpl->assign('title', get_lang('RealisationCertificate')); $tpl->assign('title', get_lang('RealisationCertificate'));
$tpl->assign('student', $userInfo['complete_name']); $tpl->assign('student', $userInfo['complete_name']);
$tpl->assign('table_progress', $content); $tpl->assign('table_progress', $totalCourseSessionTable.$totalTable.$courseSessionTable);
$content = $tpl->fetch($tpl->get_template('my_space/pdf_export_student.tpl')); $content = $tpl->fetch($tpl->get_template('my_space/pdf_export_student.tpl'));
$params = [ $params = [

Loading…
Cancel
Save