-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpet-list.php
53 lines (37 loc) · 1.25 KB
/
pet-list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/// This must come first when we need access to the current session
session_start();;
require("classes/components.php");
require("classes/pet.php");
Components::pageHeader("All Books", ["style"], ["mobile-nav"]);
?>
<main class="content-wrapper pets-content">
<div class="pet-list-container">
<h1>Find a Pet</h1>
<div class="admin-buttonc-container">
<?php
/// Redirect user from this page if they're already logged in
if (isset($_SESSION['loggedIn'])) {
/**
* Display a button to add a new pet if the user role is Admin.
*/
if ($_SESSION['user_role'] === "Admin") {
echo "<a class='button add-button' href='add-pet.php'>Add New Pet</a>";
}
}
?>
</div>
<div class="book-list">
<?php
/**
* Retrieves all pets from the database and passes them to the 'allPets' method in the 'Components' class.
*/
$pets = Pet::getAllPets();
Components::allPets($pets);
?>
</div>
</div>
</main>
<?php
Components::pageFooter();
?>