コード例 #1
0
// Add images and lines
certificate_print_image($pdf, $certificate, CERT_IMAGE_BORDER, $brdrx, $brdry, $brdrw, $brdrh);
certificate_draw_frame($pdf, $certificate);
// Set alpha to semi-transparency
$pdf->SetAlpha(0.2);
certificate_print_image($pdf, $certificate, CERT_IMAGE_WATERMARK, $wmarkx, $wmarky, $wmarkw, $wmarkh);
$pdf->SetAlpha(2);
certificate_print_image($pdf, $certificate, CERT_IMAGE_SEAL, $sealx, $sealy, '', '');
certificate_print_image($pdf, $certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy, '', '');
// Add text
$pdf->SetTextColor(0, 0, 0);
certificate_print_text($pdf, $x, $y + 68, 'C', 'freesans', '', 20, fullname($USER));
if ($certificate->printhours) {
    certificate_print_text($pdf, $x, $y + 81, 'C', 'freesans', '', 12, get_string('credithours', 'certificate') . ' ' . $certificate->printhours);
}
certificate_print_text($pdf, $x, $y + 113, 'C', 'freesans', '', 20, $course->fullname);
certificate_print_text($pdf, $x, $y + 139, 'C', 'freesans', '', 12, certificate_get_date($certificate, $certrecord, $course));
certificate_print_text($pdf, $x + 90, $y + 160, 'C', 'freesans', '', 16, certificate_get_date($certificate, $certrecord, $course));
certificate_print_text($pdf, $x, $codey, 'C', 'freeserif', '', 10, certificate_get_code($certificate, $certrecord));
$i = 0;
if ($certificate->printteacher) {
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    if ($teachers = get_users_by_capability($context, 'mod/certificate:printteacher', '', $sort = 'u.lastname ASC', '', '', '', '', false)) {
        foreach ($teachers as $teacher) {
            $i++;
            certificate_print_text($pdf, $sigx, $sigy + $i * 4, 'L', 'freeserif', '', 12, fullname($teacher));
        }
    }
}
certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $certificate->customtext);
コード例 #2
0
// Tipo de certificado
$pdf->SetTextColor(199, 12, 70);
certificate_print_text($pdf, 80, 170, 'C', 'Helvetica', '', 20, '<b>"PREVENCIÓN DE RIESGOS LABORALES"</b>');
// Tipo de certificado
$pdf->SetTextColor(0, 0, 0);
certificate_print_text($pdf, 75, 230, 'C', 'freesans', '', 14, 'Otorgado a D/Dª <b>' . $USER->firstname . ' ' . $USER->lastname . '</b>, con DNI: <b>' . $USER->idnumber . '</b>, al haber superado con éxito el módulo formativo correspondiente, obteniendo una calificación en el exámen final de <b>' . $nota . '</b> puntos.');
certificate_print_text($pdf, 75, 310, 'C', 'freesans', '', 14, 'Este curso ha sido coordinado e impartido por <b>Ananda Gestión ETT</b> a través de su plataforma virtual de formación, y finalizado por el alumno/a el día <b>' . $fecha_f_01 . ' de ' . $fecha_f_02 . ' de ' . $fecha_f_03 . '</b>.');
certificate_print_text($pdf, 75, 390, 'C', 'freesans', '', 14, 'Y para que así conste, se expide este certificado en Madrid a ' . date("d") . ' ' . strftime("de %B de %Y") . '.');
certificate_print_text($pdf, 97, 500, 'L', 'freesans', '', 10, '<b>Firma y sello de la empresa</b>');
certificate_print_text($pdf, 90, 630, 'L', 'freesans', '', 9, '<i>Habiendo promovido esta formación</i>');
certificate_print_text($pdf, 110, 642, 'L', 'freesans', '', 9, '<i>para el alumno participante</i>');
certificate_print_text($pdf, 385, 500, 'L', 'freesans', '', 10, '<b>Firma del trabajador</b>');
certificate_print_text($pdf, 370, 630, 'L', 'freesans', '', 9, '<i>Reconociendo la participación y</i>');
certificate_print_text($pdf, 375, 642, 'L', 'freesans', '', 9, '<i>recepción de esta Formación</i>');
certificate_print_text($pdf, 75, 780, 'C', 'freesans', '', 10, 'Según el artículo 19 de la Ley 31/1995. de noviembre, de Prevención de Riesgos Laborales');
//página 2
$pdf->AddPage();
certificate_print_text($pdf, 75, 45, 'C', 'freesans', '', 14, '<b>Contenidos impartidos:</b>');
certificate_print_text($pdf, 70, 80, 'L', 'freesans', '', 12, '01. Conceptos básicos');
certificate_print_text($pdf, 70, 95, 'L', 'freesans', '', 12, '02. Derechos y deberes');
certificate_print_text($pdf, 70, 110, 'L', 'freesans', '', 12, '03. Riesgos ligados a los viajes laborales');
certificate_print_text($pdf, 70, 125, 'L', 'freesans', '', 12, '04. Riesgos ligados a la superficie de trabajo');
certificate_print_text($pdf, 70, 140, 'L', 'freesans', '', 12, '05. Riesgos ligados al uso de herramientas');
certificate_print_text($pdf, 70, 155, 'L', 'freesans', '', 12, '06. Riesgos ligados al uso de equipos de trabajo y electricidad');
certificate_print_text($pdf, 70, 170, 'L', 'freesans', '', 12, '07. Riesgo de incendio');
certificate_print_text($pdf, 70, 185, 'L', 'freesans', '', 12, '08. Riesgos ligados al almacenamiento, manipulación y transporte');
certificate_print_text($pdf, 70, 200, 'L', 'freesans', '', 12, '09. Riesgos ligados al medio ambiente de trabajo');
certificate_print_text($pdf, 70, 215, 'L', 'freesans', '', 12, '10. Sistemas elementales de control de riesgo');
certificate_print_text($pdf, 70, 230, 'L', 'freesans', '', 12, '11. Nociones básicas de actuación de emergencia');
certificate_print_text($pdf, 70, 245, 'L', 'freesans', '', 12, '12. Control de la salud de los trabajadores');
//$pdf->Output('example_058.pdf', 'D'); //Por si se quiere descargar directamente
コード例 #3
0
/**
 * Sends text to output given the following params.
 *
 * @deprecated since certificate version 2012052501
 * @param stdClass $pdf
 * @param int $x horizontal position
 * @param int $y vertical position
 * @param char $align L=left, C=center, R=right
 * @param string $font any available font in font directory
 * @param char $style ''=normal, B=bold, I=italic, U=underline
 * @param int $size font size in points
 * @param string $text the text to print
 * @return null
 */
