Commit cd2e8206 authored by Ranindya Paramitha's avatar Ranindya Paramitha
Browse files
parents ed43e794 8a340399
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
class fileProcessing { class fileProcessing {
public const PROFILE_DEFAULT = 'default.jpg'; public const PROFILE_DEFAULT = 'default.jpg';
public static function isExistBookImage (string $name): bool { public static function isExistBookImage ($name): bool {
return file_exists('../images/books_picture/'.$name.'.jpg'); return file_exists('../images/books_picture/'.$name.'.jpg');
} }
public static function isExistProfileImage (string $name): bool { public static function isExistProfileImage ($name): bool {
return file_exists('../uploads/'.$name.'.jpg'); return file_exists('../uploads/'.$name.'.jpg');
} }
......
...@@ -79,7 +79,11 @@ class Header { ...@@ -79,7 +79,11 @@ class Header {
</a> </a>
</div> </div>
<div class="left-right-border orange-background flex-1 "> <div class="left-right-border orange-background flex-1 ">
<span class="text-size-40">H</span>ISTORY <a href="'.self::URL_HISTORY.'">
<div>
<span class="text-size-40">H</span>ISTORY
</div>
</a>
</div> </div>
<div class="flex-1 "> <div class="flex-1 ">
<a href="'.self::URL_PROFILE.'"> <a href="'.self::URL_PROFILE.'">
...@@ -95,7 +99,11 @@ class Header { ...@@ -95,7 +99,11 @@ class Header {
return ' return '
<div class="flex-container-menu"> <div class="flex-container-menu">
<div class="orange-background flex-1 "> <div class="orange-background flex-1 ">
<span class="text-size-40">B</span>ROWSE <a href="'.self::URL_BROWSE.'">
<div>
<span class="text-size-40">B</span>ROWSE
</div>
</a>
</div> </div>
<div class="left-right-border flex-1 "> <div class="left-right-border flex-1 ">
<a href="'.self::URL_HISTORY.'"> <a href="'.self::URL_HISTORY.'">
...@@ -132,7 +140,11 @@ class Header { ...@@ -132,7 +140,11 @@ class Header {
</a> </a>
</div> </div>
<div class="orange-background flex-1 "> <div class="orange-background flex-1 ">
<span class="text-size-40">P</span>ROFILE <a href="'.self::URL_PROFILE.'">
<div>
<span class="text-size-40">P</span>ROFILE
</div>
</a>
</div> </div>
</div>'; </div>';
} }
......
...@@ -3,14 +3,16 @@ ...@@ -3,14 +3,16 @@
require ('view.php'); require ('view.php');
class bookDetailController { class bookDetailController {
private $username;
private $book_id; private $book_id;
private $book_detail; private $book_detail;
private $reviews; private $reviews;
private $book_rating; private $book_rating;
private $fetchsuccess = TRUE; private $fetchsuccess = TRUE;
public function __construct($book_id) { public function __construct($book_id, $username) {
$this->book_id = $book_id; $this->book_id = $book_id;
$this->username = $username;
$this->fetchBookDetails(); $this->fetchBookDetails();
$this->fetchReviews(); $this->fetchReviews();
$this->fetchRating(); $this->fetchRating();
...@@ -18,21 +20,13 @@ ...@@ -18,21 +20,13 @@
public function showBookDetail() { public function showBookDetail() {
if ($this->fetchsuccess) { if ($this->fetchsuccess) {
/*if (isLogin()) { $params = [
$user_token = getTokenLogin(); 'username' => $this->username,
$user = getUserInfo(getUserIDbyToken($user_token));*/ 'book_detail' => $this->book_detail,
$params = [ 'reviews' => $this->reviews,
'username' => 'ermaer', 'book_rating' => $this->book_rating
//'username' => $user['username'], ];
'book_detail' => $this->book_detail, bookDetailViewer::viewBookDetail($params);
'reviews' => $this->reviews,
'book_rating' => $this->book_rating
];
bookDetailViewer::viewBookDetail($params);
/*} else {
$login = '../login';
header('Location: '.$login);
}*/
} else { } else {
include('../404.html'); include('../404.html');
} }
......
<?php <?php
require('controller.php'); require('controller.php');
if (isset($_GET['id'])) { if (isLogin()) {
$book_id = $_GET['id']; $user_token = getTokenLogin();
$bookDetail = new bookDetailController($book_id); $user = getUserInfo(getUserIDbyToken($user_token));
$bookDetail->showBookDetail();
if (isset($_GET['id'])) {
$book_id = $_GET['id'];
$bookDetail = new bookDetailController($book_id, $user['username']);
$bookDetail->showBookDetail();
} else {
include ('../404.html');
}
} else { } else {
include ('../404.html'); $login = '../login';
} header('Location: '.$login);
}
?> ?>
\ No newline at end of file
...@@ -34,15 +34,13 @@ ...@@ -34,15 +34,13 @@
} }
.order-button { .order-button {
width: 100px; float: right;
display: inline-block; margin-bottom: 100px;
padding: 8px 16px; padding: 5px 30px;
vertical-align: middle; font-size: 25px;
text-align: center; background-color: dodgerblue;
cursor: pointer; color: white;
white-space: nowrap; border-radius: 4px;
background-color: #fff;
font-size: 20px;
} }
.order-button:hover {background-color: #3e8e41} .order-button:hover {background-color: #3e8e41}
......
...@@ -4,11 +4,12 @@ ...@@ -4,11 +4,12 @@
font-size: 28px; font-size: 28px;
font-family: 'Nunito', sans-serif; font-family: 'Nunito', sans-serif;
margin-block-end: 40px; margin-block-end: 40px;
padding: 5px;
} }
.fivestar-rating { .fivestar-rating {
max-width: 60px; max-width: 90px;
max-height: 60px; max-height: 90px;
cursor: pointer; cursor: pointer;
} }
......
...@@ -205,4 +205,20 @@ ...@@ -205,4 +205,20 @@
function getTokenLogin() { function getTokenLogin() {
return $_COOKIE["login"]; return $_COOKIE["login"];
} }
function selectFromWhere($attr, $table, $wherecondition) {
$conn = connect_to_mysql();
$listofattr = [];
if ($conn !== NULL){
$sql_query = "SELECT ". $attr ." FROM ". $table ." WHERE ". $wherecondition;
$result = $conn->query($sql_query);
if ($result != NULL){
while ($row = $result->fetch_assoc()) {
$listofattr[] = $row[$attr];
}
}
$conn->close();
}
return $listofattr;
}
?> ?>
\ No newline at end of file
...@@ -12,6 +12,7 @@ function ratingClick(starValue) { ...@@ -12,6 +12,7 @@ function ratingClick(starValue) {
} }
} }
document.getElementById("rating-given").value = starValue; document.getElementById("rating-given").value = starValue;
document.getElementById("output").innerHTML = document.getElementById("rating-given").value;
} }
function hoverStar(starValue) { function hoverStar(starValue) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment