Allow export to pdf single thematic plan - refs BT#12441

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent d9a0fae005
commit 654fb09347
  1. 4
      main/course_progress/index.php
  2. 7
      main/course_progress/thematic.php
  3. 38
      main/course_progress/thematic_controller.php

@ -43,7 +43,8 @@ $actions = array(
'thematic_advance_list',
'thematic_advance_add',
'thematic_advance_edit',
'thematic_advance_delete'
'thematic_advance_delete',
'export_single_thematic'
);
$action = 'thematic_details';
@ -269,6 +270,7 @@ switch ($action) {
case 'thematic_export':
case 'thematic_export_pdf':
case 'thematic_details':
case 'export_single_thematic':
$thematic_controller->thematic($action);
break;
case 'thematic_plan_add':

@ -132,6 +132,13 @@ if ($action == 'thematic_list') {
}
}
if (api_get_session_id() == $thematic['session_id']) {
$actions_first_col .= Display::url(
Display::return_icon('pdf.png'),
api_get_self().'?'.api_get_cidreq()."$url_token&".http_build_query([
'action' => 'export_single_thematic',
'thematic_id' => $my_thematic_id
])
);
$actions_first_col .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='
.$my_thematic_id.$params.$url_token.'">'
.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';

@ -236,6 +236,44 @@ class ThematicController
);
Export::export_table_pdf($table, $params);
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')
);
$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);
$action = 'thematic_details';

Loading…
Cancel
Save