<a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <table class="table"> <thead> <th>ID</th> <th>User</th> <th>Product</th> <th>Price</th> </thead> <tbody> <?php $orders = new EntityManager(); $list_orders = $orders->findAll('order'); foreach ($list_orders as $order) { ?> <tr> <td><?php print $order['id']; ?> </td> <td><?php print $order['username']; ?> </td> <td><?php print $order['name'];
<a href="/../shop/" class="btn btn-default">Shop</a> <a href="/../user/" class="btn btn-default">Users</a> <a href="/../user/AddUser.php" class="btn btn-default">Add User</a> <a href="/../products/index.php" class="btn btn-default">Products</a> <a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <?php if (isset($_POST['name']) && isset($_POST['price'])) { $product = new Product(); $product->setName($_POST['name']); $product->setPrice($_POST['price']); $date = new DateTime('now'); $product->setCreatedAt($date->getTimestamp()); $product_insert = new EntityManager(); $product_insert->insert($product); header("Location: index.php"); exit; } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name"> </div> <div class="form-group"> <label for="name">Price</label> <input type="text" class="form-control" id="name" placeholder="Name" name="price">
<a href="/../products/index.php" class="btn btn-default">Products</a> <a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <table class="table"> <thead> <th>ID</th> <th>Name</th> <th>Price</th> <th>Options</th> </thead> <tbody> <?php $product = new EntityManager(); $list_products = $product->findAll('product'); foreach ($list_products as $product) { ?> <tr> <td><?php print $product['id']; ?> </td> <td><?php print $product['name']; ?> </td> <td><?php print $product['price'];
<a href="/../products/index.php" class="btn btn-default">Products</a> <a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <table class="table"> <thead> <th>ID</th> <th>Name</th> <th>Options</th> </thead> <tbody> <?php $user = new EntityManager(); $list_users = $user->findAll('user'); foreach ($list_users as $user) { ?> <tr> <td><?php print $user['id']; ?> </td> <td><?php print $user['username']; ?> </td> <td> <a href="EditUser.php?id=<?php
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"> </script> </head> <body class="add-user"> <div class="container"> <?php $entity = new EntityManager(); $entity->db_init(); if (isset($_POST['name'])) { $user_login = new User(); $user_login->setUserName($_POST['name']); $id = $entity->insert($user_login); $_SESSION['user'] = $id; header("Location: /user/index.php"); exit; } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name">
<a href="/../products/index.php" class="btn btn-default">Products</a> <a href="/../products/AddProduct.php" class="btn btn-default">Add Product</a> <a href="/../orders/index.php" class="btn btn-default">Orders</a> </div> <?php if (isset($_POST['name'])) { $user = new User(); $user->setUserName($_POST['name']); // $date = new DateTime('now'); $user->setCreatedAt(1111111111); // $user = array( // 'entity' => 'users', // 'user_name' => $_POST['name'] // ); $user_insert = new EntityManager(); $user_insert->insert($user); header("Location: index.php"); exit; } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name"> </div> <button type="submit" class="btn btn-default">Add</button> </form>
<?php if (isset($_POST['name'])) { $date = new DateTime('now'); $date = $date->getTimestamp(); $user = new \User\User(); $user->setId($_GET['id']); $user->setUserName($_POST['name']); $user->setUpdatedAt($date); $user_update = new EntityManager(); $user_update->update($user); header("Location: index.php"); exit; } if (isset($_GET['id'])) { $get_user = new EntityManager(); $user = $get_user->find('user', $_GET['id']); } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name" value="<?php print $user['username']; ?> "> </div> <button type="submit" class="btn btn-default">Edit</button> </form>
<?php if (isset($_POST['name']) && isset($_POST['price'])) { $date = new DateTime('now'); $date = $date->getTimestamp(); $product = new Product(); $product->setId($_GET['id']); $product->setName($_POST['name']); $product->setPrice($_POST['price']); $product->setUpdatedAt($date); $product_update = new EntityManager(); $product_update->update($product); header("Location: index.php"); exit; } if (isset($_GET['id'])) { $get_product = new EntityManager(); $product = $get_product->find('product', $_GET['id']); } ?> <form method="post"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name" value="<?php print $product['name']; ?> "> </div> <div class="form-group"> <label for="name">Price</label>