-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
461 lines (408 loc) · 16.5 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<?php
require_once __DIR__.'/model/DataBase.php';
require_once __DIR__.'/model/genre.php';
require_once __DIR__.'/model/author.php';
require_once __DIR__.'/model/book.php';
require_once __DIR__.'/Controller/HomeController.php';
require_once __DIR__.'/Controller/CommentController.php';
$books = book::all();
$genres = Genre::all();
$authors = Author::all();
$pb = book::popular();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>BookStore</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="view/interface/css/normalize.css">
<link rel="stylesheet" type="text/css" href="view/interface/icomoon/icomoon.css">
<link rel="stylesheet" type="text/css" href="view/interface/css/vendor.css">
<link rel="stylesheet" type="text/css" href="view/interface/style.css">
</head>
<body data-bs-spy="scroll" data-bs-target="#header" tabindex="0">
<div id="header-wrap">
<div class="top-content">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="social-links">
<ul>
<li>
<a href="#"><i class="icon icon-facebook"></i></a>
</li>
<li>
<a href="#"><i class="icon icon-twitter"></i></a>
</li>
<li>
<a href="#"><i class="icon icon-youtube-play"></i></a>
</li>
<li>
<a href="#"><i class="icon icon-behance-square"></i></a>
</li>
</ul>
</div><!--social-links-->
</div>
<div class="col-md-6">
<div class="right-element">
<a href="#" class="user-account for-buy"><i
class="icon icon-user"></i><span>Account</span></a>
<a href="#" class="cart for-buy"><i class="icon icon-clipboard"></i><span>Cart:(0
$)</span></a>
<div class="action-menu">
<div class="search-bar">
<a href="#" class="search-button search-toggle" data-selector="#header-wrap">
<i class="icon icon-search"></i>
</a>
<form role="search" method="get" class="search-box">
<input class="search-field text search-input" placeholder="Search"
type="search">
</form>
</div>
</div>
</div><!--top-right-->
</div>
</div>
</div>
</div><!--top-content-->
<header id="header">
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
<div class="main-logo">
<a href="index.php"><img src="view/interface/images/logo.png" alt="logo"></a>
</div>
</div>
<div class="col-md-10">
<nav id="navbar">
<div class="main-menu stellarnav">
<ul class="menu-list">
<li class="menu-item active"><a href="index.php">Home</a></li>
<li class="menu-item"><a href="#featured-books" class="nav-link">Featured</a></li>
<li class="menu-item"><a href="#best-selling" class="nav-link">Best Selling</a></li>
<li class="menu-item"><a href="#popular-books" class="nav-link">Popular</a></li>
</ul>
<div class="hamburger">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
</div>
</nav>
</div>
</div>
</div>
</header>
</div><!--header-wrap-->
<section id="billboard">
<div class="container">
<div class="row">
<div class="col-md-12">
<button class="prev slick-arrow">
<i class="icon icon-arrow-left"></i>
</button>
<div class="main-slider pattern-overlay">
<div class="slider-item">
<div class="banner-content">
<h2 class="banner-title">harry potter and the philosopher's stone </h2>
<p>Harry Potter thinks he is an ordinary boy - until he is rescued by an owl, taken to Hogwarts School of Witchcraft and Wizardry, learns to play Quidditch and does battle in a deadly duel. The Reason ... HARRY POTTER IS A WIZARD! "" </p>
<div class="btn-wrap">
<a href="#" class="btn btn-outline-accent btn-accent-arrow">Read More<i
class="icon icon-ns-arrow-right"></i></a>
</div>
</div><!--banner-content-->
<img src="Images/cover/harrypotter1.jpg" alt="banner" class="banner-image">
</div><!--slider-item-->
<div class="slider-item">
<div class="banner-content">
<h2 class="banner-title">harry potter and the chamber of secretsl</h2>
<p>The Dursleys were so mean and hideous that summer that all Harry Potter wanted was to get back to the Hogwarts School for Witchcraft and Wizardry. But just as he's packing his bags, Harry receives a warning from a strange, impish creature named Dobby who says that if Harry Potter returns to Hogwarts, disaster will strike.</p>
<div class="btn-wrap">
<a href="#" class="btn btn-outline-accent btn-accent-arrow">Read More<i
class="icon icon-ns-arrow-right"></i></a>
</div>
</div><!--banner-content-->
<img src="images/cover/harrypotter2.jpg" alt="banner" class="banner-image">
</div><!--slider-item-->
</div><!--slider-->
<button class="next slick-arrow">
<i class="icon icon-arrow-right"></i>
</button>
</div>
</div>
</div>
</section>
<section id="client-holder" data-aos="fade-up">
<div class="container">
<div class="row">
<div class="inner-content">
<div class="logo-wrap">
<div class="grid">
<a href="#"><img src="view/interface/images/client-image1.png" alt="client"></a>
<a href="#"><img src="view/interface/images/client-image2.png" alt="client"></a>
<a href="#"><img src="view/interface/images/client-image3.png" alt="client"></a>
<a href="#"><img src="view/interface/images/client-image4.png" alt="client"></a>
<a href="#"><img src="view/interface/images/client-image5.png" alt="client"></a>
</div>
</div><!--image-holder-->
</div>
</div>
</div>
</section>
<section id="featured-books" class="py-5 my-5">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="section-header align-center">
<div class="title">
<span>Some quality items</span>
</div>
<h2 class="section-title">Featured Books</h2>
</div>
<?php if (isset($_GET['controller']) && $_GET['controller'] == 'HomeController' && isset($_GET['action']) && $_GET['action'] == 'indexAction') { ?>
<div class="product-list" data-aos="fade-up">
<div class="row">
<?php foreach($books as $b) { ?>
<div class="col-md-3">
<div class="product-item">
<figure class="product-style">
<img src="images/cover/<?= $b->get_image() ?>" alt="Books" class="product-item">
<button type="button" class="add-to-cart" data-product-tile="add-to-cart">Add to Cart</button>
</figure>
<figcaption>
<h3><?= $b->get_title() ?></h3>
<?php foreach($authors as $a) {
if ($a->get_id_author() == $b->get_id_author()) {
?><span><?= $a->get_name() ?></span><?php
}
} ?>
<div class="item-price">DT <?= $b->get_price() ?></div>
</figcaption>
</div>
</div>
<?php } ?>
</div>
</div>
<?php } else { ?>
<div class="product-list" data-aos="fade-up">
<div class="row">
<?php
$counter = 0;
foreach($books as $b) {
if ($counter < 4) {
?>
<div class="col-md-3">
<div class="product-item">
<figure class="product-style">
<img src="images/cover/<?= $b->get_image() ?>" alt="Books" class="product-item">
<button type="button" class="add-to-cart" data-product-tile="add-to-cart">Add to Cart</button>
</figure>
<figcaption>
<h3><?= $b->get_title() ?></h3>
<?php foreach($authors as $a) {
if ($a->get_id_author() == $b->get_id_author()) {
?><span><?= $a->get_name() ?></span><?php
}
} ?>
<div class="item-price">DT <?= $b->get_price() ?></div>
</figcaption>
</div>
</div>
<?php
$counter++;
} else {
break;
}
}
?>
</div>
</div>
<?php } ?>
</div><!-- col-md-12 -->
</div><!-- row -->
<div class="row">
<div class="col-md-12">
<div class="btn-wrap align-right">
<a href="index.php?controller=HomeController&action=indexAction#featured-books" target="sect" class="btn-accent-arrow">View all Books <i class="icon icon-ns-arrow-right"></i></a>
</div>
</div>
</div><!-- row -->
</div><!-- container -->
</section>
<section id="best-selling" class="leaf-pattern-overlay">
<div class="corner-pattern-overlay"></div>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="row">
<?php
$b=Book::topsell();
?>
<div class="col-md-6">
<figure class="products-thumb">
<img src="images/cover/<?=$b[0]->get_image();?>" alt="book" class="single-image">
</figure>
</div>
<div class="col-md-6">
<div class="product-entry">
<h2 class="section-title divider">Best Selling Book</h2>
<div class="products-content">
<div class="author-name"></div>
<h3 class="item-title"><?=$b[0]->get_title();?></h3>
<p><?=$b[0]->get_description();?></</p>
<div class="item-price">DT <?=$b[0]->get_price();?></</div>
<div class="btn-wrap">
<a href="#" class="btn-accent-arrow">shop it now <i
class="icon icon-ns-arrow-right"></i></a>
</div>
</div>
</div>
</div>
</div>
<!-- / row -->
</div>
</div>
</div>
</section>
<section id="popular-books" class="bookshelf py-5 my-5">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="section-header align-center">
<div class="title">
<span>Some quality items</span>
</div>
<h2 class="section-title">Popular Books</h2>
</div>
<ul class="tabs">
<?php
foreach($genres as $g){
?>
<a href="index.php?id_genre=<?=$g->get_id_genre()?>#popular-books" class="tab"><?=$g->get_genre()?></a>
<?php
}
?>
</ul>
<div class="tab-content">
<div id="<?=$g->get_genre();?>" data-tab-content class="active">
<div class="row">
<?php
if(isset($_GET["id_genre"])){
foreach($pb as $b){
if($b->get_id_genre()==$_GET["id_genre"]){
?>
<div class="col-md-3">
<div class="product-item">
<figure class="product-style">
<img src="images/cover/<?=$b->get_image()?>" alt="Books" class="product-item">
<button type="button" class="add-to-cart" data-product-tile="add-to-cart">Add to
Cart</button>
</figure>
<figcaption>
<h3><?=$b->get_title()?></h3>
<span><?php foreach($authors as $a) {
if ($a->get_id_author() == $b->get_id_author()) {
?><span><?= $a->get_name() ?></span><?php
}
} ?></span>
<div class="item-price">DT <?=$b->get_price()?></div>
</figcaption>
</div>
</div>
<?php
}}}
else{
echo"<h2>Select a Genre</h2>";
}
?>
</div>
</div>
</div>
</div>
</section>
<section id="subscribe">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="row">
<div class="col-md-6">
<div class="title-element">
<h2 class="section-title divider">Send Us a Message</h2>
</div>
</div>
<div class="col-md-6">
<div class="subscribe-content" data-aos="fade-up">
<p>Your Opinion Matters for our improvement</p>
<form method="POST" action="index.php?controller=comment&action=store">
<input type="text" name="fname" placeholder="First Name">
<input type="text" name="lname" placeholder="Last Name">
<input type="text" name="email" placeholder="email">
<input type="text" name="message" placeholder="Your Opinion">
<button type="submit" class="btn-subscribe">
<span>Send</span>
<i class="icon icon-send"></i>
</button>
</form>
</div>
</div>
<?php
if (isset($_GET['controller']) && $_GET['controller'] == 'comment' && isset($_GET['action']) && $_GET['action'] == 'store') {
CommentController::storeAction($_POST);
}
?>
</div>
</div>
</div>
</div>
</section>
<div id="footer-bottom">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="copyright">
<div class="row">
<div class="col-md-6">
<p>© 2022 All rights reserved. Free HTML Template by <a
href="https://www.templatesjungle.com/" target="_blank">TemplatesJungle</a></p>
</div>
<div class="col-md-6">
<div class="social-links align-right">
<ul>
<li>
<a href="#"><i class="icon icon-facebook"></i></a>
</li>
<li>
<a href="#"><i class="icon icon-twitter"></i></a>
</li>
<li>
<a href="#"><i class="icon icon-youtube-play"></i></a>
</li>
<li>
<a href="#"><i class="icon icon-behance-square"></i></a>
</li>
</ul>
</div>
</div>
</div>
</div><!--grid-->
</div><!--footer-bottom-content-->
</div>
</div>
</div>
<script src="view/interface/js/jquery-1.11.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm"
crossorigin="anonymous"></script>
<script src="view/interface/js/plugins.js"></script>
<script src="view/interface/js/script.js"></script>
</body>
</html>