Edits student publication list to PDF see BT#9018

1.9.x
Julio Montoya 11 years ago
parent 57e2ffbed2
commit 837465d8be
  1. 20
      main/template/default/export/table_pdf.tpl
  2. 45
      main/work/work.lib.php

@ -2,7 +2,7 @@
<h2 align="center"> {{ pdf_title }} </h2>
{% if pdf_description %}
{% if pdf_description %}
{{ pdf_description }}
<br /><br />
{% endif %}
@ -19,6 +19,12 @@
<td>
<strong>{{ "Session" | get_lang }}:</strong> {{ pdf_session_info.name }}
</td>
{% if pdf_session_info.description %}
<td>
<strong>{{ "Description" | get_lang }}:</strong> {{ pdf_session_info.description }}
</td>
{% endif %}
</tr>
{% endif %}
@ -26,11 +32,11 @@
<tr>
<td>
<strong>{{ "Course" | get_lang }}:</strong> {{ pdf_course_info.title }} ({{ pdf_course_info.code }})
{% if pdf_course_category %}
{% if pdf_course_category %}
<strong>{{ "Category" | get_lang }}:</strong> {{ pdf_course_category }}
{% endif %}
</td>
</tr>
{% endif %}
@ -38,7 +44,7 @@
<td>
<strong>{{ "Date" | get_lang }}:</strong> {{ pdf_date }}
</td>
</tr>
</tr>
</table>
<br />
@ -64,8 +70,8 @@
<td>
_____________________________
<br />
{{ "Date" | get_lang }}
{{ "Date" | get_lang }}
</td>
</tr>
</table>
{% endif %}
{% endif %}

@ -2378,9 +2378,12 @@ function get_work_user_list(
}
$work['qualification'] = $qualification_string.$feedback;
$work['qualification_only'] = $qualification_string;
// Date.
$work_date = api_convert_and_format_date($work['sent_date']);
$work['sent_date_from_db'] = $work['sent_date'];
$work['sent_date'] = date_to_str_ago(api_get_local_time($work['sent_date'])) . ' ' . $add_string . '<br />' . $work_date;
// Actions.
@ -5021,12 +5024,17 @@ function exportAllStudentWorkFromPublication(
}
}
$header .= '<br />'.get_lang('Teachers').': '.$teachers;
$header .= '<br />'.get_lang('Date').': '.api_get_local_time();
$header .= '<br />'.get_lang('StudentPublication').': '.$workData['title'];
$header .= '<br />'.get_lang('Teachers').': '.$teachers.'<br />';
$header .= '<br />'.get_lang('Date').': '.api_get_local_time().'<br />';
$header .= '<br />'.get_lang('StudentPublication').': '.$workData['title'].'<br />';
$content = null;
if (!empty($workData['expires_on'])) {
$header .= '<br />' . get_lang('ExpiryDate') . ': ' . api_get_local_time($workData['expires_on']);
$content .= '<br /><strong>' . get_lang('ExpiryDate') . '</strong>: ' . api_get_local_time($workData['expires_on']);
}
if (!empty($workData['description'])) {
$content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
}
$workList = get_work_user_list(null, null, null, null, $workId);
@ -5035,24 +5043,24 @@ function exportAllStudentWorkFromPublication(
case 'pdf':
if (!empty($workList)) {
require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
$pdf = new PDF();
$pdf->set_custom_header($header);
//$pdf->set_custom_header($header);
$content = null;
$content .= '<hr />';
foreach ($workList as $work) {
// getWorkComments need c_id
$work['c_id'] = $courseInfo['real_id'];
$content .= $work['title'].'<br />';
$content .= $work['sent_date'].'<br />';
$content .= $work['qualification'].'<br />';
$content .= $work['description'].'<br />';
$content .= '<h3>'.strip_tags($work['title']).'<h3 />';
$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
if (!empty($work['qualification_only'])) {
$content .= get_lang('Score').': '.$work['qualification_only'] . '<br />';
}
$content .= get_lang('Description').': '.$work['description'].'<br />';
$comments = getWorkComments($work);
if (!empty($comments)) {
$content .= '<h3>'.get_lang('Feedback').': </h3>';
$content .= '<h4>'.get_lang('Feedback').': </h4>';
foreach ($comments as $comment) {
$content .= get_lang('User').': '.api_get_person_name(
$comment['firstname'],
@ -5065,12 +5073,21 @@ function exportAllStudentWorkFromPublication(
}
if (!empty($content)) {
$pdf->content_to_pdf(
/*$pdf->content_to_pdf(
$content,
null,
replace_dangerous_char($workData['title']),
$courseInfo['code']
);*/
$params = array(
'filename' => $workData['title'] . '_' . api_get_local_time(),
'pdf_title' => replace_dangerous_char($workData['title']),
'course_code' => $courseInfo['code'],
'add_signatures' => false
);
$pdf = new PDF('A4', null, $params);
$pdf->html_to_pdf_with_template($content);
}
exit;
}

Loading…
Cancel
Save