$_SESSION['page'] = $pos; #煥頁時,指定action 為 list if ($action == "" and $pos > 0) { $action = "list"; } $a = new ProductController($conn); $a->lang = $lang; $a->UserLevel = $UserLevel; $a->UserID = $UserID; $a->lang_str = $lang_str; switch ($action) { case "list": $a->browse($p, 10, $pos); break; case "add": $a->add(); break; case "edit": $a->edit($id); break; case "show": $a->show($id); break; case "save": $vars = $_POST; $vars['photo'] = $_FILES['photo']; $vars['photo_bar'] = $_FILES['photo_bar']; $vars['photo_banner'] = $_FILES['photo_banner']; //print_r($vars);return; $a->save($p, $vars); break;
ProductController::get_products('Kebab'); }); $routes->get('/tuotteet/juomat', function () { ProductController::get_products('Juoma'); }); $routes->get('/tuotteet/pizzat', function () { ProductController::get_products('Pizza'); }); $routes->get('/tuotteet/salaatit', function () { ProductController::get_products('Salaatti'); }); $routes->get('/tuotteet/:category/lisaa', 'check_logged_in', 'check_if_admin', function ($category) { ProductController::add_form($category); }); $routes->post('/tuotteet/:category/lisaa', 'check_logged_in', 'check_if_admin', function () { ProductController::add(); }); $routes->get('/tuotteet/:category/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($category, $id) { ProductController::edit_form($id); }); $routes->post('/tuotteet/:category/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($category, $id) { ProductController::edit($id); }); $routes->post('/tuotteet/:id/poista', 'check_logged_in', 'check_if_admin', function ($id) { ProductController::delete($id); }); $routes->get('/ainesosat', 'check_logged_in', 'check_if_admin', function () { IngredientController::get_ingredients(); }); $routes->get('/ainesosat/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($id) { IngredientController::edit_form($id);