diff --git a/README.md b/README.md index 692c420..5ae8de3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ moodle_certificates =================== -Certificados Moodle personalizados para o Interlegis +Certificados Moodle personalizados para o Interlegis. + +Para instalar, siga os passos: + +1. Instale o Módulo padrão de certificados Moodle (https://moodle.org/plugins/view.php?plugin=mod_certificate); +2. Clone este repositório em um diretório temporário; +3. Copie todas os subdiretórios deste repositório para /mod/certificate. diff --git a/pix/borders/interlegis.png b/pix/borders/interlegis.png new file mode 100755 index 0000000..143f482 Binary files /dev/null and b/pix/borders/interlegis.png differ diff --git a/pix/seals/brasao-armas.png b/pix/seals/brasao-armas.png new file mode 100644 index 0000000..e08c995 Binary files /dev/null and b/pix/seals/brasao-armas.png differ diff --git a/pix/signatures/assinaturas-2011.jpg b/pix/signatures/assinaturas-2011.jpg new file mode 100644 index 0000000..1a22b25 Binary files /dev/null and b/pix/signatures/assinaturas-2011.jpg differ diff --git a/pix/signatures/verse-assinaturas-2011.jpg b/pix/signatures/verse-assinaturas-2011.jpg new file mode 100644 index 0000000..b159dca Binary files /dev/null and b/pix/signatures/verse-assinaturas-2011.jpg differ diff --git a/pix/watermarks/Interlegis-BID.png b/pix/watermarks/Interlegis-BID.png new file mode 100644 index 0000000..504b94c Binary files /dev/null and b/pix/watermarks/Interlegis-BID.png differ diff --git a/pix/watermarks/Senado.png b/pix/watermarks/Senado.png new file mode 100755 index 0000000..fd4ce88 Binary files /dev/null and b/pix/watermarks/Senado.png differ diff --git a/type/Ficha_inscricao/certificate.php b/type/Ficha_inscricao/certificate.php new file mode 100644 index 0000000..732b4fa --- /dev/null +++ b/type/Ficha_inscricao/certificate.php @@ -0,0 +1,159 @@ +. + +/** + * A4_embedded certificate type + * + * @package mod + * @subpackage certificate + * @copyright Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +if (!defined('MOODLE_INTERNAL')) { + die('Direct access to this script is forbidden.'); // It must be included from view.php +} + +$pdf = new PDF($certificate->orientation, 'mm', 'A4', true, 'UTF-8', false); + +$pdf->SetTitle($certificate->name); +$pdf->setPrintHeader(false); +$pdf->setPrintFooter(false); +$pdf->SetAutoPageBreak(false, 0); +$pdf->AddPage(); + +// Define variables +$x = 10; +$y = 25; +$sealx = 10; +$sealy = 15; +$sigx = 140; +$sigy = 276; +$custx = 10; +$custy = 250; +$wmarkx = 26; +$wmarky = 58; +$wmarkw = 158; +$wmarkh = 170; +$brdrx = 0; +$brdry = 0; +$brdrw = 210; +$brdrh = 297; +$codey = 250; + +// Formated variables for printing +$data_nascimento = userdate($USER->profile['datanascimento'], get_string('strftimedate', 'langconfig')); +$data_admissao = userdate($USER->profile['dataadmissao'], get_string('strftimedate', 'langconfig')); +$hoje = userdate(time(), get_string('strftimedate', 'langconfig')); + +// 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(1); +certificate_print_image($pdf, $certificate, CERT_IMAGE_SEAL, $sealx, $sealy, '', ''); +certificate_print_image($pdf, $certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy, '', ''); + +// Add boxes +$pdf->SetLineStyle(array('width' => 0.6, 'color' => array(0, 0, 0))); +$pdf->Rect($x, $y+44, $brdrw-20, 7); +$pdf->Rect($x, $y+113, $brdrw-20, 7); +$pdf->Rect($x, $y+161, $brdrw-20, 7); + +// Add text +$pdf->SetTextColor(0, 0, 0); +certificate_print_text($pdf, $x+25, $y-5, 'L', 'freesans', '', 14, 'SENADO FEDERAL'); +certificate_print_text($pdf, $x+25, $y+2, 'L', 'freesans', '', 12, 'Instituto Legislativo Brasileiro - ILB'); +certificate_print_text($pdf, $x, $y+16, 'C', 'freesans', 'B', 14, $certificate->name); +certificate_print_text($pdf, $x, $y+30, 'C', 'freesans', 'B', 12, $course->fullname); + +certificate_print_text($pdf, $x, $y+45, 'C', 'freesans', 'B', 10, 'DADOS PESSOAIS'); +certificate_print_text($pdf, $x, $y+55, 'L', 'freesans', '', 10, 'NOME: '.fullname($USER)); +certificate_print_text($pdf, $x, $y+62, 'L', 'freesans', '', 10, "RG: {$USER->profile['RG']}"); +certificate_print_text($pdf, $x+60, $y+62, 'L', 'freesans', '',10,"ÓRGÃO EMISSOR: {$USER->profile['ORGAOEMISSOR']}"); +certificate_print_text($pdf, $x+130, $y+62, 'L', 'freesans', '', 10, "CPF: {$USER->profile['cpf']}"); +certificate_print_text($pdf, $x, $y+69, 'L', 'freesans', '', 10, "DATA DE NASCIMENTO: $data_nascimento"); +certificate_print_text($pdf, $x+130, $y+69, 'L', 'freesans', '', 10, "SEXO: {$USER->profile['Sexo']}"); +certificate_print_text($pdf, $x, $y+76, 'L', 'freesans', '', 10, "NACIONALIDADE: {$USER->profile['nacionalidade']}"); +certificate_print_text($pdf, $x+60, $y+76, 'L', 'freesans', '', 10, "NATURALIDADE: {$USER->profile['naturalidade']}"); +certificate_print_text($pdf, $x, $y+83, 'L', 'freesans', '', 10, "RESIDÊNCIA: {$USER->profile['endereco']}"); +certificate_print_text($pdf, $x, $y+90, 'L', 'freesans', '', 10, "BAIRRO: {$USER->profile['bairro']}"); +certificate_print_text($pdf, $x+60, $y+90, 'L', 'freesans', '', 10, "CIDADE: {$USER->city}"); +certificate_print_text($pdf, $x+110, $y+90, 'R', 'freesans', '', 10, "UF: {$USER->profile['estado']} CEP: {$USER->profile['cep']}"); +certificate_print_text($pdf, $x, $y+97, 'L', 'freesans', '', 10, "TEL.RESIDENCIAL: {$USER->profile['telefone']}"); +certificate_print_text($pdf, $x+110, $y+97, 'L', 'freesans', '', 10, "CELULAR: {$USER->profile['celular']}"); +certificate_print_text($pdf, $x, $y+104, 'L', 'freesans', '', 10, "E-MAIL: {$USER->email}"); + +certificate_print_text($pdf, $x, $y+114, 'C', 'freesans', 'B', 10, 'DADOS PROFISSIONAIS'); +certificate_print_text($pdf, $x, $y+124, 'L', 'freesans', '', 10, "ÓRGÃO: {$USER->profile['orgao']}"); +certificate_print_text($pdf, $x, $y+131, 'L', 'freesans', '', 10, "LOTAÇÃO: {$USER->profile['lotacao']}"); +certificate_print_text($pdf, $x, $y+138, 'L', 'freesans', '', 10, "CARGO: {$USER->profile['cargo']}"); +certificate_print_text($pdf, $x+100, $y+138, 'L', 'freesans', '', 10, "FUNÇÃO: {$USER->profile['funcao']}"); +certificate_print_text($pdf, $x, $y+145, 'L', 'freesans', '', 10, "DATA DE ADMISSÃO: $data_admissao"); +certificate_print_text($pdf, $x+100, $y+145, 'L', 'freesans', '', 10, "MATRÍCULA: {$USER->profile['matricula']}"); +certificate_print_text($pdf, $x, $y+152, 'L', 'freesans', '', 10, "TELEFONE: {$USER->profile['telefonetrabalho']}"); + +certificate_print_text($pdf, $x, $y+162, 'C', 'freesans', 'B', 10, 'FORMAÇÃO ACADÊMICA'); +certificate_print_text($pdf, $x, $y+169, 'L', 'freesans', 'BU', 10, "GRADUAÇÃO:"); +certificate_print_text($pdf, $x+27, $y+169, 'L', 'freesans', 'I', 10, "(informe o curso mais recente)"); +certificate_print_text($pdf, $x+10, $y+176, 'L', 'freesans', '', 10, "CURSO: {$USER->profile['graduacaocurso']}"); +certificate_print_text($pdf, $x+10, $y+183, 'L', 'freesans', '', 10, "INSTITUIÇÃO: {$USER->profile['graduacaoinstituicao']}"); +certificate_print_text($pdf, $x+10, $y+190, 'L', 'freesans', '', 10, "ANO DE CONCLUSÃO: {$USER->profile['graduacaoano']}"); +certificate_print_text($pdf, $x, $y+197, 'L', 'freesans', 'BU', 10, "PÓS-GRADUAÇÃO:"); +certificate_print_text($pdf, $x+36, $y+197, 'L', 'freesans', 'I', 10, "(informe o curso de maior grau)"); +certificate_print_text($pdf, $x+10, $y+204, 'L', 'freesans', '', 10, "CURSO: {$USER->profile['poscurso']}"); +certificate_print_text($pdf, $x+10, $y+211, 'L', 'freesans', '', 10, "INSTITUIÇÃO: {$USER->profile['posinstituicao']}"); +certificate_print_text($pdf, $x+10, $y+218, 'L', 'freesans', '', 10, "ANO DE CONCLUSÃO: {$USER->profile['posano']}"); + +certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $certificate->customtext); + +certificate_print_text($pdf, $x+10, $sigy-13, 'R', 'freesans', '', 10, "Brasília, $hoje"); + + + + + + + +/* +$pdf->SetTextColor(0, 0, 0); +certificate_print_text($pdf, $x, $y + 20, 'C', 'freeserif', '', 20, get_string('certify', 'certificate')); +certificate_print_text($pdf, $x, $y + 36, 'C', 'freesans', '', 30, fullname($USER)); +certificate_print_text($pdf, $x, $y + 55, 'C', 'freesans', '', 20, get_string('statement', 'certificate')); +certificate_print_text($pdf, $x, $y + 72, 'C', 'freesans', '', 20, $course->fullname); +certificate_print_text($pdf, $x, $y + 92, 'C', 'freesans', '', 14, certificate_get_date($certificate, $certrecord, $course)); +certificate_print_text($pdf, $x, $y + 102, 'C', 'freeserif', '', 10, certificate_get_grade($certificate, $course)); +certificate_print_text($pdf, $x, $y + 112, 'C', 'freeserif', '', 10, certificate_get_outcome($certificate, $course)); +if ($certificate->printhours) { + certificate_print_text($pdf, $x, $y + 122, 'C', 'freeserif', '', 10, get_string('credithours', 'certificate') . ': ' . $certificate->printhours); +} +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);*/ +?> diff --git a/type/Interlegis/certificate.php b/type/Interlegis/certificate.php new file mode 100644 index 0000000..d2e46e1 --- /dev/null +++ b/type/Interlegis/certificate.php @@ -0,0 +1,117 @@ +. + +/** + * A4_embedded certificate type + * + * @package mod + * @subpackage certificate + * @copyright Mark Nelson + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +if (!defined('MOODLE_INTERNAL')) { + die('Direct access to this script is forbidden.'); // It must be included from view.php +} + +$pdf = new PDF($certificate->orientation, 'mm', 'A4', true, 'UTF-8', false); + +$pdf->SetTitle($certificate->name); +$pdf->setPrintHeader(false); +$pdf->setPrintFooter(false); +$pdf->SetAutoPageBreak(false, 0); +$pdf->AddPage(); + +// Define variables +// This certificate prints only in Landscape format +$x = 10; +$y = 12; +$sealx = 10; +$sealy = 10; +$sigx = 17; +$sigy = 112; +$custx = 10; +$custy = 40; +$wmarkx = 40; +$wmarky = 31; +$wmarkw = 212; +$wmarkh = 148; +$brdrx = 0; +$brdry = 0; +$brdrw = 297; +$brdrh = 210; +$codey = 185; + +// Add images and lines to border +certificate_print_image($pdf, $certificate, CERT_IMAGE_BORDER, $brdrx, $brdry, $brdrw, $brdrh); +certificate_draw_frame($pdf, $certificate); +// Set alpha to semi-transparency (watermark) +$pdf->SetAlpha(0.2); +certificate_print_image($pdf, $certificate, CERT_IMAGE_WATERMARK, $wmarkx, $wmarky, $wmarkw, $wmarkh); +// Add seal & signature images +$pdf->SetAlpha(1); +certificate_print_image($pdf, $certificate, CERT_IMAGE_SEAL, $sealx, $sealy, '', ''); +certificate_print_text($pdf, $sealx-1, $sealy+21, 'L', 'freesans', 'B', 6, 'SENADO FEDERAL'); +certificate_print_image($pdf, $certificate, CERT_IMAGE_SIGNATURE, $sigx, $sigy, '', ''); + +// Add text +$pdf->SetTextColor(0, 0, 128); +certificate_print_text($pdf, $x, $y, 'C', 'freesans', 'B', 30, get_string('title', 'certificate')); +$pdf->SetTextColor(0, 0, 0); +certificate_print_text($pdf, $x, $y + 14, 'C', 'freesans', 'B', 18, 'SECRETARIA ESPECIAL DO INTERLEGIS'); +certificate_print_text($pdf, $x, $y + 26, 'C', 'freeserif', 'B', 16, get_string('certify', 'certificate')); +certificate_print_text($pdf, $x, $y + 38, 'C', 'freesans', '', 24, mb_strtoupper(fullname($USER), 'UTF-8')); +$statement = get_string('statement', 'certificate')." '$course->fullname'"; +certificate_print_text($pdf, $x, $y + 55, 'C', 'freesans', '', 18, $statement); +certificate_print_text($pdf, $x, $y + 65, 'C', 'freesans', '', 18, 'realizado no período de '.strip_tags($course->summary)); +if ($certificate->printhours) { + certificate_print_text($pdf, $x, $y + 85, 'C', 'freeserif', '', 14, get_string('credithours', 'certificate') . ': ' . $certificate->printhours); +} +certificate_print_text($pdf, $x, $codey, 'L', 'freesans', '', 10, 'Código de validação: '.certificate_get_code($certificate, $certrecord)); +certificate_print_text($pdf, $x, $codey + 6, 'L', 'freesans', '', 10, 'Emitido em: ' . certificate_get_date($certificate, $certrecord, $course)); + +// Reverse page +$pdf->AddPage(); + +// Add images and lines to border +certificate_print_image($pdf, $certificate, CERT_IMAGE_BORDER, $brdrx, $brdry, $brdrw, $brdrh); +certificate_draw_frame($pdf, $certificate); +// Set alpha to semi-transparency (watermark) +$pdf->SetAlpha(0.2); +certificate_print_image($pdf, $certificate, CERT_IMAGE_WATERMARK, $wmarkx, $wmarky, $wmarkw, $wmarkh); +// Add seal image +$pdf->SetAlpha(1); +certificate_print_image($pdf, $certificate, CERT_IMAGE_SEAL, $sealx, $sealy, '', ''); +certificate_print_text($pdf, $sealx-1, $sealy+21, 'L', 'freesans', 'B', 6, 'SENADO FEDERAL'); + +// Add verse signature image - hack: uses 'verse-{imagename}' to get a different image ;) +$type = CERT_IMAGE_SIGNATURE; +$path = "$CFG->dirroot/mod/certificate/pix/$type/verse-$certificate->printsignature"; +$uploadpath = "$CFG->dataroot/mod/certificate/pix/$type/verse-$certificate->printsignature"; +if (file_exists($path)) { + $pdf->Image($path, $sigx+170, $sigy+45, '', ''); +} elseif (file_exists($uploadpath)) { + $pdf->Image($uploadpath, $sigx+170, $sigy+45, '', ''); +} + +// Add text +$pdf->SetTextColor(0, 0, 128); +certificate_print_text($pdf, $x+20, $y+5, 'C', 'freesans', 'B', 24, $course->fullname); +$pdf->SetTextColor(0, 0, 0); +certificate_print_text($pdf, $custx, $custy, 'L', 'freesans', 'B', 12, 'CONTEÚDO PROGRAMÁTICO'); +certificate_print_text($pdf, $custx+10, $custy+10, 'L', 'freesans', '', 12, $certificate->customtext); +?>