Пример #1
0
$total_count = Assignment::count_all();
//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 assignments  ";
if (isset($_POST['sort'])) {
    $batch = strtolower($_POST['batch']);
    $sql .= "WHERE batch={$batch}";
}
$sql .= "ORDER BY created DESC ";
$sql .= " LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()} ";
$assignments = Assignment::find_by_sql($sql);
if (empty($assignments)) {
    $session->message("There are no Assignments in Assignment 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 teal basic button" href="index.php">&laquo; Back</a>
<br/>