-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
77 lines (57 loc) · 2.03 KB
/
profile.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
<?php
require_once("templates/header.php");
require_once("models/User.php");
require_once("dao/UserDAO.php");
require_once("dao/GameDAO.php");
$user = new User();
$userDao = new UserDAO($conn, $BASE_URL);
$gameDao = new GameDAO($conn, $BASE_URL);
$id = filter_input(INPUT_GET, "id");
if(empty($id)) {
if(!empty($userData)) {
$id = $userData->id;
} else {
$message->setMessage("Usuário não encontrado!", "error", "index.php");
}
} else {
$userData = $userDao->findById($id);
if(!$userData) {
$message->setMessage("Usuário não encontrado!", "error", "index.php");
}
}
$fullName = $user->getFullName($userData);
if($userData->image == "") {
$userData->image = "user.png";
}
$userGames = $gameDao->getGamesByUserId($id);
?>
<div id="main-container" class="container-fluid">
<div class="col-md-8 offset-md-2">
<div class="row profile-container">
<div class="col-md-12 about-container">
<h1 class="page-title"><?= $fullName ?></h1>
<div id="profile-image-container" class="profile-image" style="background-image: url('<?= $BASE_URL ?>img/users/<?= $userData->image ?>')"></div>
<h3 class="about-title">Sobre:</h3>
<?php if(!empty($userData->bio)): ?>
<p class="profile-description"><?= $userData->bio ?></p>
<?php else: ?>
<p class="profile-description">O usuário ainda não escreveu nada aqui...</p>
<?php endif; ?>
</div>
<div class="col-md-12 added-games-container">
<h3>Jogoss que enviou:</h3>
<div class="games-container">
<?php foreach($userGames as $game): ?>
<?php require("templates/game_card.php"); ?>
<?php endforeach; ?>
<?php if(count($userGames) === 0): ?>
<p class="empty-list">O usuário ainda não enviou jogos.</p>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php
require_once("templates/footer.php");
?>