function carregarMenu() { include '../dao/Modulos.php'; include '../dao/ModulosDAO.php'; $modulosDAO = new ModulosDAO(); $modulosList = $modulosDAO->selectListaModulosUsuario(ID_USUARIO); $list['success'] = 1; $list['data'] = array(); foreach ($modulosList as $m) { $list['data'][] = array("idmodulo" => $m->getIdmodulo(), "nome" => $m->getNome(), "classicone" => $m->getClassicone(), "tela" => $m->getTela()); } echo json_encode($list); }
function carregarModulos() { include '../dao/Modulos.php'; include '../dao/ModulosDAO.php'; include '../dao/Operacaomodulos.php'; include '../dao/OperacaomodulosDAO.php'; include '../dao/Permissoes.php'; include '../dao/PermissoesDAO.php'; $modulosDAO = new ModulosDAO(); $operacaomodulosDAO = new OperacaomodulosDAO(); $permissoesDAO = new PermissoesDAO(); // Busca todos os modulos do sistema $modulosList = $modulosDAO->selectListaTodosRegistros(); if (!$modulosList) { finalize("Nenhum módulo encontrado!"); } $list['success'] = 1; $list['data'] = array(); $list['data']['modulo'] = array(); $idUsuario = $_POST["idUsuario"]; foreach ($modulosList as $mod) { $operacaoList = $operacaomodulosDAO->selectListaRegistrosPorModulo($mod->getIdmodulo()); if ($operacaoList) { $arrTmp = array(); foreach ($operacaoList as $op) { $permissoes = $permissoesDAO->selectRegistro($op->getIdoperacaomodulo(), $idUsuario); $acesso = true; if (!$permissoes) { $acesso = false; } $arrTmp[] = array("descricao" => $op->getDescricao(), "acesso" => $acesso, "idoperacaomodulo" => $op->getIdoperacaomodulo()); } } $list['data']['modulo'][] = array("nomeModulo" => $mod->getNome(), "operacoes" => $arrTmp); } echo json_encode($list); }