add tpl for plan tematic general - refs BT#12665

pull/2487/head
Alex Aragon 8 years ago
parent d4632b2e9d
commit c331ae167c
  1. 12
      app/Resources/public/css/print.css
  2. 52
      main/course_progress/thematic_controller.php
  3. 19
      main/template/default/course_progress/pdf_single_thematic.tpl
  4. 8
      main/template/default/export/pdf_header.tpl
  5. 52
      main/template/default/export/table_pdf.tpl

@ -673,7 +673,17 @@ div.system_announcement_content {
} }
/* New print CSS */ /* New print CSS */
.pdf-header{
border-bottom: 1px solid #CCC;
margin-bottom: 100px;
}
.pdf-header .logo a img{
width: 100px;
}
table{
display: block;
width: 100%;
}
table th, table th,
table td { table td {
padding: 5px; padding: 5px;

@ -199,44 +199,54 @@ class ThematicController
// Don't continue building a normal page. // Don't continue building a normal page.
return; return;
case 'thematic_export_pdf': case 'thematic_export_pdf':
$pdfOrientation = api_get_configuration_value('thematic_pdf_orientation'); $pdfOrientation = api_get_configuration_value('thematic_pdf_orientation');
$list = $thematic->get_thematic_list(); $list = $thematic->get_thematic_list();
$table = array(); $item = array();
$table[] = array(
get_lang('Thematic'),
get_lang('ThematicPlan'),
get_lang('ThematicAdvance')
);
foreach ($list as $theme) { foreach ($list as $theme) {
$data = $thematic->get_thematic_plan_data($theme['id']); $dataPlan = $thematic->get_thematic_plan_data($theme['id']);
$plan_html = null; if (!empty($dataPlan)) {
if (!empty($data)) { foreach ($dataPlan as $plan) {
foreach ($data as $plan) {
if (empty($plan['description'])) { if (empty($plan['description'])) {
continue; continue;
} }
$item[] = array(
$plan_html .= '<strong>'.$plan['title'].'</strong><br /> '.$plan['description'].'<br />'; 'title' => $plan['title'],
} 'description' => $plan['description']
);
} }
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']); $theme['thematic_plan'] = $item;
$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 />';
} }
$dataAdvance = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
//var_dump($dataAdvance);
if (!empty($dataAdvance)) {
$theme['thematic_advance'] = $dataAdvance;
} }
$table[] = array($theme['title'], $plan_html, $advance_html);
$listFinish[] = $theme;
//var_dump($theme['thematic_advance']);
//exit();
} }
$params = array(
$view = new Template('', false, false, false, true, false, false);
$view->assign('data', $listFinish);
$template = $view->get_template('course_progress/pdf_general_thematic.tpl');
Export::export_html_to_pdf(
$view->fetch($template),
[
'filename' => get_lang('Thematic').'-'.api_get_local_time(), 'filename' => get_lang('Thematic').'-'.api_get_local_time(),
'pdf_title' => get_lang('Thematic'), 'pdf_title' => get_lang('Thematic'),
'add_signatures' => ['Drh', 'Teacher', 'Date'], 'add_signatures' => ['Drh', 'Teacher', 'Date'],
'format' => $pdfOrientation !== 'portrait' ? 'A4-L' : 'A4-P', 'format' => $pdfOrientation !== 'portrait' ? 'A4-L' : 'A4-P',
'orientation' => $pdfOrientation !== 'portrait' ? 'L' : 'P' 'orientation' => $pdfOrientation !== 'portrait' ? 'L' : 'P'
]
); );
Export::export_table_pdf($table, $params);
break; break;
case 'export_single_thematic': case 'export_single_thematic':
$theme = $thematic->get_thematic_list($thematic_id); $theme = $thematic->get_thematic_list($thematic_id);

