diff --git a/app/Resources/public/css/print.css b/app/Resources/public/css/print.css index c72b1d7de5..31926a91b8 100644 --- a/app/Resources/public/css/print.css +++ b/app/Resources/public/css/print.css @@ -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; +} diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index 8711597b61..aa54413ef0 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -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 .= '
'.$plan['title'].'
'.$plan['description'].'
'; - } - } - $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'].'
'; - } - } - $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); diff --git a/main/template/default/course_progress/pdf_single_thematic.tpl b/main/template/default/course_progress/pdf_single_thematic.tpl new file mode 100644 index 0000000000..b9ff7f254d --- /dev/null +++ b/main/template/default/course_progress/pdf_single_thematic.tpl @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + +
{{ 'Thematic'|get_lang }}{{ 'ThematicPlan'|get_lang }}{{ 'ThematicAdvance'|get_lang }}
+

{{ theme.title }}

+ {{ theme.content }} +
+ {% for plan in plans %} +

{{ plan.title }}

+ {{ plan.description }} + {% endfor %} +
+ {% for advance in advances %} +

+ {{ advance.start_date|local_format_date(2) ~ ' (' ~ advance.duration ~ 'HourShort'|get_lang ~ ') ' }} +

+ {{ advance.content }} + {% endfor %} +