Commit cd2e8206 authored by Ranindya Paramitha's avatar Ranindya Paramitha
Browse files
parents ed43e794 8a340399
......@@ -3,11 +3,11 @@
class fileProcessing {
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');
}
public static function isExistProfileImage (string $name): bool {
public static function isExistProfileImage ($name): bool {
return file_exists('../uploads/'.$name.'.jpg');
}
......
......@@ -79,7 +79,11 @@ class Header {
</a>
</div>
<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 class="flex-1 ">
<a href="'.self::URL_PROFILE.'">
......@@ -95,7 +99,11 @@ class Header {
return '
<div class="flex-container-menu">
<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 class="left-right-border flex-1 ">
<a href="'.self::URL_HISTORY.'">
......@@ -132,7 +140,11 @@ class Header {
</a>
</div>
<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>';
}
......
......@@ -3,14 +3,16 @@
require ('view.php');
class bookDetailController {
private $username;
private $book_id;
private $book_detail;
private $reviews;
private $book_rating;
private $fetchsuccess = TRUE;
public function __construct($book_id) {
public function __construct($book_id, $username) {
$this->book_id = $book_id;
$this->username = $username;
$this->fetchBookDetails();
$this->fetchReviews();
$this->fetchRating();
......@@ -18,21 +20,13 @@
public function showBookDetail() {
if ($this->fetchsuccess) {
/*if (isLogin()) {
$user_token = getTokenLogin();
$user = getUserInfo(getUserIDbyToken($user_token));*/
$params = [
'username' => 'ermaer',
//'username' => $user['username'],
'book_detail' => $this->book_detail,
'reviews' => $this->reviews,
'book_rating' => $this->book_rating
];
bookDetailViewer::viewBookDetail($params);
/*} else {
$login = '../login';
header('Location: '.$login);
}*/
$params = [
'username' => $this->username,
'book_detail' => $this->book_detail,
'reviews' => $this->reviews,
'book_rating' => $this->book_rating
];
bookDetailViewer::viewBookDetail($params);
} else {
include('../404.html');
}
......
<?php
require('controller.php');
if (isset($_GET['id'])) {
$book_id = $_GET['id'];
$bookDetail = new bookDetailController($book_id);
$bookDetail->showBookDetail();
if (isLogin()) {
$user_token = getTokenLogin();
$user = getUserInfo(getUserIDbyToken($user_token));
if (isset($_GET['id'])) {
$book_id = $_GET['id'];
$bookDetail = new bookDetailController($book_id, $user['username']);
$bookDetail->showBookDetail();
} else {
include ('../404.html');
}
} else {
include ('../404.html');
}
$login = '../login';
header('Location: '.$login);
}
?>
\ No newline at end of file
......@@ -34,15 +34,13 @@
}
.order-button {
width: 100px;
display: inline-block;
padding: 8px 16px;
vertical-align: middle;
text-align: center;
cursor: pointer;
white-space: nowrap;
background-color: #fff;
font-size: 20px;
float: right;
margin-bottom: 100px;
padding: 5px 30px;
font-size: 25px;
background-color: dodgerblue;
color: white;
border-radius: 4px;
}
.order-button:hover {background-color: #3e8e41}
......
......@@ -4,11 +4,12 @@
font-size: 28px;
font-family: 'Nunito', sans-serif;
margin-block-end: 40px;
padding: 5px;
}
.fivestar-rating {
max-width: 60px;
max-height: 60px;
max-width: 90px;
max-height: 90px;
cursor: pointer;
}
......
......@@ -205,4 +205,20 @@
function getTokenLogin() {
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) {
}
}
document.getElementById("rating-given").value = starValue;
document.getElementById("output").innerHTML = document.getElementById("rating-given").value;
}
function hoverStar(starValue) {
......
Markdown is supported
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