Просмотр исходного кода

Redone pagination. Normalised filter cards.

Alan Lam 8 лет назад
Родитель
Сommit
013cc50199

+ 3 - 24
controllers/tests.php

@@ -7,13 +7,6 @@ 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) {
 
@@ -63,16 +56,8 @@ if($user->level >= User::LEVEL_ADMIN) {
 	}
 
 	$tests = Test::query($nvp, $query_options);
-	$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);
+	$pagination_object = Util::getPaginationObject($tests);
+	$tests = array_slice($tests, $pagination_object->offset, $pagination_object->pageSize);
 
 	$testers = User::load(array_column($tests, "tester_id"));
 	$projects = Project::load(array_column($tests, "project_id"));
@@ -82,12 +67,6 @@ 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";
-
 	$sorts = [
 		"status" => "Status",
 		"updated" => "Update",
@@ -95,7 +74,7 @@ if($user->level >= User::LEVEL_ADMIN) {
 	];
 
 	View::includeOnce("header", compact("page_title"));
-	View::include("test_list", compact("tests", "test_count", "sort", "sorts", "pagination_string", "projects", "customers", "customer_id", "project_id", "location_id", "location_internal_id", "pass", "test_id", "filter_count", "status"));
+	View::include("test_list", compact("tests", "pagination_object", "sort", "sorts", "projects", "customers", "customer_id", "project_id", "location_id", "location_internal_id", "pass", "test_id", "filter_count", "status"));
 }
 
 // HQ / Venue (view completed tests)

+ 5 - 5
controllers/tests_completed.php

@@ -9,16 +9,16 @@ Core::addBreadcrumb("/account/tests", "Tests");
 Core::addBreadcrumb("/account/tests/completed", $page_title);
 
 $tests = Core::$user->getCompletedTests();
-$projects = Project::load(array_column($tests, "project_id"));
 
-$pagination_object = Util::getPaginationObject($tests, 25);
+$pagination_object = Util::getPaginationObject($tests);
+
+$tests = array_slice($tests, $pagination_object->offset, $pagination_object->pageSize);
 
-Core::$page = $pagination_object->page;
-Core::$page_count = $pagination_object->pageCount;
+$projects = Project::load(array_column($tests, "project_id"));
 
 View::includeOnce("header", compact("page_title"));
 View::include("test_list_completed", compact("tests", "pagination_object"));
-View::include("modal_test_invoice", compact("tests", "pagination_object"));
+View::include("modal_test_invoice");
 View::includeOnce("footer");
 
 ?>

+ 9 - 1
controllers/users.php

@@ -30,8 +30,16 @@ if($nvp) $filter_count = count(array_keys($nvp));
 
 $users = User::query($nvp);
 
+$pagination_object = Util::getPaginationObject($users);
+
+Core::$page = $pagination_object->page;
+Core::$page_count = $pagination_object->pageCount;
+
+$users = array_slice($users, $pagination_object->offset, $pagination_object->pageSize);
+
+
 View::includeOnce("header", compact("page_title"));
-View::include("users", compact("users", "filter_count", "first_name", "last_name", "email", "level", "customer_id", "location_id"));
+View::include("users", compact("users", "pagination_object", "filter_count", "first_name", "last_name", "email", "level", "customer_id", "location_id"));
 View::includeOnce("footer");
 
 ?>

+ 35 - 29
views/locations.php

@@ -30,41 +30,47 @@ var customerId = <?=$customer->id?>;
 	?>
 
 	<div class="collapse <?=$filters_show?>" id="project-filters">
