-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperson.php
More file actions
86 lines (83 loc) · 3.42 KB
/
person.php
File metadata and controls
86 lines (83 loc) · 3.42 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
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
<!DOCTYPE html>
<?php
require_once(dirname(__FILE__).'/Controllers/Controller.php');
$msg = Controller::process();
if (isset($_GET['p'])) {
$id = $_GET['p'];
$person = new Person();
$person->id = $id;
if (!$person->getById()) {
header('Location:notFound.php');
}
}else{
header('Location:notFound.php');
}
?>
<html>
<head>
<link href="css/person.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="img/main/favicon.ico"/>
<title><?php echo $person->first_name . " " . $person->last_name;?></title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<?php
include('page-elements/header.php');
?>
<main>
<div id="all">
<div id="left">
<h1><?php echo $person->first_name . " " . $person->last_name;?></h1>
<?php
$avatar = 'img/people/' . $person->id . '.jpg';
if (!file_exists($avatar)) {
$avatar = 'img/misc/placeholder-avatar.png';
}
?>
<img class="person-img" src="<?php echo $avatar?>"/>
<?php
if(isset($person->birthdate)) {
$dates = explode('-', $person->birthdate);
$year = $dates[0];
$month = $dates[1];
$day = $dates[2];
}
if(isset($person->country)) {
$country = CountryController::getCountryName($person->country);
}
?>
<p><span class="red">» Born:</span> <?php if(isset($person->birthdate)) {echo $day . '/' . $month . '/' . $year;} else {echo "Unknown";}?></p>
<p><span class="red">» Country:</span> <?php if(isset($country)) {echo $country;} else {echo "Unknown";}?></p>
</div>
<?php
$mpr = new MPR();
$mpr->person = $person->id;
$roles = $mpr->getByPerson();
?>
<div id="right">
<h1>Biography</h1>
<p class="pr"><?php if(isset($person->biography)) {echo $person->biography;} else {echo "No biography yet";}?></p>
<p class="pr"><span class="red">Appears in: </span>
<?php
if ($roles) {
echo '</p><table id="table">';
foreach ($roles as $p=>$mr) {
echo '<tr><td><a class="movie-link" href="movie.php?m=' . $mr->movie_id_movie . '">' .
MovieController::getTitle($mr->movie_id_movie) . "</a></td><td>" .
RoleController::getName($mr->role_id_role) . "</td></tr>";
}
echo '</table>';
}
else {
echo "No movies yet</p>";
}
?>
</div>
</div>
</main>
<?php
include('page-elements/footer.php');
?>
</body>
</html>