184 lines
7.8 KiB
PHP
184 lines
7.8 KiB
PHP
<?php
|
||
ini_set('display_errors', 1);
|
||
ini_set('display_startup_errors', 1);
|
||
error_reporting(E_ALL);
|
||
include_once('include/listgenerator.php');
|
||
include_once('config/config.php');
|
||
?>
|
||
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>Simple Wishlist</title>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||
<!--<link rel="stylesheet" href="css/custom.css">-->
|
||
<link rel="stylesheet" href="css/tweaks.css">
|
||
<script src="js/bootstrap.bundle.min.js"></script>
|
||
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
|
||
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
|
||
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
|
||
<link rel="manifest" href="img/site.webmanifest">
|
||
<link rel="mask-icon" href="img/safari-pinned-tab.svg" color="#5bbad5">
|
||
<link rel="shortcut icon" href="img/favicon.ico">
|
||
<meta name="msapplication-TileColor" content="#da532c">
|
||
<meta name="msapplication-config" content="img/browserconfig.xml">
|
||
<meta name="theme-color" content="#ffffff">
|
||
<link rel="manifest" href="img/site.webmanifest">
|
||
</head>
|
||
|
||
<body>
|
||
|
||
<header>
|
||
<div class="navbar navbar-dark bg-dark shadow-sm">
|
||
<div class="container">
|
||
<a href="#" class="navbar-brand d-flex align-items-center">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="me-2 bi bi-gift" viewBox="0 0 16 16">
|
||
<path d="M3 2.5a2.5 2.5 0 0 1 5 0 2.5 2.5 0 0 1 5 0v.006c0 .07 0 .27-.038.494H15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1v7.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 1 14.5V7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h2.038A2.968 2.968 0 0 1 3 2.506V2.5zm1.068.5H7v-.5a1.5 1.5 0 1 0-3 0c0 .085.002.274.045.43a.522.522 0 0 0 .023.07zM9 3h2.932a.56.56 0 0 0 .023-.07c.043-.156.045-.345.045-.43a1.5 1.5 0 0 0-3 0V3zM1 4v2h6V4H1zm8 0v2h6V4H9zm5 3H9v8h4.5a.5.5 0 0 0 .5-.5V7zm-7 8V7H2v7.5a.5.5 0 0 0 .5.5H7z" />
|
||
</svg>
|
||
<strong>Simple Wishlist</strong>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<main>
|
||
<section class="py-5 text-center container">
|
||
<div class="row py-lg-5">
|
||
<div class="col-lg-6 col-md-8 mx-auto">
|
||
<h1 class="fw-light">Album example</h1>
|
||
<p class="lead text-muted">Something short and leading about the collection below—its contents, the creator, etc. Make it short and sweet, but not too short so folks don’t simply skip over it entirely.</p>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="album py-5 bg-light">
|
||
<div class="container">
|
||
|
||
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
|
||
|
||
<?php
|
||
// Create connection
|
||
$conn = new mysqli($servername, $username, $password, $db);
|
||
|
||
// Check connection
|
||
if ($conn->connect_error) {
|
||
die('Connection failed: ' . $conn->connect_error);
|
||
}
|
||
$sql = 'SELECT ID, title, description, link, image, reserved, price FROM whishes';
|
||
$result = $conn->query($sql);
|
||
|
||
if ($result !== false && $result->num_rows > 0) {
|
||
while ($row = $result->fetch_assoc()) {
|
||
generateListItem($row['ID'], $row['image'], $row['title'], $row['link'], $row['price'], $row['description'], $row['reserved']);
|
||
}
|
||
$conn->close();
|
||
}
|
||
?>
|
||
|
||
<div class="col">
|
||
<div class="card shadow-sm">
|
||
<svg class="bd-placeholder-img card-img-top" width="100%" height="225" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Thumbnail" preserveAspectRatio="xMidYMid slice" focusable="false">
|
||
<title>add new Item</title>
|
||
<rect width="100%" height="100%" fill="#55595c"></rect><text x="50%" y="50%" fill="#eceeef" dy=".3em">+</text>
|
||
</svg>
|
||
|
||
<div class="card-body">
|
||
<h5 class="card-title">new Item</h5>
|
||
<p class="card-text">extend your wishlist by adding a new Item</p>
|
||
<div class="d-flex justify-content-between align-items-center">
|
||
<div class="btn-group">
|
||
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#addItemModal">Add Item</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</main>
|
||
|
||
<footer class="text-muted py-5">
|
||
<div class="container">
|
||
<p class="float-end mb-1">
|
||
<a href="#">Back to top</a>
|
||
</p>
|
||
<p class="mb-1">Album example is © Bootstrap, but please download and customize it for yourself!</p>
|
||
<p class="mb-0">New to Bootstrap? <a href="/">Visit the homepage</a> or read our <a href="../getting-started/introduction/">getting started guide</a>.</p>
|
||
</div>
|
||
</footer>
|
||
|
||
<!-- Modal addItem-->
|
||
<div class="modal fade" id="addItemModal" tabindex="-1" aria-labelledby="addItemModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h5 class="modal-title" id="addItemModalLabel">Add new Item</h5>
|
||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||
</div>
|
||
<form action="add_item.php" method="POST">
|
||
<div class="modal-body">
|
||
|
||
<label for="ItemTitle" class="form-label">Titel</label>
|
||
<div class="input-group mb-3">
|
||
<input type="text" class="form-control" id="ItemTitle" name="ItemTitle" rows="3" required>
|
||
</div>
|
||
|
||
<label for="ItemDescription" class="form-label">Beschreibung</label>
|
||
<div class="input-group mb-3">
|
||
<textarea class="form-control" id="ItemDescription" name="ItemDescription" rows="3"></textarea>
|
||
</div>
|
||
|
||
<label for="ItemPrice" class="form-label">Preis</label>
|
||
<div class="input-group mb-3">
|
||
<input type="text" class="form-control" id="ItemPrice" name="ItemPrice" pattern="^\d*(\.\d{2}$)?" value="" data-type="currency" placeholder="0.00€" />
|
||
<span class="input-group-text">€</span>
|
||
</div>
|
||
|
||
<label for="ItemLink" class="form-label">Link zum Angebot</label>
|
||
<div class="input-group mb-3">
|
||
<input type="url" class="form-control" id="ItemLink" name="ItemLink" pattern="https?://.+" title="Include http://" rows="3">
|
||
</div>
|
||
|
||
<label for="ItemImage" class="form-label">Link zum Bild</label>
|
||
<div class="input-group mb-3">
|
||
<input type="url" class="form-control" id="ItemImage" name="ItemImage" pattern="https?://.+" title="Include http://" rows="3">
|
||
</div>
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||
<button type="submit" class="btn btn-primary">Add new Item</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Modal Reservation-->
|
||
<div class="modal fade" id="reservationModal" tabindex="-1" aria-labelledby="reservationModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h5 class="modal-title" id="reservationModalLabel">Wunsch reservieren</h5>
|
||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||
</div>
|
||
<div class="modal-body">
|
||
...
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||
<button type="button" class="btn btn-primary">Reservieren</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</body>
|
||
|
||
</html>
|