Esempio n. 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);
$pdf->SetAlpha(0.2);
certificate_print_image($pdf, $certificate, CERT_IMAGE_WATERMARK, $wmarkx, $wmarky, $wmarkw, $wmarkh);
$pdf->SetAlpha(1);
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, 120);
certificate_print_text($pdf, $x, $y, 'C', $fontsans, '', 30, get_string('title', 'certificate'));
$pdf->SetTextColor(0, 0, 0);
certificate_print_text($pdf, $x, $y + 20, 'C', $fontserif, '', 20, get_string('certify', 'certificate'));
certificate_print_text($pdf, $x, $y + 36, 'C', $fontsans, '', 30, fullname($USER));
certificate_print_text($pdf, $x, $y + 55, 'C', $fontsans, '', 20, get_string('statement', 'certificate'));
certificate_print_text($pdf, $x, $y + 72, 'C', $fontsans, '', 20, format_string($course->fullname));
certificate_print_text($pdf, $x, $y + 92, 'C', $fontsans, '', 14, certificate_get_date($certificate, $certrecord, $course));
certificate_print_text($pdf, $x, $y + 102, 'C', $fontserif, '', 10, certificate_get_grade($certificate, $course));
certificate_print_text($pdf, $x, $y + 112, 'C', $fontserif, '', 10, certificate_get_outcome($certificate, $course));
if ($certificate->printhours) {
    certificate_print_text($pdf, $x, $y + 122, 'C', $fontserif, '', 10, get_string('credithours', 'certificate') . ': ' . $certificate->printhours);
}
certificate_print_text($pdf, $x, $codey, 'C', $fontserif, '', 10, certificate_get_code($certificate, $certrecord));
$i = 0;
if ($certificate->printteacher) {
    $context = context_module::instance($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', $fontserif, '', 12, fullname($teacher));
        }
    }
}
certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $certificate->customtext);
Esempio n. 3
0
$pdf->SetTextColor(0, 0, 0);
// set text to black
certificate_print_text($pdf, $x, $y + 28, 'C', 'Helvetica', '', 14, get_string('erpcertify', 'certificate'));
certificate_print_text($pdf, $x, $y + 54, 'C', 'loversquarrel', '', 50, fullname($USER));
certificate_print_text($pdf, $x, $y + 93, 'C', 'Helvetica', '', 14, get_string('erpstatement', 'certificate'));
certificate_print_text($pdf, $x, $y + 116, 'C', 'Helvetica', '', 20, $course->fullname);
certificate_print_text($pdf, $x, $y + 146, 'C', 'Helvetica', '', 14, certificate_get_date($certificate, $certrecord, $course));
certificate_print_text($pdf, $x, $y + 160, 'C', 'Helvetica', '', 10, certificate_get_grade($certificate, $course));
certificate_print_text($pdf, $x, $y + 170, 'C', 'Helvetica', '', 10, certificate_get_outcome($certificate, $course));
if ($USER->profile['Tradingname']) {
    certificate_print_text($pdf, $x + 20, $y + 207, 'L', 'Helvetica', '', 12, $USER->profile['Tradingname']);
}
if ($certificate->printhours) {
    certificate_print_text($pdf, $x, $y + 122, 'C', 'Times', '', 10, get_string('credithours', 'certificate') . ': ' . $certificate->printhours);
}
$pdf->SetTextColor(200, 200, 200);
// set text to light grey
certificate_print_text($pdf, $x, $codey, 'C', 'Helvetica', '', 8, certificate_get_code($certificate, $certrecord));
$i = 0;
if ($certificate->printteacher) {
    $context = context_module::instance($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', 'Times', '', 12, fullname($teacher));
        }
    }
}
$pdf->SetTextColor(0, 0, 0);
// set text to black
certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $certificate->customtext);
Esempio n. 4
0
$pdf->SetAlpha(0.2);
certificate_print_image($pdf, $certificate, CERT_IMAGE_WATERMARK, $wmarkx, $wmarky, $wmarkw, $wmarkh);
$pdf->SetAlpha(1);
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, 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 + 20, 'C', 'Times', '', 20, get_string('certify', 'certificate'));
certificate_print_text($pdf, $x, $y + 36, 'C', 'Helvetica', '', 30, fullname($USER));
certificate_print_text($pdf, $x, $y + 55, 'C', 'Helvetica', '', 20, get_string('statement', 'certificate'));
certificate_print_text($pdf, $x, $y + 72, 'C', 'Helvetica', '', 20, $course->fullname);
certificate_print_text($pdf, $x, $y + 92, 'C', 'Helvetica', '', 14, certificate_get_date($certificate, $certrecord, $course));
certificate_print_text($pdf, $x, $y + 102, 'C', 'Times', '', 10, certificate_get_grade($certificate, $course));
certificate_print_text($pdf, $x, $y + 112, 'C', 'Times', '', 10, certificate_get_outcome($certificate, $course));
if ($certificate->printhours) {
    certificate_print_text($pdf, $x, $y + 122, 'C', 'Times', '', 10, get_string('credithours', 'certificate') . ': ' . $certificate->printhours);
}
certificate_print_text($pdf, $x, $codey, 'C', 'Times', '', 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', 'Times', '', 12, fullname($teacher));
        }
    }
}
certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $certificate->customtext);
 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;
 }