Example #1
0
//4. to limit pagination number
// 3 means abc[page]efg -> 3 right, 3 left
$stages = 2;
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
// for this page
$sql = "SELECT * FROM requests  ";
if (isset($_POST['submit'])) {
    $department = strtolower($_POST['department']);
} else {
    $department = "library";
}
$sql .= "WHERE department='{$department}' ORDER BY created DESC ";
$sql .= " LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()} ";
$requests = Request::find_by_sql($sql);
if (empty($requests)) {
    $session->message("There are no requests in request vault.");
    redirect_to('index.php');
}
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
?>


<?php 
include_layout_template('admin_header.php');
?>

<a class="ui blue basic button" href="index.php">&laquo; Back</a>
<br/>