/** * Sobrescrito método de download de arquivos, * para fazer a validação de permissão do usuário * com o anexo. */ public function downloadfileAction() { $usuarioSession = new Container('Login'); $fileId = (int) $this->params()->fromRoute("id"); if (!empty($fileId)) { $anexoDao = new AnexoDao($this->getEntityManager()); $anexo = $anexoDao->obterAnexoPeloArquivoEUsuario($fileId, $usuarioSession->iduser); if (!empty($anexo)) { parent::downloadfileAction(); } } }
/** * Sobrescrito método de listagem dos combos, * para listar os status de agendamentos corretos. * * @param \Zend\Form\Element\Select $element * @return array */ public function getListValuesToSelectElement(Select $element) { $id = (int) $this->params()->fromRoute('id'); $result = parent::getListValuesToSelectElement($element); if ($element->getName() == "statusAgendamento" && !empty($id)) { $agendamento = $this->getEntityManager()->find("Process\\Entity\\Agendamento", $id); $proximosStatus = $agendamento->getStatusAgendamento()->obterProximosStatusPossiveisDoCliente(); foreach ($result as $pos => $item) { if (!in_array($item["id"], $proximosStatus)) { unset($result[$pos]); } } } return $result; }