|
|
@@ -7,6 +7,13 @@ Core::addBreadcrumb("/account/tests", $page_title);
|
|
|
|
|
|
$user = Core::$user;
|
|
|
|
|
|
+// Pagination
|
|
|
+$page_size = 25;
|
|
|
+
|
|
|
+$page = http::value("page", "int");
|
|
|
+if($page <= 1) $page = 1;
|
|
|
+Core::$page = $page;
|
|
|
+
|
|
|
// Admin / Super Admin
|
|
|
if($user->level >= User::LEVEL_ADMIN) {
|
|
|
|
|
|
@@ -25,6 +32,16 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
if(!$filter_count) $filter_count = "";
|
|
|
|
|
|
$tests = Test::query($nvp, ["sort" => "status"]);
|
|
|
+ $test_count = count($tests);
|
|
|
+
|
|
|
+ $page_count = ceil($test_count / $page_size);
|
|
|
+ if($page_count <= 1) $page_count = 1;
|
|
|
+
|
|
|
+ Core::$page_count = $page_count;
|
|
|
+
|
|
|
+ $offset = ($page - 1) * $page_size;
|
|
|
+
|
|
|
+ $tests = array_slice($tests, $offset, $page_size);
|
|
|
|
|
|
$testers = User::load(array_column($tests, "tester_id"));
|
|
|
$projects = Project::load(array_column($tests, "project_id"));
|
|
|
@@ -33,9 +50,14 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
return $a->name <=> $b->name;
|
|
|
});
|
|
|
|
|
|
+ $item_number_first = $offset + 1;
|
|
|
+ $item_number_last = $offset + $page_size;
|
|
|
+ if($item_number_last > $test_count) $item_number_last = $test_count;
|
|
|
+
|
|
|
+ $pagination_string = "Showing $item_number_first-$item_number_last of $test_count tests";
|
|
|
+
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
- View::include("test_list", compact("tests", "projects", "project_id", "location_id", "test_id", "filter_count", "status"));
|
|
|
- View::includeOnce("footer");
|
|
|
+ View::include("test_list", compact("tests", "test_count", "pagination_string", "projects", "project_id", "location_id", "test_id", "filter_count", "status"));
|
|
|
}
|
|
|
|
|
|
// HQ / Venue (view completed tests)
|
|
|
@@ -45,7 +67,6 @@ else if($user->level >= User::LEVEL_VENUE) {
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
View::include("test_list_completed", compact("tests"));
|
|
|
- View::includeOnce("footer");
|
|
|
}
|
|
|
|
|
|
// Tester
|
|
|
@@ -55,7 +76,9 @@ else if($user->level == User::LEVEL_TESTER) {
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
View::include("test_list_assigned", compact("tests"));
|
|
|
- View::includeOnce("footer");
|
|
|
}
|
|
|
|
|
|
+View::includeOnce("modal_page_jump");
|
|
|
+View::includeOnce("footer");
|
|
|
+
|
|
|
?>
|