Mini Shell
<?php include('header.php') ?>
<?php
$banner = new Banner();
$flash = array();
// DELETE
if(isset($_GET['action']) && $_GET['action'] == 'delete'):
if($banner->delete($_GET['id'])):
$flash = Helper::flash('success');
else:
$flash = Helper::flash('error');
endif;
endif;
// READ
$paginate = new Paginate($banner->total(), $banner->limit);
$banners = $banner->paginate($paginate->page());
?>
<div id="page">
<div class="row">
<div class="col lg-12">
<h2>Banners</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="banners_new.php" class="btn btn-primary">Adicionar</a>
<hr>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Título:</th>
<th>Link:</th>
<th>Image:</th>
<th width="100px">Ação:</th>
</tr>
</thead>
<tbody>
<?php foreach($banners as $banner): ?>
<tr>
<td><?= $banner->title ?></td>
<td><?= $banner->link ?></td>
<td><?= $banner->image ?></td>
<td>
<a href="banners_edit.php?id=<?= $banner->id ?>" class="btn btn-default btn-xs">
<i class="glyphicon glyphicon-pencil"></i>
</a>
<a href="banners.php?action=delete&id=<?= $banner->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