コード例 #1
0
ファイル: RouteCategory.php プロジェクト: asundaram1/Test
function getSearchCategories($search)
{
    $controllerCategory = new ControllerCategory();
    return $controllerCategory->getCategoriesBySearching($search);
}
コード例 #2
0
ファイル: categories.php プロジェクト: walternate/Back-End
    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;
        $end = Constants::NO_OF_ITEMS_PER_PAGE;
        $categories = $controller->getCategoriesAtRange($begin, $end);
    } else {
        $begin = ($page - 1) * Constants::NO_OF_ITEMS_PER_PAGE;
        $end = Constants::NO_OF_ITEMS_PER_PAGE;
        $categories = $controller->getCategoriesAtRange($begin, $end);
    }
}