Exemple #1
0
require_once '../../models/style.php';
?>
		<h3><a href="add.php">Add new style</a></h3>
		<div class="col-md-8">
			<table class="table table-striped">
				<tr>
					<th>ID</th>
					<th>Name</th>
					<th>Description</th>
					<th>Beers</th>
					<th>Actions</th>
				</tr>
				<?php 
$styles = Style::getAll();
foreach ($styles as $style) {
    $beers = Style::getBeers($style->id);
    echo "<tr>";
    echo "<td>{$style->id}</td>";
    echo "<td>{$style->name}</td>";
    echo "<td>{$style->description}</td>";
    echo "<td>" . count($beers) . "</td>";
    echo "<td>\n\t\t\t\t\t\t\t\t\t<form action='update.php?id={$style->id}' method='POST'>\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='name' value=\"{$style->name}\">\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='description' value=\"{$style->description}\">\n\t\t\t\t\t\t\t\t\t\t<input type='submit' value='Edit' class='btn btn-warning'>\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t \t\t\t<a href='delete.php?id={$style->id}' class='btn btn-danger'>Delete</a>\n\t\t\t\t\t\t\t \t</td>";
    echo "</tr>";
}
?>
			</table>
		</div>
	</div>	
</body>

</html>
Exemple #2
0
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/water.jpg" width="180" /></div>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/malts.jpg" width="180" /></div>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/hops.jpg" width="180" /></div>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/yeasts.jpg" width="180" /></div>
	</div>
</div>
<hr>
<h2 class='h2-header' id='tasted'>Already tasted</h2>
<div class='container'>
	<ul id='tasted_list'>
		<div class='row'>
			<?php 
$tasted = Style::getAll();
$row = 1;
foreach ($tasted as $style) {
    $beers = count(Style::getBeers($style->id));
    echo "<div class='col-md-4'>\n\t\t\t\t\t\t\t<li><a href='" . $_SERVER['PHP_SELF'] . "?style=" . $style->id . "#tasted'>" . $style->name . "</a> <span class='badge'>" . $beers . "</span></li>\n\t\t\t\t\t\t</div>";
    if ($row % 3 == 0) {
        echo "</div><div class='row'>";
    }
    $row++;
}
?>
		</div>
	</ul>

	<div class='row'>
		<?php 
$beers = Beer::getAll();
if (isset($_GET['style'])) {
    $beers = Beer::getByStyle($_GET['style']);