function certificate_preview in Certificate 7.3
Same name and namespace in other branches
- 8.3 certificate.pages.inc \certificate_preview()
- 6.2 certificate.pages.inc \certificate_preview()
- 6 certificate.pages.inc \certificate_preview()
- 7.2 certificate.pages.inc \certificate_preview()
- 3.x certificate.pages.inc \certificate_preview()
Preview certificate template as PDF.
1 string reference to 'certificate_preview'
- certificate_menu in ./
certificate.module - Implements hook_menu().
File
- ./
certificate.pages.inc, line 183 - certificate.pages.inc Functions for generating certificates.
Code
function certificate_preview($cid) {
global $user;
$template = entity_load_single('certificate', $cid);
if ($template) {
$page = theme('certificate_certificate', array(
'node' => NULL,
'account' => $user,
'template' => $template,
));
$css = drupal_get_css();
$output = "<html><head><meta charset=\"utf-8\"/>{$css}</head><body>{$page}</body></html>";
}
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', '');
if ($print_pdf_pdf_tool == '') {
drupal_set_message(t('Certificate cannot be displayed because you have not selected a PDF generation tool in !link.', array(
'!link' => l('Printer, e-mail and PDF versions', 'admin/config/user-interface/print/pdf'),
)) . '.', 'error');
return '';
}
certificate_print_pdf_wrapper(entity_label('certificate', $template) . '.pdf', $output, $template->orientation);
}