Improve UI in pdf export see BT#15643

pull/2926/head
Julio Montoya 7 years ago
parent 1937d0a581
commit c8c9aef8da
  1. 21
      main/mySpace/lp_tracking.php
  2. 47
      main/template/default/my_space/pdf_tracking_lp.tpl

@ -148,8 +148,8 @@ switch ($action) {
$globalTotalCount = 0;
foreach ($questions as $data) {
// Question title
$table->setCellContents($row, 0, '<b>'.$data['question'].'</b>');
$table->setCellAttributes($row, 0, ['colspan' => '3', 'style' => 'text-align:center;']);
$table->setCellContents($row, 0, $data['question']);
$table->setCellAttributes($row, 0, ['colspan' => '3', 'style' => 'text-align:center; font-weight:bold']);
$choiceCounter = 1;
$row++;
$total = 0;
@ -174,11 +174,16 @@ switch ($action) {
// Question total
$table->setCellContents($row, 0, get_lang('Total'));
$table->setCellContents($row, 1, $data['question']);
$totalOptions = count($data['options']);
$arrayScore = [0 => $total, 1 => $totalOptions];
$scoreToString = $scoreDisplay->display_score($arrayScore);
$table->setCellContents($row, 2, $scoreToString);
$table->setCellAttributes($row, 0, ['style' => 'font-weight:bold']);
$table->setCellAttributes($row, 1, ['style' => 'font-weight:bold']);
$table->setCellAttributes($row, 2, ['style' => 'font-weight:bold']);
$categories[] = [
'name' => $data['question'],
'score' => $scoreDisplay->display_score($arrayScore, SCORE_DIV),
@ -205,6 +210,10 @@ switch ($action) {
$table->setCellContents($row, 1, '');
$table->setCellContents($row, 2, $score);
$table->setCellAttributes($row, 0, ['style' => 'font-weight:bold']);
$table->setCellAttributes($row, 1, ['style' => 'font-weight:bold']);
$table->setCellAttributes($row, 2, ['style' => 'font-weight:bold']);
$tableToString = $table->toHtml();
$duration = learnpathItem::getScormTimeFromParameter('js', $itemView->getTotalTime());
@ -215,13 +224,13 @@ switch ($action) {
'score' => $score,
'duration' => $duration,
'start_time' => api_get_local_time($itemView->getStartTime()),
'start_date' => api_get_local_time($itemView->getStartTime(), null, null, null, false),
'end_time' => api_get_local_time($endTime),
'candidate' => $studentName,
];
$tpl->assign('data', $dataLpInfo);
$template = $tpl->fetch($tpl->get_template('my_space/pdf_tracking_lp.tpl'));
$contentText = $template;
$contentText = $tpl->fetch($tpl->get_template('my_space/pdf_tracking_lp.tpl'));
$content = $contentText.'<pagebreak>'.$tableToString;
@ -247,7 +256,9 @@ switch ($action) {
$background = api_get_path(SYS_PATH).'custompages/url-images/'.api_get_current_access_url_id().'_pdf_background.png';
$content = '<html><body style="background-image-resize: 5; background-position: top left; background-image: url('.$background.');">'
$content =
'<html>
<body style="background-image-resize: 5; background-position: top left; background-image: url('.$background.');">'
.$content.'</body></html>';
$pdf->content_to_pdf(

@ -2,6 +2,7 @@
<h3 style="text-align: center; text-transform: uppercase; font-size: 20px; font-weight: bold;">{{ data.name }}</h3>
<br>
<p>{{ 'Candidate' | get_lang }} : {{ data.candidate }}</p>
<p>{{ 'ScormStartAttemptDate' | get_lang }} : {{ data.start_date }}</p>
<br>
<table style="width: 100%; font-size: 12px; font-weight: normal;">
<tr>
@ -23,38 +24,28 @@
</tr>
<tr>
<td style="text-align: center; height: 50px; background: #d9d9d9; padding: 5px; display: block; border: 2px solid #FFFFFF;">
{{ data.attempt }}
</td>
<td style="text-align: center; background: #d9d9d9; padding: 5px; display: block; border: 2px solid #FFFFFF;">
{{ data.score }}
</td>
<td style="text-align: center; background: #d9d9d9; padding: 5px; display: block; border: 2px solid #FFFFFF;">
{{ data.duration }}
</td>
<td style="text-align: center; background: #d9d9d9; padding: 5px; display: block; border: 2px solid #FFFFFF;">
{{ data.start_time }}
</td>
<td style="text-align: center; background: #d9d9d9; padding: 5px; display: block; border: 2px solid #FFFFFF;">
{{ data.end_time }}
</td>
</tr>
</table>
<br>
<table style="width: 100%; font-size: 12px; font-weight: normal;">
<table style="width: 100%; font-size: 12px;">
<tr>
<th style="text-align: center; height: 25px; background: #222222; color: #FFFFFF; border: 2px solid #FFFFFF;">
{{ 'CategoryName'|get_lang }}
{{ 'Domains'|get_lang }}
</th>
<th style="text-align: center; background: #222222; color: #FFFFFF; border: 2px solid #FFFFFF;">
{{ 'Score'|get_lang }}
@ -63,9 +54,12 @@
{{ 'Percentage'|get_lang }}
</th>
</tr>
{% for item in categories %}
<tr>
<td style="height:40px; width: 40%; text-align: left; padding: 5px; display: block; border-bottom: 1px solid #cdcdcd;">{{ item.name }}</td>
<td style="height:40px; width: 40%; text-align: left; padding: 5px; display: block; border-bottom: 1px solid #cdcdcd;">
{{ item.name }}
</td>
<td style="text-align: center; padding: 5px; display: block; border-bottom: 1px solid #cdcdcd;">
{% if item.score_numeric == 0 %}
<span style="color: red;">{{ item.score }}</span>
@ -83,10 +77,11 @@
</td>
</tr>
{% endfor %}
{% for item in general_score %}
<tr>
<td style="text-align: left; padding: 5px; height:30px; background: #222222; color: #FFFFFF; display: block;">
{{ 'GeneralTotal' | get_lang }}
<b>{{ 'GeneralTotal' | get_lang }}</b>
</td>
<td style="text-align: center; padding: 5px; display: block;background-color: #f6ffe2;">
{{ item.score }}
@ -100,18 +95,18 @@
{% endif %}
</td>
</tr>
{#{% if global_total %}
<tr>
<td>
{# {% if global_total %}#}
{# <tr>#}
{# <td>#}
</td>
<td>
{{ 'GlobalTotal'|get_lang }}
</td>
<td>
{{ global_total }}
</td>
</tr>
{% endif %}#}
{# </td>#}
{# <td>#}
{# {{ 'GlobalTotal'|get_lang }}#}
{# </td>#}
{# <td>#}
{# {{ global_total }}#}
{# </td>#}
{# </tr>#}
{# {% endif %}#}
{% endfor %}
</table>
Loading…
Cancel
Save