Mini Shell
<?php include('header.php') ?>
<?php
$user = new User();
$flash = array();
// DELETE
if(isset($_GET['action']) && $_GET['action'] == 'delete'):
if($user->delete($_GET['id'])):
$flash = Helper::flash('success');
else:
$flash = Helper::flash('error');
endif;
endif;
// READ
$paginate = new Paginate($user->total(), $user->limit);
$users = $user->paginate($paginate->page());
?>
<div id="page">
<div class="row">
<div class="col lg-12">
<h2>Administradores</h2>
</div>
</div>
<div class="row">
<?php if($flash): ?>
<div class="col-lg-12">
<div class="alert alert-<?= $flash['class'] ?> alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?= $flash['message'] ?>
</div>
</div>
<?php endif ?>
<div class="col-lg-12">
<a href="users_new.php" class="btn btn-primary">Adicionar</a>
<hr>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Nome:</th>
<th>E-mail:</th>
<th width="100px">Ação:</th>
</tr>
</thead>
<tbody>
<?php foreach($users as $user): ?>
<tr>
<td><?= $user->name ?></td>
<td><?= $user->email ?></td>
<td>
<a href="users_edit.php?id=<?= $user->id ?>" class="btn btn-default btn-xs">
<i class="glyphicon glyphicon-pencil"></i>
</a>
<a href="users.php?action=delete&id=<?= $user->id ?>" class="btn btn-danger btn-xs" onclick="return confirm('Deseja realmente deletar?')">
<i class="glyphicon glyphicon-trash"></i>
</a>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
<?= $paginate->render() ?>
</div>
</div>
</div>
<?php include('footer.php') ?>
Zerion Mini Shell 1.0