-		<div class="card mb-3">
-			<div class="card-header">
-				Filters
-			</div>
-			<div class="card-body">
-				<form method="get">
-					<input type="hidden" name="customer_id" value="<?=http::value("customer_id", "int")?>" />
-					<div class="row mb-3">
-						<div class="col-lg-6">
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="id">ID</label>
-								<div class="col-sm">
-									<input class="form-control" type="number" name="id" id="id" placeholder="Enter ID" value="<?=htmlspecialchars(http::value("id", "int"))?>" />
-								</div>
+		<div class="card card-body bg-light text-dark mb-3">
+			<h3>Filters</h3>
+			<form method="get">
+				<input type="hidden" name="customer_id" value="<?=http::value("customer_id", "int")?>" />
+				<div class="row">
+					<div class="col-lg-6">
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="id">ID</label>
+							<div class="col-sm">
+								<input class="form-control" type="number" name="id" id="id" placeholder="Enter ID" value="<?=htmlspecialchars(http::value("id", "int"))?>" />
 							</div>
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="name">Name</label>
-								<div class="col-sm">
-									<input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars(http::value("name"))?>" />
-								</div>
+						</div>
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="name">Name</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars(http::value("name"))?>" />
+							</div>
+						</div>
+					</div>
+					<div class="col-lg-6">
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="internal-id">Internal ID</label>
+							<div class="col-sm">
+								<input class="form-control" type="number" name="internal_id" id="internal-id" placeholder="Enter internal ID" value="<?=htmlspecialchars(http::value("internal_id", "trim"))?>" />
 							</div>
 						</div>
-						<div class="col-lg-6">
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="internal-id">Internal ID</label>
-								<div class="col-sm">
-									<input class="form-control" type="number" name="internal_id" id="internal-id" placeholder="Enter internal ID" value="<?=htmlspecialchars(http::value("internal_id", "trim"))?>" />
-								</div>
+					</div>
+				</div>
+				<div class="row">
+					<div class="col-lg">
+						<div class="row">
+							<div class="col-sm offset-sm-4">
+								<button class="btn btn-primary" type="submit">Submit</button>
+								<a class="btn btn-secondary" href="/account/locations?customer_id=<?=$customer->id?>">Clear Filters</a>
 							</div>
 						</div>
 					</div>
-					<button class="btn btn-primary mt-3" type="submit">Submit</button>
-					<a class="btn btn-secondary mt-3" href="/account/locations?customer_id=<?=$customer->id?>">Clear Filters</a>
-				</form>
-			</div>
+					<div class="col-lg">
+					</div>
+				</div>
+			</form>
 		</div>
 	</div>
 

+ 28 - 21
views/pagination.php

@@ -1,7 +1,9 @@
 <?php
 
-$page = Core::$page;
-$page_count = Core::$page_count;
+if(!isset($pagination_object)) return;
+
+$page = $pagination_object->page;
+$page_count = $pagination_object->pageCount;
 
 $uri = $_SERVER["REQUEST_URI"];
 $parts = explode("?", $uri);
@@ -10,8 +12,6 @@ $path = $parts[0];
 $query_string = $parts[1] ?? "";
 parse_str($query_string, $nvp);
 
-if($page_count == 1) return;
-
 $previous_disabled = ($page <= 1) ? "disabled" : "";
 $next_disabled = ($page >= $page_count) ? "disabled" : "";
 
