Mini Shell

Direktori : /home/emypro/www/admin/
Upload File :
Current File : /home/emypro/www/admin/obras.php

<?php include('header.php') ?>
<?php
$obra = new Obra();

$flash = array();
// DELETE
if(isset($_GET['action']) && $_GET['action'] == 'delete'):
	if($obra->delete($_GET['id'])):
		$flash = Helper::flash('success');
	else:
		$flash = Helper::flash('error');
	endif;
endif;

// READ
$paginate = new Paginate($obra->total(), $obra->limit);
$obras = $obra->paginate($paginate->page());
?>
<div id="page">
	<div class="row">
		<div class="col lg-12">
			<h2>Obras</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">&times;</span></button>
				<?= $flash['message'] ?>
			</div>
		</div>
		<?php endif ?>
		<div class="col-lg-12">
			<a href="obras_new.php" class="btn btn-primary">Adicionar</a>
			<hr>
			<div class="table-responsive">
				<table class="table">
					<thead>
						<tr>
							<th>Título:</th>
							<th>Descrição:</th>
							<th>Cliente:</th>
							<th width="100px">Ação:</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach($obras as $obra): ?>
						<tr>
							<td><?= $obra->title ?></td>
							<td><?= substr(strip_tags($obra->description), 0, 100) ?> [...]</td>
							<td><?= $obra->client ?></td>
							<td>
								<a href="obras_edit.php?id=<?= $obra->id ?>" class="btn btn-default btn-xs">
									<i class="glyphicon glyphicon-pencil"></i>
								</a>
								<a href="attachments.php?model=obras&id=<?= $obra->id ?>" class="btn btn-warning btn-xs">
									<i class="glyphicon glyphicon-picture"></i>
								</a>
								<a href="obras.php?action=delete&id=<?= $obra->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