public function processarMarcasAction()
 {
     if ($_POST['justificativa'] != '') {
         $dados = array('stAtivoDocumentoProjeto' => $_POST['stAtivo']);
         $where = array('idDocumento = ?' => $_POST['documento']);
         $tbDocumentoProjeto = new tbDocumentoProjeto();
         $resultado = $tbDocumentoProjeto->update($dados, $where);
         if ($resultado) {
             if ($_POST['stAtivo'] == 'D') {
                 $msg = 'A Marca foi DEFERIDA com sucesso!';
                 $assunto = 'SALIC - Marca Deferida';
             } else {
                 $msg = 'A Marca foi INDEFERIDA com sucesso!';
                 $assunto = 'SALIC - Marca Indeferida';
                 $dados = array('dsDocumento' => utf8_decode($_POST['justificativa']));
                 $where = array('idDocumento = ?' => $_POST['documento']);
                 $tbDocumento = new tbDocumento();
                 $resultado2 = $tbDocumento->update($dados, $where);
             }
             $projetos = new Projetos();
             $ListaEmails = $projetos->buscarProjetoEmails($_POST['pronacId']);
             if (count($ListaEmails) > 0) {
                 foreach ($ListaEmails as $lista) {
                     $EnviarEmails = new EmailDAO();
                     $EnviarEmails->enviarEmail($lista->Email, $assunto, utf8_decode($_POST['justificativa']));
                 }
             }
             echo json_encode(array('resposta' => true, 'mensagem' => $msg));
         } else {
             echo json_encode(array('resposta' => false));
         }
     } else {
         echo json_encode(array('resposta' => false));
     }
     die;
 }
 public function excluirArquivoAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout->disableLayout();
     $get = Zend_Registry::get('get');
     $idArquivo = $get->idArquivo;
     $idDocumento = $get->idDocumento;
     try {
         $db = Zend_Registry::get('db');
         $db->setFetchMode(Zend_DB::FETCH_OBJ);
         $db->beginTransaction();
         // ================= APAGA DOCUMENTO PROPOSTA ==================//
         if (!empty($this->idPreProjeto)) {
             $tbDocProposta = new tbDocumentoProposta();
             $tbDocProposta->excluir("idProposta = {$this->idPreProjeto} and idDocumento= {$idDocumento} ");
         }
         // ================= APAGA DOCUMENTO PROJETO ===================//
         if (!empty($this->idPronac)) {
             $tbDocProjeto = new tbDocumentoProjeto();
             $tbDocProjeto->excluir("idPronac = {$this->idPronac} and idDocumento= {$idDocumento} ");
         }
         $tbDocumento = new tbDocumento();
         $tbDocumento->excluir("idArquivo = {$idArquivo} and idDocumento= {$idDocumento} ");
         $tbArquivoImagem = new tbArquivoImagem();
         $tbArquivoImagem->excluir("idArquivo =  {$idArquivo} ");
         $tbArquivo = new tbArquivo();
         $tbArquivo->excluir("idArquivo = {$idArquivo} ");
         $db->commit();
         $mensagem = "Arquivo excluído com sucesso!";
         $script = "window.parent.jqAjaxLinkSemLoading('" . $this->view->baseUrl() . "/upload/listar-arquivo-marca{$this->cod}', '', 'listaDeArquivos');\n";
         $this->montaTela("upload/mensagem.phtml", array("mensagem" => $mensagem, "tipoMensagem" => "CONFIRM", "script" => $script));
         return;
     } catch (Exception $e) {
         //xd($e->getMessage());
         $db->rollBack();
         $mensagem = "Não foi possível realizar a operação.";
         $script = "window.parent.jqAjaxLinkSemLoading('" . $this->view->baseUrl() . "/upload/listar-arquivo-marca{$this->cod}', '', 'listaDeArquivos');\n";
         $this->montaTela("upload/mensagem.phtml", array("mensagem" => $mensagem, "script" => $script, "tipoMensagem" => "ERROR"));
         return;
     }
 }