|
|
@ -8,14 +8,15 @@ |
|
|
|
require_once '../main/inc/global.inc.php'; |
|
|
|
require_once '../main/inc/global.inc.php'; |
|
|
|
|
|
|
|
|
|
|
|
$action = isset($_GET['action']) ? $_GET['action'] : null; |
|
|
|
$action = isset($_GET['action']) ? $_GET['action'] : null; |
|
|
|
|
|
|
|
|
|
|
|
$certificate = new Certificate($_GET['id']); |
|
|
|
$certificate = new Certificate($_GET['id']); |
|
|
|
|
|
|
|
|
|
|
|
switch ($action) { |
|
|
|
switch ($action) { |
|
|
|
case 'export': |
|
|
|
case 'export': |
|
|
|
$hideExportLink = api_get_setting('hide_certificate_export_link'); |
|
|
|
$hideExportLink = api_get_setting('hide_certificate_export_link'); |
|
|
|
$hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students'); |
|
|
|
$hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students'); |
|
|
|
if ($hideExportLink === 'true' || (api_is_student() && $hideExportLinkStudent === 'true')) { |
|
|
|
if ($hideExportLink === 'true' || |
|
|
|
|
|
|
|
(api_is_student() && $hideExportLinkStudent === 'true') |
|
|
|
|
|
|
|
) { |
|
|
|
api_not_allowed(true); |
|
|
|
api_not_allowed(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -24,12 +25,12 @@ switch ($action) { |
|
|
|
if ($certificate->isHtmlFileGenerated()) { |
|
|
|
if ($certificate->isHtmlFileGenerated()) { |
|
|
|
$certificatePathList[] = $certificate->html_file; |
|
|
|
$certificatePathList[] = $certificate->html_file; |
|
|
|
|
|
|
|
|
|
|
|
$pdfParams = array( |
|
|
|
$pdfParams = [ |
|
|
|
'top' => 0, |
|
|
|
'top' => 0, |
|
|
|
'right' => 0, |
|
|
|
'right' => 0, |
|
|
|
'bottom' => 0, |
|
|
|
'bottom' => 0, |
|
|
|
'left' => 0 |
|
|
|
'left' => 0 |
|
|
|
); |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$orientation = api_get_configuration_value('certificate_pdf_orientation'); |
|
|
|
$orientation = api_get_configuration_value('certificate_pdf_orientation'); |
|
|
|
$pdfParams['orientation'] = 'landscape'; |
|
|
|
$pdfParams['orientation'] = 'landscape'; |
|
|
@ -39,7 +40,9 @@ switch ($action) { |
|
|
|
|
|
|
|
|
|
|
|
$pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4'; |
|
|
|
$pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4'; |
|
|
|
$userInfo = api_get_user_info($certificate->user_id); |
|
|
|
$userInfo = api_get_user_info($certificate->user_id); |
|
|
|
$pdfName = api_replace_dangerous_char(get_lang('Certificate').' '.$userInfo['username']); |
|
|
|
$pdfName = api_replace_dangerous_char( |
|
|
|
|
|
|
|
get_lang('Certificate').' '.$userInfo['username'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams); |
|
|
|
$pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams); |
|
|
|
$pdf->html_to_pdf( |
|
|
|
$pdf->html_to_pdf( |
|
|
|