@ -1,27 +1,34 @@
<table class="full-width border-thin"> <table class="full-width border-thin">
<thead> <thead>
<tr> <tr>
<th>{{ 'Thematic'|get_lang }}</th> <th width="30%" style="display:inline-block; padding: 10px; text-align: center; background-color: #E5E5E5;">{{ 'Thematic'|get_lang }}</th>
<th>{{ 'ThematicPlan'|get_lang }}</th> <th width="50%" style="display:inline-block; padding: 10px; text-align: center; background-color: #E5E5E5;">{{ 'ThematicPlan'|get_lang }}</th>
<th>{{ 'ThematicAdvance'|get_lang }}</th> <th width="20%" style="display:inline-block; padding: 10px; text-align: center; background-color: #E5E5E5;">{{ 'ThematicAdvance'|get_lang }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td> <td>
{{ theme.title }} <h4>{{ theme.title }}</h4>
<br>
{{ theme.content }} {{ theme.content }}
</td> </td>
<td> <td>
{% for plan in plans %} {% for plan in plans %}
{{ plan.title }} <br>
<h4>{{ plan.title }}</h4>
<br>
{{ plan.description }} {{ plan.description }}
{% endfor %} {% endfor %}
</td> </td>
<td> <td>
{% for advance in advances %} {% for advance in advances %}
<p>{{ advance.start_date|api_convert_and_format_date(2) ~ ' (' ~ advance.duration ~ 'HourShort'|get_lang ~ ') ' }}</p> <h4 style="margin-bottom: 10px;">
{{ advance.duration }} {{ "MinHours" | get_lang }}
</h4>
<p>{{ advance.start_date|api_convert_and_format_date(2) }}</p>
{{ advance.content }} {{ advance.content }}
<br>
{% endfor %} {% endfor %}
</td> </td>
</tr> </tr>

@ -1,9 +1,11 @@
<table border="0" class="full-width border-bottom page-footer"> <table border="0" width="100%" class="pdf-header">
<tr> <tr>
<td class="text-right"> <td width="30%">
{{ organization }}
</td>
<td width="80%" style="text-align: right; font-size: 12px; color: #666666;">
<strong>{{ teacher_name }}</strong> <strong>{{ teacher_name }}</strong>
</td> </td>
</tr> </tr>
</table> </table>
{{ organization }}

@ -1,5 +1,5 @@
<br>
<br>
<h2 align="center"> {{ pdf_title }} </h2> <h2 align="center"> {{ pdf_title }} </h2>
{% if pdf_description %} {% if pdf_description %}
@ -7,27 +7,32 @@
<br /><br /> <br /><br />
{% endif %} {% endif %}
<table align="center" width="100%">
<table align="center" width="100%" class="full-width border-thin">
{% if pdf_student_info %} {% if pdf_student_info %}
<tr> <tr>
<td style="background-color: #E5E5E5; text-align: left; width:130px; ">
<strong>{{ "Student" | get_lang }}:</strong>
</td>
<td> <td>
<strong>{{ "Student" | get_lang }}:</strong> {{ pdf_student_info.complete_name }} {{ pdf_student_info.complete_name }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if pdf_teachers %} {% if pdf_teachers %}
<tr> <tr>
<td style="background-color: #E5E5E5; text-align: left; width:130px;">
<strong>{{ "Teacher" | get_lang }}:</strong>
</td>
<td> <td>
<strong>{{ "Teacher" | get_lang }}:</strong> {{ pdf_teachers }} {{ pdf_teachers }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if pdf_session_info %} {% if pdf_session_info %}
<tr> <tr>
<td> <td style="background-color: #E5E5E5; text-align: left; width:130px;">
<strong>{{ "Session" | get_lang }}:</strong> {{ pdf_session_info.name }} <strong>{{ "Session" | get_lang }}:</strong> {{ pdf_session_info.name }}
</td> </td>
@ -40,8 +45,11 @@
{% if pdf_session_info.access_start_date != '' and pdf_session_info.access_end_date is not empty and pdf_session_info.access_end_date != '0000-00-00' %} {% if pdf_session_info.access_start_date != '' and pdf_session_info.access_end_date is not empty and pdf_session_info.access_end_date != '0000-00-00' %}
<tr> <tr>
<td style="background-color: #E5E5E5; text-align: left; width:130px;">
<strong>{{ "PeriodToDisplay" | get_lang }}:</strong>
</td>
<td> <td>
<strong>{{ "PeriodToDisplay" | get_lang }}:</strong> {{ "FromDateXToDateY"| get_lang | format(pdf_session_info.access_start_date, pdf_session_info.access_end_date ) }} {{ "FromDateXToDateY"| get_lang | format(pdf_session_info.access_start_date, pdf_session_info.access_end_date ) }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
@ -49,36 +57,39 @@
{% if pdf_course_info %} {% if pdf_course_info %}
<tr> <tr>
<td style="background-color: #E5E5E5; text-align: left; width:130px;">
<strong>{{ "Course" | get_lang }}:</strong>
</td>
<td> <td>
<strong>{{ "Course" | get_lang }}:</strong> {{ pdf_course_info.title }} ({{ pdf_course_info.code }}) {{ pdf_course_info.title }} ({{ pdf_course_info.code }})
{% if pdf_course_category %}
<strong>{{ "Category" | get_lang }}:</strong> {{ pdf_course_category }}
{% endif %}
</td> </td>
</tr> </tr>
{% if pdf_course_category %}
<tr>
<td> <strong>{{ "Category" | get_lang }}:</strong></td>
<td> {{ pdf_course_category }} </td>
</tr>
{% endif %}
{% endif %} {% endif %}
{% if pdf_date %} {% if pdf_date %}
<tr> <tr>
<td style="background-color: #E5E5E5; text-align: left; width:130px;">
<strong>{{ "Date" | get_lang }}:</strong>
</td>
<td> <td>
<strong>{{ "Date" | get_lang }}:</strong> {{ pdf_date }} {{ pdf_date }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
</table> </table>
{% if show_grade_generated_date == true %} {% if show_grade_generated_date == true %}
<h5 align="right"> <h5 align="right">
{{ 'GradeGeneratedOnX' | get_lang | format("now"| date("d/m/Y")) }} {{ 'GradeGeneratedOnX' | get_lang | format("now"| date("d/m/Y")) }}
</h5> </h5>
{% endif %} {% endif %}
<br />
{{ pdf_content }} {{ pdf_content }}
{% if not add_signatures is empty %} {% if not add_signatures is empty %}
@ -97,3 +108,4 @@
</tr> </tr>
</table> </table>
{% endif %} {% endif %}

Loading…
Cancel
Save