$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;
    case "delete":
        $a->delete($id);
        break;
Exemple #2
0
        $productController->index();
    } else {
        if ($_GET['c'] == 'product/create') {
            if ($_SERVER['REQUEST_METHOD'] === 'POST') {
                $productController = new ProductController();
                $productController->createPost();
            } else {
                $productController = new ProductController();
                $productController->create();
            }
        } else {
            if ($_GET['c'] == 'product/edit') {
                if ($_SERVER['REQUEST_METHOD'] === 'POST') {
                    $productController = new ProductController();
                    $productController->editPost($_GET['id']);
                } else {
                    $productController = new ProductController();
                    $productController->edit($_GET['id']);
                }
            } else {
                if ($_GET['c'] == 'product/delete') {
                    $productController = new ProductController();
                    $productController->delete($_GET['id']);
                }
            }
        }
    }
} else {
    $productController = new ProductController();
    $productController->index();
}
Exemple #3
0
    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);
});
$routes->post('/ainesosat/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($id) {
    IngredientController::edit($id);
});
$routes->get('/ainesosat/lisaa', 'check_logged_in', 'check_if_admin', function () {
    IngredientController::add_form();