public function optionUnidadeOrg() { $noUnidadeOrg = trim(\Core_Integration_Sica_User::getUserUnitName()); $li = '<li><span>Unidade: ' . $noUnidadeOrg . '</span></li>'; $maxChars = 28; if (strlen($noUnidadeOrg) > $maxChars) { $li = '<li><span data-content="' . $noUnidadeOrg . '"'; $li .= 'data-placement="left" data-trigger="hover" rel="popover" '; $li .= 'data-original-title="Unidade Organizacional"> '; $li .= 'Unidade: ' . trim(substr($noUnidadeOrg, 0, $maxChars)) . '…</span></li>'; } return $li; }
/** * * @param integer $sqArtefato * @throws \Exception * @throws \Core_Exception_ServiceLayer_Verification */ public function unarchive($sqArtefato) { $this->getEntityManager()->beginTransaction(); try { if (!$this->_getRepository()->hasArquivamento($sqArtefato)) { $nuArtefato = $this->_getNuArtefatoToUnarchive($sqArtefato); throw new \Core_Exception_ServiceLayer_Verification("Artefato {$nuArtefato} já foi desarquivado."); } $entityArquivoSetorial = $this->_getRepository()->find($this->_getRepository()->getKeyArquivamento($sqArtefato)); if (NULL === $entityArquivoSetorial) { $nuArtefato = $this->_getNuArtefatoToUnarchive($sqArtefato); throw new \Core_Exception_ServiceLayer_Verification("Artefato {$nuArtefato} não localizado no arquivo setorial. Já deve ter sido desarquivado"); } $entityPessoaDesarquivamento = $this->getEntityManager()->getPartialReference('app:VwPessoa', \Core_Integration_Sica_User::getPersonId()); $dtDesarquivamento = \Zend_Date::now(); $entityArquivoSetorial->setDtDesarquivamento($dtDesarquivamento)->setSqPessoaDesarquivamento($entityPessoaDesarquivamento); $this->getEntityManager()->persist($entityArquivoSetorial); # persiste o historico no artefato $serviceHA = $this->getServiceLocator()->getService('HistoricoArtefato'); $sqOcorrencia = \Core_Configuration::getSgdoceSqOcorrenciaDesarquivarSetor(); $strMessage = $serviceHA->getMessage('MH026', \Core_Integration_Sica_User::getUserUnitName(), $dtDesarquivamento->get(\Zend_Date::DATETIME_MEDIUM), \Core_Integration_Sica_User::getUserName()); $serviceHA->registrar($sqArtefato, $sqOcorrencia, $strMessage); sleep(1); //só pra organizar o histórico $this->_processTramite($entityArquivoSetorial->getSqArtefato()); $this->getEntityManager()->flush($entityArquivoSetorial); $this->getEntityManager()->commit(); } catch (\Exception $e) { $this->getEntityManager()->rollback(); throw $e; } }
/** * Termo de Abertura / Encerramento de Volume. * * @return void */ public function termoAction() { $sqVolume = $this->_getParam('id', false); $stAbertura = $this->_getParam('abertura', false); if (!$sqVolume) { $this->_redirect(); } $objEntity = $this->getService()->find($sqVolume); $termo = null; if (!$stAbertura && $objEntity->getDtEncerramento()) { $termo = 'termo-encerramento'; } else { $termo = 'termo-abertura'; } $sufix = str_shuffle($sqVolume . time()); $fname = sprintf($termo . '-%d.pdf', $sufix); $path = APPLICATION_PATH . '/modules/artefato/views/scripts/volume'; $noUnidadeOrg = $this->_helper->changeCase->toupper(\Core_Integration_Sica_User::getUserUnitName()); $params = array('objVolume' => $objEntity, 'noUnidadeOrg' => $noUnidadeOrg); return $this->_helper->termo->setParams($params)->setDateFormatPrint("dd 'dia(s) do mês de ' MMMM 'de' yyyy")->gerar($termo, $fname, $path); }
/** * Termo de Desmembramento. * * @return void */ public function termoAction() { $sqDesmemDesentra = $this->_getParam('id', false); if (!$sqDesmemDesentra) { $this->_redirect(); } $objEntity = $this->getService()->find($sqDesmemDesentra); $termo = null; $nuArtefatoDestino = null; if ($objEntity->getStDesmembramento()) { $termo = 'termo-desmembramento'; $nuArtefatoDestino = $this->_formatarNrProcesso($objEntity->getSqArtefatoDestino()->getSqArtefato()); } else { $termo = 'termo-desentranhamento'; } $sufix = str_shuffle($sqDesmemDesentra . time()); $fname = sprintf($termo . '-%d.pdf', $sufix); $path = APPLICATION_PATH . '/modules/artefato/views/scripts/desmembrar-desentranhar'; $noUnidadeOrg = $this->_helper->changeCase->toupper(\Core_Integration_Sica_User::getUserUnitName()); $params = array('objDesmemDesentra' => $objEntity, 'nuArtefatoDestino' => $nuArtefatoDestino, 'noUnidadeOrg' => $noUnidadeOrg); $helper = $this->_helper->termo->setParams($params)->setDateFormatPrint("dd 'de' MMMM 'de' yyyy"); if ($objEntity->getSqArtefato()->getCoAmbitoProcesso() == 'F' && strlen($objEntity->getSqArtefato()->getSqArtefato()->getNuArtefato()) == 17) { $helper->setNuArtefatoMask('99999.999999/9999-99'); } return $helper->gerar($termo, $fname, $path); }
public function _generateTerm($type) { # dispensa o uso do template $this->getHelper('layout')->disableLayout(); $params = $this->_getAllParams(); $anexado = null; if (is_array($params['child'])) { $anexado = array(); foreach ($params['child'] as $item) { $anexado[] = $this->getService('Artefato')->find((int) $item); } } else { $anexado = $this->getService('Artefato')->find((int) $params['child']); } $anexador = $this->getService('Artefato')->find((int) $params['parent']); $despacho = $this->getService('DespachoInterlocutorio')->find((int) $params['despacho']); $assinante = $this->getService('VwPessoa')->find((int) $params['assinante']); $noCargoFuncao = null; if ($params['cargo']) { $cargoFuncao = $this->getService('Cargo')->find((int) $params['cargo']); $noCargoFuncao = $cargoFuncao->getNoCargo(); } else { if ($params['funcao']) { $cargoFuncao = $this->getService('Funcao')->find((int) $params['funcao']); $noCargoFuncao = $cargoFuncao->getNoFuncao(); } } $options = array('fname' => sprintf('Termo%s-%s.pdf', ucfirst($type), date('YmdHis')), 'path' => APPLICATION_PATH . '/modules/artefato/views/scripts/vinculo/'); $logo = current(explode('application', __FILE__)) . 'public' . DIRECTORY_SEPARATOR . ltrim(self::T_ICMBIO_IMAGE_LOGO_PATH, DIRECTORY_SEPARATOR); \Core_Doc_Factory::setFilePath($options['path']); $vData = array('data' => (object) array('tipoOperacao' => self::$T_DIC_ACTION[$params['tOper']], 'unidadeBase' => \Core_Integration_Sica_User::getUserUnitName(), 'unidadeAtendida' => $despacho->getSqUnidadeAssinatura()->getNoUnidadeOrg(), 'processoAnexador' => $anexador, 'processoAnexado' => $anexado, 'despacho' => str_pad((int) $params['despacho'], 8, '0', \STR_PAD_LEFT), 'assinante' => $assinante->getNoPessoa(), 'cargoFuncao' => $noCargoFuncao, 'dataExtenso' => \Zend_Date::now()->get("dd 'de' MMMM 'de' yyyy")), 'logo' => $logo); \Core_Doc_Factory::download(sprintf('termo-%s-anexacao-doc', $type), $vData, $options['fname']); }