Mini Shell
<?php include('header.php') ?>
<?php
$obra = new Obra();
$flash = array();
// CREATE
if(isset($_POST['action']) && $_POST['action'] == 'create'):
unset($_POST['action']);
if(strlen($_POST['title']) > 1 && strlen($_POST['local']) > 1 && strlen($_POST['client']) > 1 && strlen($_POST['description']) > 7):
if($obra->create($_POST)):
$flash = Helper::flash('success');
else:
$flash = Helper::flash('error');
endif;
else:
$flash = Helper::flash('error');
endif;
endif;
?>
<div id="page">
<div class="row">
<div class="col lg-12">
<h2>Obras / adicionar</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="obras.php" class="btn btn-primary">Voltar</a>
<hr>
<small>* todos os campos são obrigatórios</small>
<form action="" method="post">
<div class="form-group">
<label for="title">Título:</label>
<input type="text" name="title" class="form-control">
</div>
<div class="form-group">
<label for="local">Local:</label>
<input type="text" name="local" class="form-control">
</div>
<div class="form-group">
<label for="client">Cliente:</label>
<input type="text" name="client" class="form-control">
</div>
<div class="form-group">
<label for="description">Descrição:</label>
<textarea name="description" class="form-control" cols="30" rows="10"></textarea>
</div>
<div class="form-group">
<input type="hidden" name="action" value="create">
<button type="submit" class="btn btn-primary">Adicionar</button>
</div>
</form>
</div>
</div>
</div>
<?php include('footer.php') ?>
Zerion Mini Shell 1.0