-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
90 lines (76 loc) · 4.39 KB
/
user.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
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/config/config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/config/classes/user.php';
$userid = isset($_GET["id"]) ? $_GET["id"] : 0;
$userclass = new User;
$user = $userclass::getUser($userid);
if ($user) {
$title = $user["username"] . "'s Profile";
} else {
header("HTTP/1.1 404 Not Found");
$title = "404 Not Found";
}
include_once $_SERVER['DOCUMENT_ROOT'] . '/config/main.php';
$gameclass = new Game;
$games = $gameclass::getGamesByUserId($userid);
?>
<?php echo PageBuilder::buildHeader(); ?>
<?php if ($user) { ?>
<div class="container mt-3 bg-white p-3 rounded">
<div class="p-2 d-flex align-items-center position-relative">
<img class="bg-body-tertiary rounded-circle object-fit-cover" src="/img/pending.png" alt="site logo" width="150" height="150">
<h2 class="ms-3"><?= htmlspecialchars($user["username"]) ?> </h2>
<div class="d-flex align-items-center position-absolute end-0 gap-2">
<button type="button" class="btn btn-warning">Follow</button>
<button type="button" class="btn btn-primary">Friend</button>
</div>
</div>
</div>
<div class="container mt-5 bg-white p-3 rounded">
<ul class="nav nav-underline d-flex justify-content-center" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="about-tab" data-bs-toggle="tab" data-bs-target="#about-tab-pane" type="button" role="tab" aria-controls="about-tab-pane" aria-selected="true">About</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="creations-tab" data-bs-toggle="tab" data-bs-target="#creations-tab-pane" type="button" role="tab" aria-controls="creations-tab-pane" aria-selected="false">Creations</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="about-tab-pane" role="tabpanel" aria-labelledby="about-tab" tabindex="0">
<h2 class="mt-3">About</h2>
<p style="white-space: pre-line;">
<?= $user["about"] != "" ? htmlspecialchars($user["about"]) : "Hi! I'm new to NoneRev!" ?>
</p>
</div>
<div class="tab-pane fade" id="creations-tab-pane" role="tabpanel" aria-labelledby="creations-tab" tabindex="0">
<h2 class="mt-3">Creations</h2>
<div class="games-list d-flex bg-white rounded">
<?php foreach ($games as $game) : ?>
<div class="game-search-item p-3 m-0 position-relative" style="max-width: 180px;">
<div data-testid="game-tile">
<a class="game-card-link" href="/game?id=<?= $game["id"] ?>">
<span class="d-block thumbnail-2d-container game-card-thumb-container rounded" style="width: fit-content; height: fit-content;">
<img class="rounded" src="/img/pending.png" alt="<?= htmlspecialchars($game["title"]) ?>" width="150" height="150">
</span>
<div class="game-card-name game-name-title" title="<?= htmlspecialchars($game["title"]) ?>"><?= htmlspecialchars($game["title"]) ?></div>
<div class="game-card-info" data-testid="game-tile-stats">
<span class="info-label icon-votes-gray"></span>
<span class="info-label vote-percentage-label">90%</span>
<span class="info-label icon-playing-counts-gray"></span>
<span class="info-label playing-counts-label">10.9K</span>
</div>
</a>
</div>
</div>
<?php endforeach; ?>
<?php if (empty($games)) : ?>
<h4 class="text-center">No games found</h4>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php } else { ?>
<h1 class="text-center"></h1>User not found</h1>
<?php } ?>
<?php echo PageBuilder::buildFooter(); ?>