From 7aead0bfca2f7ec5ce24f378a168b02d5b6422a9 Mon Sep 17 00:00:00 2001 From: Alexander Jason <alexanderjason526@gmail.com> Date: Mon, 13 Nov 2023 19:54:47 +0700 Subject: [PATCH] feat: add premium page --- app/pages/premium/CollectionDetailPage.php | 52 +++++++++++++++++ app/pages/premium/PremiumBookDetailPage.php | 63 +++++++++++++++++++++ app/pages/premium/PremiumCollectionPage.php | 49 ++++++++++++++++ app/pages/user/MySubscriptionPage.php | 51 +++++++++++++++++ 4 files changed, 215 insertions(+) create mode 100644 app/pages/premium/CollectionDetailPage.php create mode 100644 app/pages/premium/PremiumBookDetailPage.php create mode 100644 app/pages/premium/PremiumCollectionPage.php create mode 100644 app/pages/user/MySubscriptionPage.php diff --git a/app/pages/premium/CollectionDetailPage.php b/app/pages/premium/CollectionDetailPage.php new file mode 100644 index 0000000..ffb3b1f --- /dev/null +++ b/app/pages/premium/CollectionDetailPage.php @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="wiauthor_dth=device-width, initial-scale=1.0"> + <link rel="icon" sizes="180x180" href="<?= BASE_URL ?>/icon/favicon-110.png"> + <link rel="icon" type="image/png" sizes="32x32" href="<?= BASE_URL ?>/icon/favicon-32.png"> + <!-- Global CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/globals.css"> + <!-- Navbar CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/navbar.css"> + <!-- Page-specific CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/admin/crud-page.css"> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/admin/list.css"> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/home/home.css"> + <title>Curator's Collection</title> +</head> + +<body> + <!-- Navigation bar --> + <?php include(dirname(__DIR__) . '../../components/Navbar.php') ?> + <div class="content"> + <h1>Curator's Collection</h1> + <a href="/author/add">+ Subscribe</a> + <table border="1" class="styled-table"> + <thead> + <tr> + <th>Id</th> + <th>Book Title</th> + <th>Author</th> + <th>Details</th> + </tr> + </thead> + <?php + + $authors = $this->data['authors']; + + foreach ($authors as $author) { + echo "<tr>"; + echo "<td>" . $author['author_id'] . "</td>"; + echo "<td>" . $author['full_name'] . "</td>"; + echo "<td>" . $author['full_name'] . "</td>"; + echo '<td><a href="/author/update/' . $author['author_id'] .'">Edit</a></td>'; + echo "</tr>"; + } + ?> + </table> + </div> +</body> + +</html> \ No newline at end of file diff --git a/app/pages/premium/PremiumBookDetailPage.php b/app/pages/premium/PremiumBookDetailPage.php new file mode 100644 index 0000000..dbcd275 --- /dev/null +++ b/app/pages/premium/PremiumBookDetailPage.php @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="icon" sizes="180x180" href="<?= BASE_URL ?>/icon/favicon-110.png"> + <link rel="icon" type="image/png" sizes="32x32" href="<?= BASE_URL ?>/icon/favicon-32.png"> + <!-- Global CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/globals.css"> + <!-- Navbar CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/navbar.css"> + <!-- Page-specific CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/book/book-detail.css"> + <title>Premium: <?=$this->data['title']?></title> +</head> +<body> + <!-- Navigation bar --> + <?php include(dirname(__DIR__) . '../../components/Navbar.php') ?> + <div class="container"> + <?php if(isset($this->data['book_id']) ):?> + <h2>PREMIUM DETAILS</h2> + <div class="details-container"> + <!-- Book Title --> + <h3> <?=$this->data['title']?> </h3> + + <!-- Author Genre Year--> + <h4> <?=$this->data['author']?></h4> + <h4> <?=$this->data['genre']?></h4> + <h4> <?=$this->data['year']?></h4> + + <!-- Text --> + <p> <?=$this->data['summary']?></p> + + <!-- todo: check ownership --> + <?php + if(isset($this->data['username'])): + if(isset($this->data['own'])): + + $bookIdToCheck = $this->data['book_id']; + $found = false; + + foreach ($this->data['own'] as $ownedBook) { + if (isset($ownedBook['book_id']) && $ownedBook['book_id'] == $bookIdToCheck) { + $found = true; + break; + } + } + if($found): + ?> + <audio controls> + <source src="<?= BASE_URL ?>/<?= str_replace('/var/www/html/config/', '', $this->data['audio_path']) ?>" alt ="book-audio" type="audio/mp3"> + Your browser does not support the audio element. + </audio> + <?php endif; ?> + <?php endif; ?> + <?php endif; ?> + </div> + <?php else : ?> + <h2 class="info">Can't find the book you're looking for!</h2> + <?php endif; ?> + </div> +</body> +</html>. \ No newline at end of file diff --git a/app/pages/premium/PremiumCollectionPage.php b/app/pages/premium/PremiumCollectionPage.php new file mode 100644 index 0000000..f8617b2 --- /dev/null +++ b/app/pages/premium/PremiumCollectionPage.php @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="wiauthor_dth=device-width, initial-scale=1.0"> + <link rel="icon" sizes="180x180" href="<?= BASE_URL ?>/icon/favicon-110.png"> + <link rel="icon" type="image/png" sizes="32x32" href="<?= BASE_URL ?>/icon/favicon-32.png"> + <!-- Global CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/globals.css"> + <!-- Navbar CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/navbar.css"> + <!-- Page-specific CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/admin/crud-page.css"> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/admin/list.css"> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/home/home.css"> + <title>Premium Collection</title> +</head> + +<body> + <!-- Navigation bar --> + <?php include(dirname(__DIR__) . '../../components/Navbar.php') ?> + <div class="content"> + <h1>Premium Book Collection</h1> + <table border="1" class="styled-table"> + <thead> + <tr> + <th>Id</th> + <th>Book Title</th> + <th>Author</th> + </tr> + </thead> + <?php + + $authors = $this->data['authors']; + + foreach ($authors as $author) { + echo "<tr>"; + echo "<td>" . $author['author_id'] . "</td>"; + echo "<td>" . $author['full_name'] . "</td>"; + echo "<td>" . $author['full_name'] . "</td>"; + echo "</tr>"; + } + ?> + </table> + </div> +</body> + +</html> \ No newline at end of file diff --git a/app/pages/user/MySubscriptionPage.php b/app/pages/user/MySubscriptionPage.php new file mode 100644 index 0000000..3a26f6c --- /dev/null +++ b/app/pages/user/MySubscriptionPage.php @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="wiauthor_dth=device-width, initial-scale=1.0"> + <link rel="icon" sizes="180x180" href="<?= BASE_URL ?>/icon/favicon-110.png"> + <link rel="icon" type="image/png" sizes="32x32" href="<?= BASE_URL ?>/icon/favicon-32.png"> + <!-- Global CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/globals.css"> + <!-- Navbar CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/template/navbar.css"> + <!-- Page-specific CSS --> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/admin/crud-page.css"> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/admin/list.css"> + <link rel="stylesheet" type="text/css" href="<?= BASE_URL ?>/styles/home/home.css"> + <title>My Subscription</title> +</head> + +<body> + <!-- Navigation bar --> + <?php include(dirname(__DIR__) . '../../components/Navbar.php') ?> + <div class="content"> + <h1><?php $this->data['username']?>'s Subscription</h1> + <!-- Todo Routing --> + <a href="/premium">++ Add Subscription</a> + <table border="1" class="styled-table"> + <thead> + <tr> + <th>Id</th> + <th>Curator Name</th> + <th>Action</th> + </tr> + </thead> + <?php + + $authors = $this->data['authors']; + + foreach ($authors as $author) { + echo "<tr>"; + echo "<td>" . $author['author_id'] . "</td>"; + echo "<td>" . $author['full_name'] . "</td>"; + echo '<td><a href="/author/update/' . $author['author_id'] .'">Pending/Details</a></td>'; + echo "</tr>"; + } + ?> + </table> + </div> +</body> + +</html> \ No newline at end of file -- GitLab