Exemple #1
0
function deleteCategory($category_id)
{
    $controllerCategory = new ControllerCategory();
    $controllerCategory->deleteCategory($category_id, 1);
    echo "<script type='text/javascript'>location.href='categories.php';</script>";
}
Exemple #2
0
<?php

require_once 'header.php';
$controller = new ControllerCategory();
$categories = $controller->getCategories();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $category_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    if ($category_id != null) {
        $controller->deleteCategory($category_id, 1);
        echo "<script type='text/javascript'>location.href='categories.php';</script>";
    }
    // else {
    //   echo "<script type='text/javascript'>location.href='403.php';</script>";
    // }
}
$begin = 0;
$page = 1;
$count = count($categories);
$pages = intval($count / Constants::NO_OF_ITEMS_PER_PAGE);
$search_criteria = "";
if (isset($_POST['button_search'])) {
    $search_criteria = trim(strip_tags($_POST['search']));
    $categories = $controller->getCategoriesBySearching($search_criteria);
} else {
    if ($count % Constants::NO_OF_ITEMS_PER_PAGE != 0) {
        $pages += 1;
    }
    if (!empty($_GET['page'])) {
        $page = $_GET['page'];
        $begin = ($page - 1) * Constants::NO_OF_ITEMS_PER_PAGE;