diff --git a/app/Resources/public/css/print.css b/app/Resources/public/css/print.css
index bbd0218832..93df50314c 100644
--- a/app/Resources/public/css/print.css
+++ b/app/Resources/public/css/print.css
@@ -673,7 +673,17 @@ div.system_announcement_content {
}
/* 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 td {
padding: 5px;
diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php
index 06843b8141..a13d663fb0 100755
--- a/main/course_progress/thematic_controller.php
+++ b/main/course_progress/thematic_controller.php
@@ -199,44 +199,54 @@ class ThematicController
// Don't continue building a normal page.
return;
case 'thematic_export_pdf':
+
$pdfOrientation = api_get_configuration_value('thematic_pdf_orientation');
$list = $thematic->get_thematic_list();
- $table = array();
- $table[] = array(
- get_lang('Thematic'),
- get_lang('ThematicPlan'),
- get_lang('ThematicAdvance')
- );
+ $item = array();
+
foreach ($list as $theme) {
- $data = $thematic->get_thematic_plan_data($theme['id']);
- $plan_html = null;
- if (!empty($data)) {
- foreach ($data as $plan) {
+ $dataPlan = $thematic->get_thematic_plan_data($theme['id']);
+ if (!empty($dataPlan)) {
+ foreach ($dataPlan as $plan) {
if (empty($plan['description'])) {
continue;
}
-
- $plan_html .= ''.$plan['title'].'
'.$plan['description'].'
';
+ $item[] = array(
+ 'title' => $plan['title'],
+ 'description' => $plan['description']
+ );
}
+ $theme['thematic_plan'] = $item;
+
}
- $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').')
'.$advance['content'].'
';
- }
+
+ $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(
- 'filename' => get_lang('Thematic').'-'.api_get_local_time(),
- 'pdf_title' => get_lang('Thematic'),
- 'add_signatures' => ['Drh', 'Teacher', 'Date'],
- 'format' => $pdfOrientation !== 'portrait' ? 'A4-L' : 'A4-P',
- 'orientation' => $pdfOrientation !== 'portrait' ? 'L' : 'P'
+
+ $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(),
+ 'pdf_title' => get_lang('Thematic'),
+ 'add_signatures' => ['Drh', 'Teacher', 'Date'],
+ 'format' => $pdfOrientation !== 'portrait' ? 'A4-L' : 'A4-P',
+ 'orientation' => $pdfOrientation !== 'portrait' ? 'L' : 'P'
+ ]
);
- Export::export_table_pdf($table, $params);
+
break;
case 'export_single_thematic':
$theme = $thematic->get_thematic_list($thematic_id);
diff --git a/main/template/default/course_progress/pdf_general_thematic.tpl b/main/template/default/course_progress/pdf_general_thematic.tpl
new file mode 100644
index 0000000000..1903cd3112
--- /dev/null
+++ b/main/template/default/course_progress/pdf_general_thematic.tpl
@@ -0,0 +1,46 @@
+
+
+ {{ "Thematic" | get_lang }} + | ++ {{ "ThematicPlan" | get_lang }} + | ++ {{ "ThematicAdvance" | get_lang }} + | +
---|---|---|
+ {{ item.title }}++ {{ item.content }} + |
+
+ {% for plan in item.thematic_plan %}
+ + {{ plan.title }}++ {{ plan.description }} + {% endfor %} + |
+
+ {% for advance in item.thematic_advance %}
+ + + {{ advance.duration }} {{ "MinHours" | get_lang }} ++ {{ advance.start_date | api_convert_and_format_date(2) }} ++ {{ advance.content }} + {% endfor %} + |
+
{{ 'Thematic'|get_lang }} | -{{ 'ThematicPlan'|get_lang }} | -{{ 'ThematicAdvance'|get_lang }} | +{{ 'Thematic'|get_lang }} | +{{ 'ThematicPlan'|get_lang }} | +{{ 'ThematicAdvance'|get_lang }} |
---|---|---|---|---|---|
- {{ theme.title }}
+ {{ theme.title }}+{{ theme.content }} |
{% for plan in plans %}
- {{ plan.title }}
+ + {{ plan.title }}+{{ plan.description }} {% endfor %} |
{% for advance in advances %}
- {{ advance.start_date|api_convert_and_format_date(2) ~ ' (' ~ advance.duration ~ 'HourShort'|get_lang ~ ') ' }} ++ {{ advance.duration }} {{ "MinHours" | get_lang }} ++{{ advance.start_date|api_convert_and_format_date(2) }} {{ advance.content }} +{% endfor %} |
+ | + {{ organization }} + | +{{ teacher_name }} |
+ {{ "Student" | get_lang }}: + | - {{ "Student" | get_lang }}: {{ pdf_student_info.complete_name }} + {{ pdf_student_info.complete_name }} |
+ {{ "Teacher" | get_lang }}: + | - {{ "Teacher" | get_lang }}: {{ pdf_teachers }} + {{ pdf_teachers }} |
+ | {{ "Session" | get_lang }}: {{ pdf_session_info.name }} | @@ -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' %}
+ {{ "PeriodToDisplay" | get_lang }}: + | - {{ "PeriodToDisplay" | get_lang }}: {{ "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 ) }} |
+ {{ "Course" | get_lang }}: + | - {{ "Course" | get_lang }}: {{ pdf_course_info.title }} ({{ pdf_course_info.code }}) - - {% if pdf_course_category %} - {{ "Category" | get_lang }}: {{ pdf_course_category }} - {% endif %} - + {{ pdf_course_info.title }} ({{ pdf_course_info.code }}) |
{{ "Category" | get_lang }}: | +{{ pdf_course_category }} | +
+ {{ "Date" | get_lang }}: + | - {{ "Date" | get_lang }}: {{ pdf_date }} + {{ pdf_date }} |