public function mostraragentesAction() { $this->_helper->layout->disableLayout(); $ag = new Agentes(); if (isset($_POST['cnpjcpf'])) { $cnpjcpf = $_POST['cnpjcpf']; $nome = $_POST['nome']; $cnpjcpfSemMask = Mascara::delMaskCPFCNPJ($cnpjcpf); if ($cnpjcpf != '') { $wh['CNPJCPF = ?'] = Mascara::delMaskCPFCNPJ($cnpjcpf); $where['ag.CNPJCPF = ?'] = Mascara::delMaskCPFCNPJ($cnpjcpf); $buscaAgente = $ag->buscar($wh); if ($buscaAgente->count() == 0) { echo " <input type='hidden' id='novoproponente' value='" . $cnpjcpfSemMask . "' />\n <table class='tabela' style='margin:1% auto; width:40%;'>\n <tr>\n <td class='red centro'>Proponente não cadastrado! Deseja cadastrar agora?</td>\n <td class='centro'><input type='button' class='btn_cadastrar_proponente' id='novoprop' onclick='novoproponente();' /></td>\n </tr>\n </table>"; exit; } } if ($nome != '') { $where["nm.Descricao like (?)"] = "%" . $nome . "%"; } $buscarvinculo = $ag->buscarNovoProponente($where, $this->idResponsavel); if ($buscarvinculo->count() > 0) { $this->montaTela('vincularresponsavel/mostraragentes.phtml', array('vinculo' => $buscarvinculo, 'idResponsavel' => $this->idResponsavel)); } else { echo "<div id='msgAgenteVinculado'>Nenhum registro encontrado!</div>\n <script>\n alertModal(null, 'msgAgenteVinculado', null, 150);\n </script>"; exit; } } else { $where = array(); $where["vp.idUsuarioResponsavel = ?"] = $this->idUsuario; //$where["v.siVinculo = ?"] = 2; $buscarvinculo = $ag->buscarAgenteVinculoProponente($where); // xd($buscarvinculo); $this->montaTela('vincularresponsavel/mostraragentes.phtml', array('vinculo' => $buscarvinculo)); } }