public function listar() { require_once "model/usuarioDAO.php"; $dao = new UsuarioDAO(); $vetor = $dao->listar(); require_once "view/view.php"; $view = new View(); $view->listarUsuarios($vetor); }
<th>E-mail</th> <th>Permissão</th> <th>Ação</th> </tr> </thead> <!-- Busca usuários cadastrados no banco --> <!-- Se a pesquisa foi acionada, busca por nome, senão lista todos --> <tbody> <?php if (!$usuarioDao) { $usuarioDao = new UsuarioDAO(); } if (isset($_GET["nPesquisa"])) { $lista = $usuarioDao->buscaPorNome($_GET["nPesquisa"]); } else { $lista = $usuarioDao->listar(); } /* Imprime na tabela em HTML os usuários encontrados */ foreach ($lista as $indice => $usuario) { ?> <tr> <td><?php echo "{$usuario->nome} {$usuario->sobrenome}"; ?> </td> <td><?php echo $usuario->email; ?> </td> <td><?php if ($usuario->admin == 0) {
} ?> <table class="table table-striped table-bordered bootstrap-datatable datatable"> <thead> <tr> <th>Nome</th> <th>Empresa</th> <th width="10%">Grupo</th> <th>Email</th> <th>Ação</th> </tr> </thead> <tbody> <?php $DAO->listar(); ?> </tbody> </table> </div> </div> </div> <!-- content ends --> </div><!--/#content.span10--> </div><!--/fluid-row--> <hr> <?php include_once '../../footer.php';
<?php $dao = new UsuarioDAO(); $listaUsuarios = $dao->listar();