public function gerarCertificadoPreview($id_encontro, $tipo_mensagem) { $certificado = new Sige_Pdf_Certificado(); switch ($tipo_mensagem) { case "certificados_template_participante_encontro": $pdf = $certificado->participanteEncontro(array('nome' => 'JOHN JOAOZINHO', 'id_encontro' => $id_encontro, 'encontro' => 'I ENCONTRO DE SOFTWARE LIVRE')); break; case "certificados_template_palestrante_evento": $pdf = $certificado->palestranteEvento(array('nome' => 'JOHN JOAOZINHO', 'id_encontro' => $id_encontro, 'encontro' => 'I ENCONTRO DE SOFTWARE LIVRE', 'tipo_evento' => 'PALESTRA', 'nome_evento' => 'SOFTWARE LIVRE NAS ESCOLAS', 'carga_horaria' => '1')); break; case "certificados_template_participante_evento": $pdf = $certificado->participanteEvento(array('nome' => 'JOHN JOAOZINHO', 'id_encontro' => $id_encontro, 'encontro' => 'I ENCONTRO DE SOFTWARE LIVRE', 'tipo_evento' => 'PALESTRA', 'nome_evento' => 'SOFTWARE LIVRE NAS ESCOLAS', 'carga_horaria' => '1')); break; default: throw new Exception(_('Certificate type unknow.')); } return $pdf; }
public function certificadoParticipanteEncontroAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $this->autenticacao(); $sessao = Zend_Auth::getInstance()->getIdentity(); $id_pessoa = $sessao["idPessoa"]; $id_encontro = $this->_getParam('id_encontro', 0); $model = new Application_Model_Participante(); $rs = $model->listarCertificadosParticipanteEncontro($id_pessoa, $id_encontro); if (is_null($rs)) { $this->_helper->flashMessenger->addMessage(array('error' => 'Este certificado ainda não está disponível.')); return $this->_helper->redirector->goToRoute(array('controller' => 'participante', 'action' => 'certificados'), 'default', true); } try { $certificado = new Sige_Pdf_Certificado(); $pdfData = $certificado->participanteEncontro(array('nome' => $rs['nome'], 'id_encontro' => $rs['id_encontro'], 'encontro' => $rs['nome_encontro'])); $filename = "certificado_participante_" . $this->_stringToFilename($rs["nome_encontro"]) . ".pdf"; header("Content-Disposition: inline; filename={$filename}"); header("Content-type: application/x-pdf"); echo $pdfData; } catch (Exception $e) { $this->_helper->flashMessenger->addMessage(array('danger' => 'Ocorreu um erro inesperado.<br/>Detalhes: ' . $e->getMessage())); return $this->_helper->redirector->goToRoute(array('controller' => 'participante', 'action' => 'certificados'), 'default', true); } }