function cert_printtext($pdf, $x, $y, $align, $font, $style, $size, $text)
{
    static $hasbeenwarned = false;
    if (!$hasbeenwarned) {
        debugging('cert_printtext is deprecated, please use certificate_print_text instead', DEBUG_DEVELOPER);
    }
    $hasbeenwarned = true;
    certificate_print_text($pdf, $x, $y, $align, $font, $style, $size, $text);
}
コード例 #4
0
 public function get_pdf()
 {
     parent::get_pdf();
     $pdf = new PDF($this->certificate->orientation, 'pt', 'Letter', true, 'UTF-8', false);
     $pdf->SetTitle($this->certificate->name);
     $pdf->SetProtection(array('modify'));
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetAutoPageBreak(false, 0);
     $pdf->AddPage();
     // Define variables
     // Landscape
     if ($this->certificate->orientation == 'L') {
         $x = 28;
         $y = 125;
         $sealx = 590;
         $sealy = 425;
         $sigx = 130;
         $sigy = 440;
         $custx = 133;
         $custy = 440;
         $wmarkx = 100;
         $wmarky = 90;
         $wmarkw = 600;
         $wmarkh = 420;
         $brdrx = 0;
         $brdry = 0;
         $brdrw = 792;
         $brdrh = 612;
         $codey = 505;
     } else {
         // Portrait
         $x = 28;
         $y = 170;
         $sealx = 440;
         $sealy = 590;
         $sigx = 85;
         $sigy = 580;
         $custx = 88;
         $custy = 580;
         $wmarkx = 78;
         $wmarky = 130;
         $wmarkw = 450;
         $wmarkh = 480;
         $brdrx = 10;
         $brdry = 10;
         $brdrw = 594;
         $brdrh = 771;
         $codey = 660;
     }
     // Add images and lines
     certificate_print_image($pdf, $this->certificate, CERT_IMAGE_BORDER, $brdrx, $brdry, $brdrw, $brdrh);
     certificate_draw_frame_letter($pdf, $this->certificate);
     // Set alpha to semi-transparency
     $pdf->SetAlpha(0.1);
     certificate_print_image($pdf, $this->certificate, CERT_IMAGE_WATERMARK, $wmarkx, $wmarky, $wmarkw, $wmarkh);
     $pdf->SetAlpha(1);
     certificate_print_image($pdf, $this->certificate, CERT_IMAGE_SEAL, $sealx, $sealy, '', '');
     certificate_print_image($pdf, $this->certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy, '', '');
     // Add text
     $pdf->SetTextColor(0, 0, 120);
     certificate_print_text($pdf, $x, $y, 'C', 'Helvetica', '', 30, get_string('title', 'certificate'));
     $pdf->SetTextColor(0, 0, 0);
     certificate_print_text($pdf, $x, $y + 55, 'C', 'Times', '', 20, get_string('certify', 'certificate'));
     certificate_print_text($pdf, $x, $y + 105, 'C', 'Helvetica', '', 30, fullname($this->user));
     certificate_print_text($pdf, $x, $y + 155, 'C', 'Helvetica', '', 20, get_string('statement', 'certificate'));
     certificate_print_text($pdf, $x, $y + 205, 'C', 'Helvetica', '', 20, format_string($this->course->fullname));
     certificate_print_text($pdf, $x, $y + 255, 'C', 'Helvetica', '', 14, certificate_get_date($this->certificate, $this->certificateissue, $this->course));
     certificate_print_text($pdf, $x, $y + 283, 'C', 'Times', '', 10, certificate_get_grade($this->certificate, $this->course));
     certificate_print_text($pdf, $x, $y + 311, 'C', 'Times', '', 10, certificate_get_outcome($this->certificate, $this->course));
     if ($this->certificate->printhours) {
         certificate_print_text($pdf, $x, $y + 339, 'C', 'Times', '', 10, get_string('credithours', 'certificate') . ': ' . $this->certificate->printhours);
     }
     certificate_print_text($pdf, $x, $codey, 'C', 'Times', '', 10, certificate_get_code($this->certificate, $this->certificateissue));
     $i = 0;
     if ($this->certificate->printteacher) {
         $context = context_module::instance($this->coursemodule->id);
         if ($teachers = get_users_by_capability($context, 'mod/certificate:printteacher', '', $sort = 'u.lastname ASC', '', '', '', '', false)) {
             foreach ($teachers as $teacher) {
                 $i++;
                 certificate_print_text($pdf, $sigx, $sigy + $i * 12, 'L', 'Times', '', 12, fullname($teacher));
             }
         }
     }
     certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $this->certificate->customtext);
     return $pdf;
 }