Browse Source

Modificações solicitadas pela Sônia no certificado

temp
Sesostris Vieira 11 years ago
parent
commit
ed40b90b03
  1. 64
      type/ILB_Sem_tutoria_2014/certificate.php

64
type/ILB_Sem_tutoria_2014/certificate.php

@ -29,47 +29,31 @@ if (!defined('MOODLE_INTERNAL')) {
} }
/** /**
* Calcs the course start and end date to the user * Gets the course start date (for ILB start date is the date of enrollment)
* using user enrollment timestart and timeend * and completion date from course completion framework.
* Finally format them to print
*/ */
require_once("$CFG->dirroot/enrol/locallib.php"); require_once("$CFG->dirroot/completion/completion_completion.php");
$enrol_manager = new course_enrolment_manager($PAGE, $course); $cc = new completion_completion(array('userid'=>$USER->id, 'course'=>$course->id));
$user_enrols = $enrol_manager->get_user_enrolments($USER->id);
$start_date = NULL; $start_date = $cc->timeenrolled;
$end_date = NULL; $end_date = $cc->timecompleted;
foreach ($user_enrols as $enrol) {
if ($enrol->timestart > 0) { $fmt = '%d/%m/%Y'; // Default format
$start_date = $enrol->timestart; if ($certificate->datefmt == 1) {
}
if ($enrol->timeend > 0) {
$end_date = $enrol->timeend;
}
}
if ($start_date > 0 and $end_date > 0) {
$fmt = '%d/%m/%Y'; // Default format
if ($certificate->datefmt == 1) {
$fmt = '%B %d, %Y'; $fmt = '%B %d, %Y';
$certificatedate = userdate($ts, '%B %d, %Y') . " a " . userdate($te, '%B %d, %Y'); } else if ($certificate->datefmt == 2) {
} else if ($certificate->datefmt == 2) {
$suffix = certificate_get_ordinal_number_suffix(userdate($ts, '%d')); $suffix = certificate_get_ordinal_number_suffix(userdate($ts, '%d'));
$fmt = '%B %d' . $suffix . ', %Y'; $fmt = '%B %d' . $suffix . ', %Y';
$certificatedate = userdate($ts, '%B %d' . $suffix . ', %Y') . " a " . userdate($te, '%B %d' . $suffix . ', %Y'); } else if ($certificate->datefmt == 3) {
} else if ($certificate->datefmt == 3) {
$fmt = '%d %B %Y'; $fmt = '%d %B %Y';
$certificatedate = userdate($ts, '%d %B %Y') . " a " . userdate($te, '%d %B %Y'); } else if ($certificate->datefmt == 4) {
} else if ($certificate->datefmt == 4) {
$fmt = '%B %Y'; $fmt = '%B %Y';
$certificatedate = userdate($ts, '%B %Y') . " a " . userdate($te, '%B %Y'); } else if ($certificate->datefmt == 5) {
} else if ($certificate->datefmt == 5) {
$fmt = get_string('strftimedate', 'langconfig'); $fmt = get_string('strftimedate', 'langconfig');
$certificatedate = userdate($ts, get_string('strftimedate', 'langconfig')) . " a " . userdate($te, get_string('strftimedate', 'langconfig'));
}
$start_date = userdate($start_date, $fmt);
$end_date = userdate($end_date, $fmt);
} else {
$start_date = '<falha>';
$end_date = '<falha>';
} }
$start_date = userdate($start_date, $fmt);
$end_date = userdate($end_date, $fmt);
$pdf = new PDF($certificate->orientation, 'mm', 'A4', true, 'UTF-8', false); $pdf = new PDF($certificate->orientation, 'mm', 'A4', true, 'UTF-8', false);
@ -141,14 +125,16 @@ certificate_print_image($pdf, $certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy,
// Add text // Add text
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
certificate_print_text($pdf, $x, $y, 'C', 'freesans', '', 20, get_string('title', 'certificate')); certificate_print_text($pdf, $x, $y, 'C', 'freesans', '', 20, get_string('title', 'certificate'));
certificate_print_text($pdf, $x, $y + 15, 'C', 'freesans', '', 20, get_string('certify', 'certificate')); certificate_print_text($pdf, $x, $y + 15, 'C', 'freesans', '', 18, get_string('certify', 'certificate'));
certificate_print_text($pdf, $x, $y + 27, 'C', 'freesans', 'B', 20, mystrtoupper(fullname($USER)).", CPF nº {$USER->profile['cpf']}"); certificate_print_text($pdf, $x, $y + 25, 'C', 'freesans', 'B', 18, mystrtoupper(fullname($USER)).", CPF nº {$USER->profile['cpf']}");
certificate_print_text($pdf, $x, $y + 39, 'C', 'freesans', '', 20, "realizou, no período de {$start_date} a {$end_date}, o curso sem tutoria"); certificate_print_text($pdf, $x, $y + 35, 'C', 'freesans', '', 18, "realizou, na modalidade a distância, o curso sem tutoria");
certificate_print_text($pdf, $x, $y + 51, 'C', 'freesans', 'B', 20, mystrtoupper($course->fullname)); certificate_print_text($pdf, $x, $y + 45, 'C', 'freesans', 'B', 18, mystrtoupper($course->fullname));
certificate_print_text($pdf, $x, $y + 55, 'C', 'freesans', '', 18, "no período de {$start_date} a {$end_date}");
if ($certificate->printhours) { if ($certificate->printhours) {
certificate_print_text($pdf, $x, $y + 63, 'C', 'freesans', '', 20, "com carga horária de {$certificate->printhours} na modalidade a distância."); certificate_print_text($pdf, $x, $y + 65, 'C', 'freesans', '', 18, "com carga horária de {$certificate->printhours}");
} }
certificate_print_text($pdf, $x, $y + 82, 'R', 'freesans', 'B', 14, "Brasília, " . certificate_get_date($certificate, $certrecord, $course)); certificate_print_text($pdf, $x, $y + 75, 'C', 'freesans', '', 18, certificate_get_grade($certificate, $course));
certificate_print_text($pdf, $x, $y + 85, 'R', 'freesans', 'B', 14, "Brasília, " . certificate_get_date($certificate, $certrecord, $course));
// Verse page ----------------------------------------------------------------------------------------------------------- // Verse page -----------------------------------------------------------------------------------------------------------
$pdf->AddPage(); $pdf->AddPage();

Loading…
Cancel
Save