Fix wrong HTML in custom certificate plugin see BT#14143

pull/2543/head
jmontoyaa 8 years ago
parent 3449aa17c9
commit 90d29cac10
  1. 16
      plugin/customcertificate/src/print_certificate.php

@ -101,7 +101,7 @@ if (empty($infoCertificate)) {
$workSpace = intval(297 - $infoCertificate['margin_left'] - $infoCertificate['margin_right']); $workSpace = intval(297 - $infoCertificate['margin_left'] - $infoCertificate['margin_right']);
$widthCell = intval($workSpace / 6); $widthCell = intval($workSpace / 6);
$htmlText = ''; $htmlText = '<html>';
$htmlText .= ' $htmlText .= '
<link rel="stylesheet" <link rel="stylesheet"
type="text/css" type="text/css"
@ -115,14 +115,12 @@ foreach ($userList as $userInfo) {
$studentId = $userInfo['user_id']; $studentId = $userInfo['user_id'];
if (empty($infoCertificate['background'])) { if (empty($infoCertificate['background'])) {
$htmlText .= '<div class="caraA" style="padding:0; page-break-before:always;" margin:0; padding:0;>'; $htmlText .= '<div class="caraA" style="page-break-before:always; margin:0px; padding:0px;">';
} else { } else {
$urlBackground = $path.$infoCertificate['background']; $urlBackground = $path.$infoCertificate['background'];
$htmlText .= ' $htmlText .= ' <div
<div class="caraA" class = "caraA"
style="background-image:url('.$urlBackground.') no-repeat; background-image-resize:6;" style = "background-image:url('.$urlBackground.') no-repeat; background-image-resize:6; margin:0px; padding:0px;">';
margin:0;
padding:0;>';
} }
if (!empty($infoCertificate['logo_left'])) { if (!empty($infoCertificate['logo_left'])) {
@ -314,7 +312,7 @@ foreach ($userList as $userInfo) {
$htmlText .= '</div>'; $htmlText .= '</div>';
// Rear certificate // Rear certificate
$htmlText .= '<div class="caraB" style="page-break-before:always;" margin:0; padding:0;>'; $htmlText .= '<div class="caraB" style="page-break-before:always; margin:0px; padding:0px;">';
if ($infoCertificate['contents_type'] == 0) { if ($infoCertificate['contents_type'] == 0) {
$courseDescription = new CourseDescription(); $courseDescription = new CourseDescription();
$contentDescription = $courseDescription->get_data_by_description_type(3, $courseId, 0); $contentDescription = $courseDescription->get_data_by_description_type(3, $courseId, 0);
@ -443,7 +441,7 @@ foreach ($userList as $userInfo) {
} }
$htmlText .= '</div>'; $htmlText .= '</div>';
} }
$htmlText .= '</body>'; $htmlText .= '</body></html>';
$fileName = 'certificate_'.date("Ymd_His"); $fileName = 'certificate_'.date("Ymd_His");
$params = [ $params = [
'filename' => $fileName, 'filename' => $fileName,

Loading…
Cancel
Save