@@ -19,20 +19,27 @@ $previous_url = $path . "?" . http_build_query(array_merge($nvp, ["page" => $pag
 $next_url = $path . "?" . http_build_query(array_merge($nvp, ["page" => $page + 1]));
 
 ?>
-<nav aria-label="Page navigation">
-	<ul class="pagination mb-0 justify-content-center">
-		<li class="page-item <?=$previous_disabled?>">
-			<a class="page-link" href="<?=htmlspecialchars($previous_url)?>">
-				<span aria-hidden="true">&laquo;</span>
-				<span class="sr-only">Previous</span>
-			</a>
-		</li>
-		<li class="page-item"><a class="page-link" href="#" data-toggle="modal" data-target="#modal-page-jump">Page <?=number_format($page)?> of <?=number_format($page_count)?></a></li>
-		<li class="page-item <?=$next_disabled?>">
-			<a class="page-link" href="<?=htmlspecialchars($next_url)?>">
-				<span aria-hidden="true">&raquo;</span>
-				<span class="sr-only">Next</span>
-			</a>
-		</li>
-	</ul>
-</nav>
+<div class="row">
+	<div class="col-sm align-self-center mb-3 mb-sm-0 text-center text-sm-left">
+		<?=htmlspecialchars($pagination_object->rangeText)?>
+	</div>
+	<div class="col-sm-auto">
+		<nav aria-label="Page navigation">
+			<ul class="pagination mb-0 justify-content-center">
+				<li class="page-item <?=$previous_disabled?>">
+					<a class="page-link" href="<?=htmlspecialchars($previous_url)?>">
+						<span aria-hidden="true">&laquo;</span>
+						<span class="sr-only">Previous</span>
+					</a>
+				</li>
+				<li class="page-item"><a class="page-link" href="#" data-toggle="modal" data-target="#modal-page-jump">Page <?=number_format($page)?> of <?=number_format($page_count)?></a></li>
+				<li class="page-item <?=$next_disabled?>">
+					<a class="page-link" href="<?=htmlspecialchars($next_url)?>">
+						<span aria-hidden="true">&raquo;</span>
+						<span class="sr-only">Next</span>
+					</a>
+				</li>
+			</ul>
+		</nav>
+	</div>
+</div>

+ 24 - 20
views/projects.php

@@ -27,29 +27,33 @@
 	?>
 
 	<div class="collapse <?=$filters_show?>" id="project-filters">
-		<div class="card mb-3">
-			<div class="card-header">
-				Filters
-			</div>
-			<div class="card-body">
-				<form method="get">
-					<input type="hidden" name="customer_id" value="<?=http::value("customer_id", "int")?>" />
-					<div class="row mb-1">
-						<label class="col-sm-4 col-form-label" for="id">ID</label>
-						<div class="col-sm">
-							<input class="form-control" type="number" name="id" id="id" placeholder="Enter ID" value="<?=htmlspecialchars(http::value("id", "int"))?>" />
+		<div class="card card-body bg-light text-dark mb-3">
+			<h3>Filters</h3>
+			<form method="get">
+				<div class="row">
+					<div class="col-lg">
+						<input type="hidden" name="customer_id" value="<?=http::value("customer_id", "int")?>" />
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="id">ID</label>
+							<div class="col-sm">
+								<input class="form-control" type="number" name="id" id="id" placeholder="Enter ID" value="<?=htmlspecialchars(http::value("id", "int"))?>" />
+							</div>
 						</div>
-					</div>
-					<div class="row mb-1">
-						<label class="col-sm-4 col-form-label" for="name">Name</label>
-						<div class="col-sm">
-							<input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars(http::value("name"))?>" />
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="name">Name</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars(http::value("name"))?>" />
+							</div>
+						</div>
+						<div class="row">
+							<div class="col-sm offset-sm-4">
+								<button class="btn btn-primary" type="submit">Submit</button>
+								<a class="btn btn-secondary" href="/account/projects?customer_id=<?=$customer->id?>">Clear Filters</a>
+							</div>
 						</div>
 					</div>
-					<button class="btn btn-primary mt-3" type="submit">Submit</button>
-					<a class="btn btn-secondary mt-3" href="/account/projects?customer_id=<?=$customer->id?>">Clear Filters</a>
-				</form>
-			</div>
+				</div>
+			</form>
 		</div>
 	</div>
 

+ 97 - 101
views/test_list.php

@@ -70,103 +70,112 @@ $results = [
 
 	<div class="<?=$filters_collapse?>" id="filters">
 		<form method="get">
-			<div class="card mb-3">
-				<div class="card-header">
-					Filters
-				</div>
-				<div class="card-body">
+			<div class="card card-body bg-light text-dark mb-3">
 
-					<div class="row mb-3">
-						<div class="col-lg-6">
-							<div class="row mb-1">
-								<label class="col-form-label col-sm-4" for="status">Status</label>
-								<div class="col-sm">
-									<select class="form-control" name="status" id="status">
-										<option value="">Any not cancelled</option>
-										<?php
-										foreach(Test::STATUSES as $value => $display) {
-											$selected = ($value === $status) ? "selected" : "";
-											?>
-											<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
-											<?php
-										}
+				<h3>Filters</h3>
+
+				<div class="row mb-1">
+					<div class="col-lg-6">
+						<div class="row mb-1">
+							<label class="col-form-label col-sm-4" for="status">Status</label>
+							<div class="col-sm">
+								<select class="form-control" name="status" id="status">
+									<option value="">Any not cancelled</option>
+									<?php
+									foreach(Test::STATUSES as $value => $display) {
+										$selected = ($value === $status) ? "selected" : "";
 										?>
-									</select>
-								</div>
-							</div>
-							<div class="row mb-1">
-								<label class="col-form-label col-sm-4" for="customer-id">Customer</label>
-								<div class="col-sm">
-									<select class="form-control" name="customer_id" id="customer-id">
-										<option value="">Select customer</option>
+										<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
 										<?php
-										foreach($customers as $customer) {
-											$selected = ($customer->id == $customer_id) ? "selected" : "";
-											?>
-											<option value="<?=$customer->id?>" <?=$selected?>><?=htmlspecialchars($customer->name)?></option>
-											<?php
-										}
-										?>
-									</select>
-								</div>
+									}
+									?>
+								</select>
 							</div>
-							<div class="row mb-1">
-								<label class="col-form-label col-sm-4" for="project-id">Project</label>
-								<div class="col-sm">
-									<select class="form-control" name="project_id" id="project-id">
-										<option value="">Select project</option>
-										<?php
-										foreach($projects as $project) {
-											$selected = ($project->id == $project_id) ? "selected" : "";
-											?>
-											<option value="<?=$project->id?>" <?=$selected?>><?=htmlspecialchars($project->name)?></option>
-											<?php
-										}
+						</div>
+						<div class="row mb-1">
+							<label class="col-form-label col-sm-4" for="customer-id">Customer</label>
+							<div class="col-sm">
+								<select class="form-control" name="customer_id" id="customer-id">
+									<option value="">Select customer</option>
+									<?php
+									foreach($customers as $customer) {
+										$selected = ($customer->id == $customer_id) ? "selected" : "";
 										?>
-									</select>
-								</div>
+										<option value="<?=$customer->id?>" <?=$selected?>><?=htmlspecialchars($customer->name)?></option>
+										<?php
+									}
+									?>
+								</select>
 							</div>
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="pass">Result</label>
-								<div class="col-sm">
-									<select class="form-control" name="pass" id="pass">
+						</div>
+						<div class="row mb-1">
+							<label class="col-form-label col-sm-4" for="project-id">Project</label>
+							<div class="col-sm">
+								<select class="form-control" name="project_id" id="project-id">
+									<option value="">Select project</option>
+									<?php
+									foreach($projects as $project) {
+										$selected = ($project->id == $project_id) ? "selected" : "";
+										?>
+										<option value="<?=$project->id?>" <?=$selected?>><?=htmlspecialchars($project->name)?></option>
 										<?php
-										foreach($results as $value => $display) {
-											$selected = (strval($value) === strval($pass)) ? "selected" : "";
-											?>
-											<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
-											<?php
-										}
+									}
+									?>
+								</select>
+							</div>
+						</div>
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="pass">Result</label>
+							<div class="col-sm">
+								<select class="form-control" name="pass" id="pass">
+									<?php
+									foreach($results as $value => $display) {
+										$selected = (strval($value) === strval($pass)) ? "selected" : "";
 										?>
-									</select>
-								</div>
+										<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
+										<?php
+									}
+									?>
+								</select>
 							</div>
 						</div>
-						<div class="col-lg">
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="test-id">Test ID</label>
-								<div class="col-sm">
-									<input class="form-control" type="text" name="test_id" id="test-id" placeholder="Enter test ID" value="<?=$test_id?>" />
-								</div>
+					</div>
+					<div class="col-lg">
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="test-id">Test ID</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="test_id" id="test-id" placeholder="Enter test ID" value="<?=$test_id?>" />
 							</div>
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="location-id">Location ID</label>
-								<div class="col-sm">
-									<input class="form-control" type="text" name="location_id" id="location-id" placeholder="Enter location ID" value="<?=$location_id?>" />
-								</div>
+						</div>
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="location-id">Location ID</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="location_id" id="location-id" placeholder="Enter location ID" value="<?=$location_id?>" />
 							</div>
-							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label" for="location-internal-id">Internal ID</label>
-								<div class="col-sm">
-									<input class="form-control" type="text" name="location_internal_id" id="location-internal-id" placeholder="Enter location internal ID" value="<?=$location_internal_id?>" />
-								</div>
+						</div>
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="location-internal-id">Internal ID</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="location_internal_id" id="location-internal-id" placeholder="Enter location internal ID" value="<?=$location_internal_id?>" />
 							</div>
 						</div>
 					</div>
-					<button class="btn btn-primary" type="submit">Filter</button>
-					<a class="btn btn-secondary" href="/account/tests">Clear Filters</a>
+				</div>
 
+				<div class="row">
+					<div class="col-lg">
+						<div class="row">
+							<div class="col-sm offset-sm-4">
+								<button class="btn btn-primary" type="submit">Filter</button>
+								<a class="btn btn-secondary" href="/account/tests">Clear Filters</a>
+							</div>
+						</div>
+					</div>
+					<div class="col-lg">
+					</div>
 				</div>
+
+
 			</div>
 			<input type="hidden" name="sort" value="<?=$sort?>" />
 		</form>
@@ -183,19 +192,12 @@ $results = [
 	}
 	else {
 		?>
-
-		<div class="row">
-			<div class="col-md text-center text-md-left align-self-center mb-3">
-				<?=htmlspecialchars($pagination_string)?>
-			</div>
-			<div class="col-md-auto mb-3">
-				<?php
-				View::include("pagination");
-				?>
-			</div>
+		<div class="mb-3">
+			<?php
+			View::include("pagination", compact("pagination_object"));
+			?>
 		</div>
 
-
 		<div class="table-responsive mb-3">
 
 			<table class="table table-sm table-hover" style="min-width: 1024px;">
@@ -289,16 +291,10 @@ $results = [
 			</table>
 		</div>
 
-
-		<div class="row">
-			<div class="col-md text-center mb-3 text-md-left align-self-center">
-				<?=htmlspecialchars($pagination_string)?>
-			</div>
-			<div class="col-md-auto mb-3">
-				<?php
-				View::include("pagination");
-				?>
-			</div>
+		<div class="mt-3">
+			<?php
+			View::include("pagination", compact("pagination_object"));
+			?>
 		</div>
 		<?php
 	}

+ 9 - 10
views/test_list_completed.php

@@ -13,16 +13,10 @@
 	}
 	else {
 		?>
-
-		<div class="row">
-			<div class="col-sm text-center text-sm-left align-self-center mb-3">
-			<?=htmlspecialchars($pagination_object->rangeText)?>
-			</div>
-			<div class="col-sm-auto mb-3">
-			<?php
-			View::include("pagination");
-			?>
-			</div>
+		<div class="mb-3">
+		<?php
+		View::include("pagination", compact("pagination_object"));
+		?>
 		</div>
 
 		<div class="list-group">
@@ -126,6 +120,11 @@
 		}
 		?>
 		</div>
+		<div class="mt-3">
+		<?php
+		View::include("pagination", compact("pagination_object"));
+		?>
+		</div>
 		<?php
 	}
 

+ 93 - 68
views/users.php

@@ -26,86 +26,44 @@
 	</div>
 
 	<div class="collapse" id="filters">
-		<div class="card card-body mb-3">
+		<div class="card card-body mb-3 bg-light text-dark">
 			<h3>Filters</h3>
 			<form method="get">
 
-				<div class="form-group">
-					<label for="level">Level</label>
-					<select class="form-control" name="level" id="level">
-						<option value="">Any</option>
-						<?php
-						foreach(User::LEVELS as $value => $display) {
-							$selected = ($value === $level) ? "selected" : "";
-							?>
-							<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="level">Level</label>
+					<div class="col-sm">
+						<select class="form-control" name="level" id="level">
+							<option value="">Any</option>
 							<?php
-						}
-						?>
-					</select>
+							foreach(User::LEVELS as $value => $display) {
+								$selected = ($value === $level) ? "selected" : "";
+								?>
+								<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
+								<?php
+							}
+							?>
+						</select>
+					</div>
 				</div>
 
-				<div class="form-group">
-					<label for="email">Email</label>
-					<input class="form-control" type="text" name="email" id="email" placeholder="Enter email" value="<?=htmlspecialchars($email)?>" />
+				<div class="row mb-3">
+					<label class="col-sm-4 col-form-label" for="email">Email</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="email" id="email" placeholder="Enter email" value="<?=htmlspecialchars($email)?>" />
+					</div>
+				</div>
+
+				<div class="row">
+					<div class="col-sm offset-sm-4">
+						<button class="btn btn-primary" type="submit">Filter</button>
+					</div>
 				</div>
 
-				<button class="btn btn-primary" type="submit">Filter</button>
 			</form>
 		</div>
 	</div>
 
-	<table class="table table-hover">
-		<thead>
-			<tr>
-				<th>ID</th>
-				<th>Name</th>
-				<th>Level</th>
-				<th>Age</th>
-				<th>Score</th>
-				<th></th>
-			</tr>
-		</thead>
-		<tbody>
-		<?php
-		foreach($users as $user) {
-			?>
-			<tr>
-				<td class="text-right align-middle">
-					<?=$user->id?>
-				</td>
-				<td class="align-middle">
-					<a href="/account/users/<?=$user->id?>"><?=htmlspecialchars($user->getDisplayName())?></a>
-				</td>
-				<td class="text-center align-middle">
-					<span class="badge badge-<?=$user->getLevelClass()?>"><?=htmlspecialchars($user->getLevelText())?></span>
-				</td>
-				<td class="align-middle">
-					<?=$user->getAge()?>
-				</td>
-				<td class="align-middle">
-					<?=$user->score?>
-				</td>
-				<td class="text-right align-middle">
-				<?php
-				if($user->level == User::LEVEL_UNVERIFIED) {
-					?>
-					<a class="btn btn-outline-primary" href="/account/users/<?=$user->id?>/verify">
-						Verify...
-					</a>
-					<?php
-				}
-				?>
-					<a class="btn btn-outline-primary" href="/account/users/<?=$user->id?>/edit">
-						Edit
-					</a>
-				</td>
-			</tr>
-			<?php
-		}
-		?>
-		</tbody>
-	</table>
 
 	<?php
 	if(empty($users)) {
@@ -113,6 +71,73 @@
 		<div class="alert alert-info">No users to display.</div>
 		<?php
 	}
+	else {
+		?>
+		<div class="mb-3">
+		<?php
+		View::include("pagination", compact("pagination_object"));
+		?>
+		</div>
+
+		<table class="table table-hover">
+			<thead>
+				<tr>
+					<th>ID</th>
+					<th>Name</th>
+					<th>Level</th>
+					<th>Age</th>
+					<th>Score</th>
+					<th></th>
+				</tr>
+			</thead>
+			<tbody>
+			<?php
+			foreach($users as $user) {
+				?>
+				<tr>
+					<td class="text-right align-middle">
+						<?=$user->id?>
+					</td>
+					<td class="align-middle">
+						<a href="/account/users/<?=$user->id?>"><?=htmlspecialchars($user->getDisplayName())?></a>
+					</td>
+					<td class="text-center align-middle">
+						<span class="badge badge-<?=$user->getLevelClass()?>"><?=htmlspecialchars($user->getLevelText())?></span>
+					</td>
+					<td class="align-middle">
+						<?=$user->getAge()?>
+					</td>
+					<td class="align-middle">
+						<?=$user->score?>
+					</td>
+					<td class="text-right align-middle">
+					<?php
+					if($user->level == User::LEVEL_UNVERIFIED) {
+						?>
+						<a class="btn btn-outline-primary" href="/account/users/<?=$user->id?>/verify">
+							Verify...
+						</a>
+						<?php
+					}
+					?>
+						<a class="btn btn-outline-primary" href="/account/users/<?=$user->id?>/edit">
+							Edit
+						</a>
+					</td>
+				</tr>
+				<?php
+			}
+			?>
+			</tbody>
+		</table>
+
+		<div class="mt-3">
+		<?php
+		View::include("pagination", compact("pagination_object"));
+		?>
+		</div>
+		<?php
+	}
 	?>
 
 </div>