switch ($action) { case 'welcome': $view = "Welcome"; require "{$ROOT}{$DS}view{$DS}{$layout}.php"; break; case 'readAll': $tabModele = modelModele::getAll(); $view = "All"; require "{$ROOT}{$DS}view{$DS}{$layout}.php"; break; case 'read': $id = $_GET['idMod']; $modele = modelModele::select($id); $tabItem = modelItem::getItemByModele($id); // tous les article $tabColor = modelItem::getAllColorOfModel($id); $view = ''; $pagetitle = "{$modele->getNameMod()} - {$modele->getNameBrand()}"; require "{$ROOT}{$DS}view{$DS}{$layout}.php"; break; case 'create': $view = 'Create'; $tab_Brand = modelBrand::getAll(); $tab_Cat = modelCategory::getAll(); $pagetitle = "Enregistrer un Modele"; require "{$ROOT}{$DS}view{$DS}{$layout}.php"; break; case 'created': $pagetitle = "Modele Enregistré"; $view = 'created'; $m = modelModele::countElem();
* Time: 22:19 */ require_once "{$ROOT}{$DS}model{$DS}modelItem.php"; require_once "{$ROOT}{$DS}model{$DS}modelModele.php"; ?> <p></p> <aside> <h2>Filtres </h2> <h3>Taille</h3> <?php foreach (modelItem::getAll() as $item) { echo "<br/><a href=\n'index.php?action=filterBySize&size={$item->getSizeItem()}'>{$item->getSizeItem()}</a>"; } ?> <p></p> <h3>Prix</h3> <?php foreach (modelModele::getAll() as $modele) { echo "<br/><a href='index.php?action=filterByPrice&price={$modele->getPriceMod()}'>{$modele->getPriceMod()}</a>"; } ?>
break; case 'purchase': if (!isset($_SESSION['id'])) { // si l'utilisateur n'est pas co $controller = 'user'; $view = 'Login'; $error = 'veuillez vous connecter afin de poursuivre'; } else { $view = 'Purchase'; } break; case 'delete': if (isset($_GET['idItem'])) { $id = $_GET['idItem']; $item = modelItem::select($id); shoppingCart::delItem($item); } $view = 'All'; break; case 'addItem': if (isset($_POST['color']) && isset($_POST['size']) && isset($_POST['idMod'])) { $color = $_POST['color']; $size = $_POST['size']; $id = $_POST['idMod']; $item = modelItem::getItembyColorSizeModele($id, $color, $size); shoppingCart::addItem($item, 1); } $view = 'All'; break; } require "{$ROOT}{$DS}view{$DS}{$layout}.php";