<?php if (isset($_GET['id']) && !empty($_GET['id'])) { $id = htmlentities($_GET['id']); $color = Color::getColorById($id); if (isset($_POST['edit'])) { PDOConnexion::setParameters('phonedeals', 'root', 'root'); $db = PDOConnexion::getInstance(); $sql = "\n\t\t\t\tUPDATE color\n\t\t\t\tSET name = :name,\n\t\t\t\t\thex = :hex\n\t\t\t\tWHERE id = :id\n\t\t\t"; $sth = $db->prepare($sql); $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Color'); $sth->execute(array(':id' => $id, ':name' => $_POST['name'], ':hex' => $_POST['hex'])); if ($sth) { App::success('Cette couleur a bien été modifiée'); } } if ($color) { ?> <div class="col-md-8"> <div class="page-header"> <h1>Éditer une couleur</h1> </div> <form action="index.php?page=admin/color-edit&id=<?php echo $id; ?> " method="POST"> <div class="form-group"> <label for="color-name">Nom</label> <input type="text" class="form-control" id="color-name" value="<?php echo $color->name;
<th>Couleur</th> <th>Capacité</th> <th>Quantité</th> <th>Prix total</th> <th>Supprimer</th> </tr> </thead> <tbody> <?php if (!$empty) { foreach ($_SESSION['cart']['phones'] as $key => $phone) { echo ' <tr> <td>' . $phone['name'] . '</td> <td>' . money_format('%!i', $phone['price']) . ' €</td> <td><div style="background: ' . Color::getColorById($phone['color'])->hex . '; border: 1px solid #ededed; display: inline-block; width: 15px; height: 15px; border-radius: 17px;"></div> ' . Color::getColorById($phone['color'])->name . '</td> <td>' . $phone['capacity'] . ' Go</td> <td>' . $phone['amount'] . '</td> <td>' . money_format('%!i', $phone['price'] * $phone['amount']) . ' €</td> <td> <form action="index.php?page=cart" method="POST"> <input type="hidden" name="id" value="' . $key . '"> <input type="hidden" name="action" value="remove"> <button action="submit" title="Retirer du panier" class="remove-cart" style="border: none; background: transparent;"><i class="fa fa-trash"></i></button> </form> </td> </tr> '; } } else { echo '
<?php foreach ($capacities as $e) { echo '<option value="' . $e . '">' . $e . ' Go</option>'; } ?> </select> </div> <div id="color" style="margin-top: 10px;"> <?php $colors = explode(',', $phone->color); ?> Couleur : <select name="color"> <?php foreach ($colors as $color) { $c = Color::getColorById($color); echo '<option value="' . $c->id . '">' . $c->name . '</option>'; } ?> </select> </div> <input type="hidden" name="id" value="<?php echo $phone->id; ?> "> <input type="hidden" name="action" value="add"> <button type="submit" class="btn btn-primary btn-lg" style="margin-top:30px;">Acheter</button> </form> </div> <div class="col-md-12"> <h3>Description</h3>