Exemple #1
0
 public function salvar($dados)
 {
     //INSTANCIANDO UM OBJETO DE ACESSO AOS DADOS DA TABELA
     $tmpTbPergunta = new tbPergunta();
     if (isset($dados['nrPergunta'])) {
         $tmpRsTbPergunta = $tmpTbPergunta->find($dados['nrPergunta'])->current();
     } else {
         $tmpRsTbPergunta = $tmpTbPergunta->createRow();
     }
     //ATRIBUINDO VALORES AOS CAMPOS QUE FORAM PASSADOS
     if (isset($dados['stTipoRespPergunta'])) {
         $tmpRsTbPergunta->stTipoRespPergunta = $dados['stTipoRespPergunta'];
     }
     if (isset($dados['dsPergunta'])) {
         $tmpRsTbPergunta->dsPergunta = $dados['dsPergunta'];
     }
     if (isset($dados['dtCadastramento'])) {
         $tmpRsTbPergunta->dtCadastramento = $dados['dtCadastramento'];
     }
     if (isset($dados['idPessoaCadastro'])) {
         $tmpRsTbPergunta->idPessoaCadastro = $dados['idPessoaCadastro'];
     }
     //SALVANDO O OBJETO CRIADO
     $id = $tmpRsTbPergunta->save();
     if ($id) {
         return $id;
     } else {
         return false;
     }
 }
 public function dadosetiquetaAction()
 {
     //ini_set('max_execution_time', 500);
     $this->_helper->layout->disableLayout();
     // Desabilita o Zend Layout
     if (isset($_GET['pronac'])) {
         $pronac = $_GET['pronac'];
         $etiquetaApenas = "nao";
         if (!empty($_GET['etiqueta'])) {
             $etiquetaApenas = $_GET['etiqueta'];
         }
         $this->view->etiquetaApenas = $etiquetaApenas;
         $barcodeOptions = array('text' => $pronac);
         $rendererOptions = array();
         $documentRoot = explode("/index.php", $_SERVER["DOCUMENT_ROOT"] . $_SERVER["PHP_SELF"]);
         $documentRoot = str_replace("//", "/", $documentRoot[0]);
         $caminho = $documentRoot . "/public/barcode/imagem-" . $pronac . ".jpg";
         //            $caminho = "../public/barcode/imagem-".$pronac.".jpg";
         $imageResource = Zend_Barcode::draw('code39', 'image', $barcodeOptions, $rendererOptions);
         imagejpeg($imageResource, $caminho);
         $caminhoView = "../public/barcode/imagem-" . $pronac . ".jpg";
         $this->view->caminho = $caminhoView;
         $projetosDAO = new Projetos();
         $consulta = array('pro.AnoProjeto + pro.Sequencial = ?' => $pronac);
         $resp = $projetosDAO->buscarEditalProjeto($consulta);
         $idPreProjeto = $resp->idPreProjeto;
         if (!empty($resp->idEdital)) {
             $this->view->edital = true;
         } else {
             $this->view->edital = false;
         }
         //DADOS DA ETIQUETA
         $dados = GerenciarparecertecnicoDAO::dadosEtiqueta($pronac);
         $this->view->DadosEtiqueta = $dados;
         $dao = new AnalisarPropostaDAO();
         $this->view->itensGeral = $dao->buscarGeral($idPreProjeto);
         $propostaPorEdital = false;
         if ($this->view->itensGeral[0]->idEdital && $this->view->itensGeral[0]->idEdital != 0) {
             $propostaPorEdital = true;
         }
         $this->view->itensTelefone = $dao->buscarTelefone($this->view->itensGeral[0]->idAgente);
         $this->view->itensPlanosDistribuicao = $dao->buscarPlanoDeDistribucaoProduto($idPreProjeto);
         $this->view->itensFonteRecurso = $dao->buscarFonteDeRecurso($idPreProjeto);
         $this->view->itensLocalRealiazacao = $dao->buscarLocalDeRealizacao($idPreProjeto);
         $this->view->itensDeslocamento = $dao->buscarDeslocamento($idPreProjeto);
         $this->view->itensPlanoDivulgacao = $dao->buscarPlanoDeDivulgacao($idPreProjeto);
         $tblDocsPreProjeto = new tbDocumentosPreProjeto();
         $rsDocsPreProjeto = $tblDocsPreProjeto->buscar(array("idProjeto = ?" => $idPreProjeto));
         $this->view->itensDocumentoPreProjeto = $rsDocsPreProjeto;
         $this->view->itensDocumentoAgente = $dao->buscarDocumentoAgente($this->view->itensGeral[0]->idAgente);
         $this->view->itensHistorico = $dao->buscarHistorico($idPreProjeto);
         $this->view->itensPlanilhaOrcamentaria = $dao->buscarPlanilhaOrcamentaria($idPreProjeto);
         $buscarProduto = ManterorcamentoDAO::buscarProdutos($idPreProjeto);
         $this->view->Produtos = $buscarProduto;
         $buscarEtapa = ManterorcamentoDAO::buscarEtapasProdutos($idPreProjeto);
         $this->view->Etapa = $buscarEtapa;
         $buscarItem = ManterorcamentoDAO::buscarItensProdutos($idPreProjeto);
         $this->view->Item = $buscarItem;
         $this->view->AnaliseCustos = PreProjeto::analiseDeCustos($idPreProjeto);
         $this->view->idPreProjeto = $idPreProjeto;
         $buscarIdPronac = $projetosDAO->buscarIdPronac($pronac);
         $idPronac = $buscarIdPronac->IdPRONAC;
         $rst = $projetosDAO->buscarDadosUC75($idPronac);
         $this->view->projeto = $rst[0];
         //UNIDADES DE ANÁLISE
         $vwProjetoDistribuidoVinculada = new vwProjetoDistribuidoVinculada();
         $this->view->unidadesAnalise = $vwProjetoDistribuidoVinculada->buscarUnidades(array('Pronac = ?' => $pronac), array('Produto', 'DescricaoAnalise'));
         //VALORES DO PROJETO
         $planilhaproposta = new PlanilhaProposta();
         $planilhaprojeto = new PlanilhaProjeto();
         $planilhaAprovacao = new PlanilhaAprovacao();
         $rsPlanilhaAtual = $planilhaAprovacao->buscar(array('IdPRONAC = ?' => $idPronac), array('dtPlanilha DESC'))->current();
         $tpPlanilha = !empty($rsPlanilhaAtual) && $rsPlanilhaAtual->tpPlanilha == 'SE' ? 'SE' : 'CO';
         $arrWhereSomaPlanilha = array();
         $arrWhereSomaPlanilha['idPronac = ?'] = $idPronac;
         if ($this->bln_readequacao == "false") {
             $fonteincentivo = $planilhaproposta->somarPlanilhaProposta($idPreProjeto, 109);
             $outrasfontes = $planilhaproposta->somarPlanilhaProposta($idPreProjeto, false, 109);
             $parecerista = $planilhaprojeto->somarPlanilhaProjeto($idPreProjeto, 109);
         } else {
             $arrWhereFontesIncentivo = $arrWhereSomaPlanilha;
             $arrWhereFontesIncentivo['idPlanilhaItem <> ? '] = '206';
             //elaboracao e agenciamento
             $arrWhereFontesIncentivo['tpPlanilha = ? '] = 'SR';
             $arrWhereFontesIncentivo['stAtivo = ? '] = 'N';
             $arrWhereFontesIncentivo['NrFonteRecurso = ? '] = '109';
             $arrWhereFontesIncentivo["idPedidoAlteracao = (?)"] = new Zend_Db_Expr("(SELECT TOP 1 max(idPedidoAlteracao) from SAC.dbo.tbPlanilhaAprovacao where IdPRONAC = '{$idPronac}')");
             $arrWhereFontesIncentivo["tpAcao <> ('E') OR tpAcao IS NULL "] = '(?)';
             $fonteincentivo = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWhereFontesIncentivo);
             $arrWhereOutrasFontes = $arrWhereSomaPlanilha;
             $arrWhereOutrasFontes['idPlanilhaItem <> ? '] = '206';
             //elaboracao e agenciamento
             $arrWhereOutrasFontes['tpPlanilha = ? '] = 'SR';
             $arrWhereOutrasFontes['stAtivo = ? '] = 'N';
             $arrWhereOutrasFontes['NrFonteRecurso <> ? '] = '109';
             $arrWhereOutrasFontes["idPedidoAlteracao = (?)"] = new Zend_Db_Expr("(SELECT TOP 1 max(idPedidoAlteracao) from SAC.dbo.tbPlanilhaAprovacao where IdPRONAC = '{$idPronac}')");
             $arrWhereOutrasFontes["tpAcao <> ('E') OR tpAcao IS NULL "] = '(?)';
             $outrasfontes = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWhereOutrasFontes);
             $arrWherePlanilhaPA = $arrWhereSomaPlanilha;
             $arrWherePlanilhaPA['idPlanilhaItem <> ? '] = '206';
             //elaboracao e agenciamento
             $arrWherePlanilhaPA['tpPlanilha = ? '] = 'PA';
             $arrWherePlanilhaPA['stAtivo = ? '] = 'N';
             $arrWherePlanilhaPA['NrFonteRecurso = ? '] = '109';
             $arrWherePlanilhaPA["idPedidoAlteracao = (?)"] = new Zend_Db_Expr("(SELECT TOP 1 max(idPedidoAlteracao) from SAC.dbo.tbPlanilhaAprovacao where IdPRONAC = '{$idPronac}')");
             $arrWherePlanilhaPA["tpAcao <> ('E') OR tpAcao IS NULL "] = '(?)';
             $parecerista = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWherePlanilhaPA);
         }
         //valor do componetne
         $arrWhereSomaPlanilha = array();
         $arrWhereSomaPlanilha['idPronac = ?'] = $idPronac;
         $arrWhereSomaPlanilha['idPlanilhaItem <> ? '] = '206';
         //elaboracao e agenciamento
         $arrWhereSomaPlanilha['tpPlanilha = ? '] = $tpPlanilha;
         $arrWhereSomaPlanilha['NrFonteRecurso = ? '] = '109';
         $arrWhereSomaPlanilha['stAtivo = ? '] = 'S';
         $componente = $planilhaAprovacao->somarItensPlanilhaAprovacao($arrWhereSomaPlanilha);
         $valoresProjeto = new ArrayObject();
         $valoresProjeto['fontesincentivo'] = $fonteincentivo['soma'];
         $valoresProjeto['outrasfontes'] = $outrasfontes['soma'];
         $valoresProjeto['valorproposta'] = $fonteincentivo['soma'] + $outrasfontes['soma'];
         $valoresProjeto['valorparecerista'] = $parecerista['soma'];
         $valoresProjeto['valorcomponente'] = $componente['soma'];
         $this->view->valoresDoProjeto = $valoresProjeto;
         $tblCaptacao = new Captacao();
         $rsCount = $tblCaptacao->buscaCompleta(array('idPronac = ?' => $idPronac), array(), null, null, true);
         $this->view->totalGeralCaptado = $rsCount->totalGeralCaptado;
         /***************** FIM  - MODO NOVO ********************/
         if ($propostaPorEdital) {
             $tbFormDocumentoDAO = new tbFormDocumento();
             $edital = $tbFormDocumentoDAO->buscar(array('idEdital = ?' => $this->view->itensGeral[0]->idEdital, 'idClassificaDocumento not in (?,24,25)' => 23));
             $arrPerguntas = array();
             $arrRespostas = array();
             $tbPerguntaDAO = new tbPergunta();
             $tbRespostaDAO = new tbResposta();
             foreach ($edital as $registro) {
                 $questoes = $tbPerguntaDAO->montarQuestionario($registro["nrFormDocumento"], $registro["nrVersaoDocumento"]);
                 $questionario = '';
                 if (is_object($questoes) and count($questoes) > 0) {
                     foreach ($questoes as $questao) {
                         $resposta = '';
                         $where = array('nrFormDocumento = ?' => $registro["nrFormDocumento"], 'nrVersaoDocumento = ?' => $registro["nrVersaoDocumento"], 'nrPergunta = ?' => $questao->nrPergunta, 'idProjeto = ?' => $idPreProjeto);
                         $resposta = $tbRespostaDAO->buscar($where);
                         $arrPerguntas[$registro["nrFormDocumento"]]["titulo"] = $registro["nmFormDocumento"];
                         $arrPerguntas[$registro["nrFormDocumento"]]["pergunta"][] = $questao->toArray();
                         $arrRespostas[] = $resposta->toArray();
                     }
                 }
             }
             $this->view->perguntas = $arrPerguntas;
             $this->view->respostas = $arrRespostas;
         }
     }
     if (isset($_POST['html']) && isset($_POST['pronac']) && isset($_POST['caminho'])) {
         ini_set('max_execution_time', 500);
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         /* converte para lê os arquivos html do word */
         //$html = mb_convert_encoding($_POST['html'], 'UTF-8', 'HTML-ENTITIES');
         //$html = $this->strip_quotes($this->unhtmlentities($_POST['html']));
         $filter = new Zend_Filter();
         //$filter->addFilter(new Zend_Filter_Alnum());
         //$filter->addFilter(new Zend_Filter_Alpha());
         //$filter->addFilter(new Zend_Filter_Digits());
         //$filter->addFilter(new Zend_Filter_HtmlEntities());
         $filter->addFilter(new Zend_Filter_StringTrim());
         $filter->addFilter(new Zend_Filter_StripTags());
         //            $html = $filter->filter($_POST['html']);
         $html = $_POST['html'];
         //            echo $html;
         //            die;
         $pdf = new PDFCreator($html);
         //            $pdf = new PDF($html, 'pdf');
         $pdf->gerarPdf();
         //            $pdf->gerarRelatorio();
         //            die;
         /*
                     $html = $_POST['html'];
                     $pdf = new PDF($html, 'pdf');
                     echo $pdf->gerarRelatorio();*/
     }
 }
 public function imprimirpropostaculturalAction()
 {
     $this->_helper->layout->disableLayout();
     $idPreProjeto = $this->idPreProjeto;
     $dao = new AnalisarPropostaDAO();
     $this->view->itensGeral = AnalisarPropostaDAO::buscarGeral($idPreProjeto);
     $propostaPorEdital = false;
     if ($this->view->itensGeral[0]->idEdital && $this->view->itensGeral[0]->idEdital != 0) {
         $propostaPorEdital = true;
     }
     $this->view->itensTelefone = AnalisarPropostaDAO::buscarTelefone($this->view->itensGeral[0]->idAgente);
     $this->view->itensPlanosDistribuicao = AnalisarPropostaDAO::buscarPlanoDeDistribucaoProduto($idPreProjeto);
     $this->view->itensFonteRecurso = AnalisarPropostaDAO::buscarFonteDeRecurso($idPreProjeto);
     $this->view->itensLocalRealiazacao = AnalisarPropostaDAO::buscarLocalDeRealizacao($idPreProjeto);
     $this->view->itensDeslocamento = AnalisarPropostaDAO::buscarDeslocamento($idPreProjeto);
     $this->view->itensPlanoDivulgacao = AnalisarPropostaDAO::buscarPlanoDeDivulgacao($idPreProjeto);
     $tblAvaliacaoProposta = new AvaliacaoProposta();
     $rsAvaliacaoProposta = $tblAvaliacaoProposta->buscar(array("idProjeto = ?" => $idPreProjeto, "idArquivo ?" => new Zend_Db_Expr("IS NOT NULL")));
     $tbArquivo = new tbArquivo();
     $arrDadosArquivo = array();
     $arrRelacionamentoAvaliacaoDocumentosExigidos = array();
     if (count($rsAvaliacaoProposta) > 0) {
         foreach ($rsAvaliacaoProposta as $avaliacao) {
             $arrDadosArquivo[$avaliacao->idArquivo] = $tbArquivo->buscar(array("idArquivo = ?" => $avaliacao->idArquivo));
             $arrRelacionamentoAvaliacaoDocumentosExigidos[$avaliacao->idArquivo] = $avaliacao->idCodigoDocumentosExigidos;
         }
     }
     $this->view->relacionamentoAvaliacaoDocumentosExigidos = $arrRelacionamentoAvaliacaoDocumentosExigidos;
     $this->view->itensDocumentoPreProjeto = $arrDadosArquivo;
     //PEGANDO RELACAO DE DOCUMENTOS EXIGIDOS(GERAL, OU SEJA, TODO MUNDO)
     $tblDocumentosExigidos = new DocumentosExigidos();
     $rsDocumentosExigidos = $tblDocumentosExigidos->buscar()->toArray();
     $arrDocumentosExigidos = array();
     foreach ($rsDocumentosExigidos as $documentoExigido) {
         $arrDocumentosExigidos[$documentoExigido["Codigo"]] = $documentoExigido;
     }
     $this->view->documentosExigidos = $arrDocumentosExigidos;
     $this->view->itensHistorico = AnalisarPropostaDAO::buscarHistorico($idPreProjeto);
     /*
      * PEGANDO DOCUMENTOS ANEXADOS
      */
     $tblAvaliacaoProposta = new AvaliacaoProposta();
     $rsAvaliacaoProposta = $tblAvaliacaoProposta->buscar(array("idProjeto = ?" => $idPreProjeto, "idArquivo ?" => new Zend_Db_Expr("IS NOT NULL")));
     $tbArquivo = new tbArquivo();
     $arrDadosArquivo = array();
     $arrRelacionamentoAvaliacaoDocumentosExigidos = array();
     if (count($rsAvaliacaoProposta) > 0) {
         foreach ($rsAvaliacaoProposta as $avaliacao) {
             $arrDadosArquivo[$avaliacao->idArquivo] = $tbArquivo->buscar(array("idArquivo = ?" => $avaliacao->idArquivo));
             $arrRelacionamentoAvaliacaoDocumentosExigidos[$avaliacao->idArquivo] = $avaliacao->idCodigoDocumentosExigidos;
         }
     }
     //x($arrRelacionamentoAvaliacaoDocumentosExigidos);
     $this->view->relacionamentoAvaliacaoDocumentosExigidos = $arrRelacionamentoAvaliacaoDocumentosExigidos;
     $this->view->itensDocumentoPreProjeto = $arrDadosArquivo;
     //PEGANDO RELACAO DE DOCUMENTOS EXIGIDOS(GERAL, OU SEJA, TODO MUNDO)
     $tblDocumentosExigidos = new DocumentosExigidos();
     $rsDocumentosExigidos = $tblDocumentosExigidos->buscar()->toArray();
     $arrDocumentosExigidos = array();
     foreach ($rsDocumentosExigidos as $documentoExigido) {
         $arrDocumentosExigidos[$documentoExigido["Codigo"]] = $documentoExigido;
     }
     //xd($arrDocumentosExigidos);
     $this->view->documentosExigidos = $arrDocumentosExigidos;
     //xd($rsDocumentosExigidos);
     /*
      * FINAL - PEGANDO DOCUMENTOS ANEXADOS
      */
     $this->view->itensPlanilhaOrcamentaria = $dao->buscarPlanilhaOrcamentaria($idPreProjeto);
     $buscarProduto = ManterorcamentoDAO::buscarProdutos($this->idPreProjeto);
     $this->view->Produtos = $buscarProduto;
     $buscarEtapa = ManterorcamentoDAO::buscarEtapasProdutos($this->idPreProjeto);
     $this->view->Etapa = $buscarEtapa;
     $buscarItem = ManterorcamentoDAO::buscarItensProdutos($this->idPreProjeto);
     $this->view->Item = $buscarItem;
     $this->view->AnaliseCustos = PreProjeto::analiseDeCustos($this->idPreProjeto);
     $this->view->idPreProjeto = $this->idPreProjeto;
     //========== inicio codigo dirigente ================
     /*==================================================*/
     $arrMandatos = array();
     $this->view->mandatos = $arrMandatos;
     $preProjeto = new PreProjeto();
     $rsDirigentes = array();
     $Empresa = $preProjeto->buscar(array('idPreProjeto = ?' => $this->idPreProjeto))->current();
     $idEmpresa = $Empresa->idAgente;
     if (isset($this->view->itensGeral[0]->CNPJCPFdigirente) && $this->view->itensGeral[0]->CNPJCPFdigirente != "") {
         $tblAgente = new Agentes();
         $tblNomes = new Nomes();
         foreach ($this->view->itensGeral as $v) {
             $rsAgente = $tblAgente->buscarAgenteNome(array('CNPJCPF=?' => $v->CNPJCPFdigirente))->current();
             $rsDirigentes[$rsAgente->idAgente]['CNPJCPFDirigente'] = $rsAgente->CNPJCPF;
             $rsDirigentes[$rsAgente->idAgente]['idAgente'] = $rsAgente->idAgente;
             $rsDirigentes[$rsAgente->idAgente]['NomeDirigente'] = $rsAgente->Descricao;
         }
         $tbDirigenteMandato = new tbAgentesxVerificacao();
         foreach ($rsDirigentes as $dirigente) {
             $rsMandato = $tbDirigenteMandato->listarMandato(array('idEmpresa = ?' => $idEmpresa, 'idDirigente = ?' => $dirigente['idAgente'], 'stMandato = ?' => 0));
             $NomeDirigente = $dirigente['NomeDirigente'];
             $arrMandatos[$NomeDirigente] = $rsMandato;
         }
     }
     //$tbDirigentes = $geral->buscarDirigentes($idPronac);
     $this->view->dirigentes = $rsDirigentes;
     $this->view->mandatos = $arrMandatos;
     //============== fim codigo dirigente ================
     /*==================================================*/
     if ($propostaPorEdital) {
         $tbFormDocumentoDAO = new tbFormDocumento();
         $edital = $tbFormDocumentoDAO->buscar(array('idEdital = ?' => $this->view->itensGeral[0]->idEdital, 'idClassificaDocumento = ?' => $this->COD_CLASSIFICACAO_DOCUMENTO));
         $arrPerguntas = array();
         $arrRespostas = array();
         $tbPerguntaDAO = new tbPergunta();
         $tbRespostaDAO = new tbResposta();
         foreach ($edital as $registro) {
             $questoes = $tbPerguntaDAO->montarQuestionario($registro["nrFormDocumento"], $registro["nrVersaoDocumento"]);
             $questionario = '';
             if (is_object($questoes) and count($questoes) > 0) {
                 foreach ($questoes as $questao) {
                     $resposta = '';
                     $where = array('nrFormDocumento = ?' => $registro["nrFormDocumento"], 'nrVersaoDocumento = ?' => $registro["nrVersaoDocumento"], 'nrPergunta = ?' => $questao->nrPergunta, 'idProjeto = ?' => $this->idPreProjeto);
                     $resposta = $tbRespostaDAO->buscar($where);
                     $arrPerguntas[$registro["nrFormDocumento"]]["titulo"] = $registro["nmFormDocumento"];
                     $arrPerguntas[$registro["nrFormDocumento"]]["pergunta"][] = $questao->toArray();
                     $arrRespostas[] = $resposta->toArray();
                 }
             }
         }
         $this->view->perguntas = $arrPerguntas;
         $this->view->respostas = $arrRespostas;
         $this->montaTela("admissibilidade/imprimir-proposta-por-edital.phtml");
     } else {
         $this->montaTela("admissibilidade/imprimir-proposta-por-incentivo-fiscal.phtml");
     }
 }
 private function excluirQuestionario()
 {
     if (!$_POST) {
         $nrVersaoDocumento = $_GET['nrVersaoDocumento'];
         $nrFormDocumento = $_GET['nrFormDocumento'];
         $where = array('nrFormDocumento = ?' => $nrFormDocumento, 'nrVersaoDocumento = ?' => $nrVersaoDocumento);
     } else {
         $nrVersaoDocumento = $_POST['nrVersaoDocumento'];
         $nrFormDocumento = $_POST['nrFormDocumento'];
         $where = array('nrFormDocumento = ?' => $nrFormDocumento, 'nrVersaoDocumento = ?' => $nrVersaoDocumento);
     }
     $tbRespostaDAO = new tbResposta();
     $tbOpcaoRespostaDAO = new tbOpcaoResposta();
     $tbPerguntaFormDoctoDAO = new tbPerguntaFormDocto();
     $tbPerguntaDAO = new tbPergunta();
     if (count($tbRespostaDAO->buscar($where)) == 0) {
         return array(true, '');
     } else {
         if ($tbRespostaDAO->delete($where)) {
             if (count($tbOpcaoRespostaDAO->buscar($where)) == 0) {
                 return array(true, '');
             } else {
                 if ($tbOpcaoRespostaDAO->delete($where)) {
                     $listaPerguntaFormDocto = $tbPerguntaFormDoctoDAO->buscar($where);
                     $verificar = false;
                     if (is_object($listaPerguntaFormDocto)) {
                         foreach ($listaPerguntaFormDocto as $pergunta) {
                             if ($tbPerguntaDAO->delete(array('nrPergunta = ?' => $pergunta->nrPergunta))) {
                                 $verificar = true;
                             } else {
                                 $verificar = false;
                             }
                         }
                     } else {
                         $verificar = true;
                     }
                     if ($verificar) {
                         if ($tbPerguntaFormDoctoDAO->delete($where)) {
                             return array(true, '');
                         } else {
                             return array(false, "Erro ao tentar excluir a Pergunta Form Docto.");
                         }
                     } else {
                         return array(false, "Erro ao tentar excluir a Pergunta.");
                     }
                 } else {
                     return array(false, "Erro ao tentar excluir a Opcao Resposta.");
                 }
             }
         } else {
             return array(false, "Erro ao tentar excluir a Resposta.");
         }
     }
 }
 public function avaliarAction()
 {
     if (!empty($_GET['nrFormDocumento']) && !empty($_GET['nrVersaoDocumento']) && !empty($_GET['idPreProjeto'])) {
         $idusuario = $this->idusuario;
         $IdOrgao = $this->codOrgao;
         //x($idusuario);
         //x($IdOrgao);
         $tbprojetos = new Projetos();
         $nrFormDocumento = $_GET['nrFormDocumento'];
         $nrVersaoDocumento = $_GET['nrVersaoDocumento'];
         $idPreProjeto = $_GET['idPreProjeto'];
         $where = array('Situacao = ?' => $this->COD_SITUACAO_PROJETO_ATUALIZA, 'stTipoDemanda = ?' => $this->COD_STTIPODEMANDA_PREPROJETO, 'idOrgao = ?' => $IdOrgao, 'age.idAgente = ?' => $idusuario, 'pp.idPreProjeto = ?' => $idPreProjeto, 'stAvaliacao != ? OR stAvaliacao IS NULL' => '1');
         $dadosFD = array('nrFormDocumento = ?' => $nrFormDocumento, 'nrVersaoDocumento = ?' => $nrVersaoDocumento);
         $FD = new tbFormDocumento();
         $buscarFD = $FD->buscar($dadosFD)->toArray();
         $idEdital = $buscarFD[0]['idEdital'];
         $listaProjetos = $tbprojetos->listaProjetosPainelAvaliador($where)->current();
         $this->view->listaProjetos = $listaProjetos;
         $where = array('b.nrFormDocumento = ?' => $nrFormDocumento, 'b.nrVersaoDocumento = ?' => $nrVersaoDocumento, 'f.idEdital = ?' => $idEdital);
         if (!empty($_GET['$nrPergunta'])) {
             $where['b.nrPergunta = ?'] = $_GET['$nrPergunta'];
         }
         $order = "b.nrOrdemPergunta asc";
         $tbpergunta = new tbPergunta();
         $perguntas = $tbpergunta->listaCompleta($where, $order);
         $this->view->perguntas = $perguntas;
     } else {
         parent::message("Dados inv&aacute;lidos", "Avaliarprojetos/index", "ERROR");
     }
 }