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 certificadoPalestranteAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $this->autenticacao(); $sessao = Zend_Auth::getInstance()->getIdentity(); $id_pessoa = $sessao["idPessoa"]; $id_evento = $this->_getParam('id', 0); $model = new Application_Model_Participante(); $rs = $model->listarCertificadosPalestrante($id_pessoa, $id_evento); // palestrante em evento_palestrante if (is_null($rs)) { $rs = $model->listarCertificadosPalestrantesOutros($id_pessoa, $id_evento); } if (is_null($rs)) { $this->_helper->flashMessenger->addMessage(array('danger' => 'Você não apresentou esse trabalho neste Encontro.')); return $this->_helper->redirector->goToRoute(array('controller' => 'participante', 'action' => 'certificados'), 'default', true); } try { $certificado = new Sige_Pdf_Certificado(); // Get PDF document as a string $pdfData = $certificado->palestranteEvento(array('nome' => $rs['nome'], 'id_encontro' => $rs['id_encontro'], 'encontro' => $rs['nome_encontro'], 'tipo_evento' => $rs['nome_tipo_evento'], 'nome_evento' => $rs['nome_evento'], 'carga_horaria' => $rs['carga_horaria'])); $filename = "certificado_palestrante_" . $this->_stringToFilename($rs["nome_encontro"]) . "_" . $this->_stringToFilename($rs["nome_evento"]) . ".pdf"; header("Content-Disposition: inline; filename={$filename}"); header("Content-type: application/x-pdf"); echo $pdfData; } catch (Exception $e) { $this->_helper->flashMessenger->addMessage(array('danger' => _('An unexpected error ocurred.<br/> Details: ') . $e->getMessage())); return $this->_helper->redirector->goToRoute(array('controller' => 'participante', 'action' => 'certificados'), 'default', true); } }