public function pdfListarAssociacaoMoradoresCidadao($id) { try { $obj = new BDAssociacaoMoradores(); $busca = $obj->buscarAssociacaoMoradoresID($id)->fetch(PDO::FETCH_OBJ); $mpdf = new mPDF(); $mpdf->allow_charset_conversion = true; // Gerando conteúdo do PDF ob_start(); $html = ob_get_clean(); $html = utf8_encode($html); $html .= "<table class='table'>"; $html .= "<thead>"; $html .= "<tr>"; $html .= "<th> ID </th>"; $html .= "<td> CPF </th>"; $html .= "<td> RG </th>"; $html .= "<td> CNH </td>"; $html .= "<th> Nome </th>"; $html .= "<th> Endereço </th>"; $html .= "<th> Bairro </th>"; $html .= "<th> E-Mail </th>"; $html .= "<th> Telefone </th>"; $html .= "<th> Observações </th>"; $html .= "</tr>"; $html .= "</thead>"; $html .= "<tbody>"; $lista = $this->listarAssociacaoMoradoresCidadaoID($id)->fetchAll(PDO::FETCH_OBJ); foreach ($lista as $linha) { $html .= "<tr>"; $html .= "<td> {$linha->id_cidadao} </td>"; $html .= "<td> {$linha->nome_cidadao} </td>"; $html .= "<td> {$linha->cpf_cidadao} </td>"; $html .= "<td> {$linha->rg_cidadao} </td>"; $html .= "<td> {$linha->cnh_cidadao} </td>"; $html .= "<td> {$linha->rua_cidada} </td>"; $html .= "<td> {$linha->bairro_cidadao} </td>"; $html .= "<td> {$linha->telefone1_cidadao} </td>"; $html .= "<td> {$linha->email_cidadao}</td>"; $html .= "<td> {$linha->info_cidadao} </td>"; $html .= "</tr>"; } $html .= "</tbody>"; $html .= "</table>"; $mpdf->WriteHTML($html); $mpdf->Output('lista cidadãos da associação : ' . $busca->nome_associacao_moradores . '-' . date("d-m-y") . '.pdf', 'D'); header("Location : listaAssociacaoMoradores.php"); exit; } catch (Exception $ex) { echo "Erro: {$ex}"; } }
public function removerAssociacaoMoradores($id) { try { $associacaoMoradores = new BDAssociacaoMoradores(); $res = $associacaoMoradores->removerAssociacaoMoradores($id); return $res; } catch (Exception $ex) { echo "Erro: {$ex}"; } }