public function visualizarMinutaAction() { $sqArtefato = $this->getRequest()->getParam('sqArtefato'); // REGISTRO DE VISUALIZAÇÃO DE MINUTA NO HISTÓRICO. #HistoricoArtefato::save(); $strMessage = $this->getServiceLocator()->getService('HistoricoArtefato')->getMessage('MH002'); $this->_salvarHistoricoArtefato($sqArtefato, \Core_Configuration::getSgdoceSqOcorrenciaVisualizar(), $strMessage); if ($this->_getParam('abreProcesso')) { $nunup = $this->getNuNup(); $criteria = array('sqArtefatoFilho' => $sqArtefato, 'sqTipoVinculoArtefato' => 7); $autuar = $this->getService('ArtefatoVinculo')->findBy($criteria); if (!$autuar && $nunup) { $this->view->abreProcesso = TRUE; } else { $this->view->abreProcesso = FALSE; } } // mapeamento da entidade 'pessoa' $this->view->sqArtefato = $sqArtefato; $dtoOptionArtefato = array('entity' => 'Sgdoce\\Model\\Entity\\Artefato'); // transforma o array 'artefato' em objeto $dtoEntityArtefato = Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato), 'entity', $dtoOptionArtefato); $artefatoMinuta = $this->getService('ArtefatoMinuta')->find($sqArtefato); $dtoEntityModelo = Core_Dto::factoryFromData(array('sqModeloDocumento' => $artefatoMinuta->getSqModeloDocumento()->getSqModeloDocumento()), 'entity', array('entity' => 'Sgdoce\\Model\\Entity\\ModeloDocumento')); $this->view->view = $this->_getParam('view'); $data = $this->getService('VisualizarCaixaMinuta')->createDocView($dtoEntityArtefato, $dtoEntityModelo); $modelo = $this->getService('VisualizarCaixaMinuta')->getModeloMinuta($dtoEntityModelo); $this->view->data = $data; switch ($modelo['sqPadraoModeloDocumento']) { case \Core_Configuration::getSgdocePadraoModeloDocumentoAtos(): $this->render('visualizarMinutaAtos'); break; case \Core_Configuration::getSgdocePadraoModeloDocumentoGeral(): $this->render('visualizarMinutaGeral'); break; case \Core_Configuration::getSgdocePadraoModeloDocumentoOficio(): $this->render('visualizarMinutaOficio'); break; } }
/** * Método que prepara valores para inserir no arquivo pdf da minuta para visualização */ public function visualizarMinutaAction() { $this->_helper->layout()->feriados = $this->getService()->getFeriados(); $sqArtefato = $this->_getParam('sqArtefato'); $viewAssinatura = $this->_getParam('viewFor'); $registry = \Zend_Registry::get('configs'); $options = array('path' => $registry['folder']['visualizaMinuta']); // mapeamento da entidade 'pessoa' $dtoOptionArtefato = array('entity' => 'Sgdoce\\Model\\Entity\\Artefato'); // transforma o array 'artefato' em objeto $dtoEntityArtefato = Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato), 'entity', $dtoOptionArtefato); $artefatoMinuta = $this->getService('ArtefatoMinuta')->find($sqArtefato); $dtoEntityModelo = Core_Dto::factoryFromData(array('sqModeloDocumento' => $artefatoMinuta->getSqModeloDocumento()->getSqModeloDocumento()), 'entity', array('entity' => 'Sgdoce\\Model\\Entity\\ModeloDocumento')); $this->view->view = $this->_getParam('view'); try { if ($viewAssinatura) { $data = $this->getService()->createDocView($dtoEntityArtefato, $dtoEntityModelo); } else { $data = $this->getService()->createDocPdf($dtoEntityArtefato, $dtoEntityModelo); } if (!$viewAssinatura) { $this->_helper->download($data, $options); } else { $modelo = $this->getService()->getModeloMinuta($dtoEntityModelo); $this->view->data = $data; switch ($modelo['sqPadraoModeloDocumento']) { case \Core_Configuration::getSgdocePadraoModeloDocumentoAtos(): $this->render('visualizarMinutaAtos'); break; case \Core_Configuration::getSgdocePadraoModeloDocumentoGeral(): $this->render('visualizarMinutaGeral'); break; case \Core_Configuration::getSgdocePadraoModeloDocumentoOficio(): $this->render('visualizarMinutaOficio'); break; } } } catch (\HTML2PDF_exception $exc) { $this->getMessaging()->addErrorMessage('Favor retirar os caracteres "<" e ">" dos dados informados no artefato.'); return $this->_redirectActionDefault('index/view/' . $this->_getParam('view')); } catch (\Exception $exc) { $this->getMessaging()->addErrorMessage($exc->getMessage()); return $this->_redirectActionDefault('index/view/' . $this->_getParam('view')); } }