Create PDF template when exporting single course thematic - refs BT#12441

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 8 years ago
parent 4b8ee47ef9
commit 0d6deaf9e1
  1. 22
      app/Resources/public/css/print.css
  2. 53
      main/course_progress/thematic_controller.php
  3. 31
      main/template/default/course_progress/pdf_single_thematic.tpl

@ -500,19 +500,19 @@ padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;}
text-align: left;
}
.data_table tr.row_odd {
background-color: #fafafa;
background-color: #fafafa;
}
.data_table tr.row_odd:hover, .data_table tr.row_even:hover {
background-color: #f0f0f0;
}
.data_table tr.row_even {
background-color: #fff;
background-color: #fff;
}
.data_table td .highlight {
font-weight: bold;
}
.data_table td {
padding: 5px;
padding: 5px;
border-bottom: 1px solid #b0b0b0;
border-right: 1px dotted #e1e1e1;
border-left: 1px dotted #e1e1e1;
@ -671,3 +671,19 @@ div.system_announcement_content {
.print_invisible {
display:none;
}
/* New print CSS */
table th,
table td {
padding: 5px;
}
table.full-width {
width: 100%;
border-collapse: collapse;
}
table.border-thin,
table.border-thin th,
table.border-thin td {
border: 1px solid #000000;
}

@ -238,41 +238,26 @@ class ThematicController
break;
case 'export_single_thematic':
$theme = $thematic->get_thematic_list($thematic_id);
$table = array();
$table[] = array(
get_lang('Thematic'),
get_lang('ThematicPlan'),
get_lang('ThematicAdvance')
$plans = $thematic->get_thematic_plan_data($theme['id']);
$advances = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$view = new Template('', false, false, false, true, false, false);
$view->assign('theme', $theme);
$view->assign('plans', $plans);
$view->assign('advances', $advances);
$template = $view->get_template('course_progress/pdf_single_thematic.tpl');
Export::export_html_to_pdf(
$view->fetch($template),
[
'filename' => get_lang('Thematic').'-'.api_get_local_time(),
'pdf_title' => get_lang('Thematic'),
'add_signatures' => true,
'format' => 'A4-L',
'orientation' => 'L'
]
);
$data = $thematic->get_thematic_plan_data($theme['id']);
$plan_html = null;
if (!empty($data)) {
foreach ($data as $plan) {
if (empty($plan['description'])) {
continue;
}
$plan_html .= '<h6>'.$plan['title'].'</h6>'.$plan['description'].'<br />';
}
}
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$advance_html = null;
if (!empty($data)) {
foreach ($data as $advance) {
$advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG)
.' ('.$advance['duration'].' '.get_lang('HourShort').')'
.'<br />'.$advance['content'].'<br />';
}
}
$table[] = array($theme['title'], $plan_html, $advance_html);
$params = array(
'filename' => get_lang('Thematic').'-'.api_get_local_time(),
'pdf_title' => get_lang('Thematic'),
'add_signatures' => true,
'format' => 'A4-L',
'orientation' => 'L'
);
Export::export_table_pdf($table, $params);
break;
case 'moveup':
$thematic->move_thematic('up', $thematic_id);

@ -0,0 +1,31 @@
<table class="full-width border-thin">
<thead>
<tr>
<th>{{ 'Thematic'|get_lang }}</th>
<th>{{ 'ThematicPlan'|get_lang }}</th>
<th>{{ 'ThematicAdvance'|get_lang }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<h2>{{ theme.title }}</h2>
{{ theme.content }}
</td>
<td>
{% for plan in plans %}
<h3>{{ plan.title }}</h3>
{{ plan.description }}
{% endfor %}
</td>
<td>
{% for advance in advances %}
<p>
<strong>{{ advance.start_date|local_format_date(2) ~ ' (' ~ advance.duration ~ 'HourShort'|get_lang ~ ') ' }}</strong>
</p>
{{ advance.content }}
{% endfor %}
</td>
</tr>
</tbody>
</table>
Loading…
Cancel
Save