-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewFilms.php
More file actions
51 lines (49 loc) · 1.79 KB
/
Copy pathviewFilms.php
File metadata and controls
51 lines (49 loc) · 1.79 KB
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
<?php
require_once("session_helper.php");
require_once("dbFunctions.php");
require_once("components/header.php");
require_once("Pagination.php");
?>
<?php
$url = $_SERVER['REQUEST_URI'];
$page = $_GET['page']??1;
$per_page = 5;
$total = get_count('films');
$pagination = new Pagination($page, $per_page, $total);
$start = $pagination->get_start();
$films = getAllFilms($start,$per_page);
if(!empty($films)){
echo "<table><tr><th>Id</th><th>Title</th><th>format</th><th>Release year</th><th>Actors</th><th>Видалити фільм</th></tr>";
foreach($films as $film){
echo "<tr>";
echo "<td>" . $film["film_id"] . "</td>";
echo "<td>" . $film["title"] . "</td>";
echo "<td>" . $film["format"] . "</td>";
echo "<td>" . $film["release_year"] . "</td>";
echo "<td>" . $film["actors"] . "</td>";
echo "<td><button onclick='showModal(". $film["film_id"] .",\"".$url."\")'>Видалити</button></td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
if($total>$per_page){
echo $pagination->get_html();
}
?>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p>Ви дійсно хочете видалити цей фільм</p>
<button onclick="delFilm()">Так</button>
<button onclick="hideModal()">Ні</button>
</div>
</div>
<?php
}
else{
echo "Фільми не знайдено";
}
echo "<br>";
echo "<a href='main.php'>Повернутися</a>";
require_once("components/footerWithjs.php");
?>