-
Notifications
You must be signed in to change notification settings - Fork 0
/
fotos.php
163 lines (109 loc) · 3.95 KB
/
fotos.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
<?php
require_once 'config.php';
require_once 'models/Auth.php';
require_once 'dao/PostDaoMysql.php';
//require 'dao/UserDaoMysql.php';
//chama a classe de autenticação
$auth = new Auth($pdo, $base);
//utiliza o metodo de usuario para redirecionar para login ou permitir o acesso ao sistema
$userInfo = $auth->checkToken();
//ativa o active
$activeMenu = 'photos';
$user = [];
$feed = [];
//pega o id do perfil
$id = filter_input(INPUT_GET, 'id');
if(!$id){
$id = $userInfo->id;
}
if($id != $userInfo->id){
$activeMenu = '';
}
$postDao = new PostDaoMysql($pdo);
$userDao = new UserDaoMysql($pdo);
// echo "ID: ".$id;
// exit;
//pegar informações do usuario
$user = $userDao->findById($id, true);
if(!$user){
header("Location: ".$base);
exit;
}
// $dateFrom = new DateTime($user->birthdate);
// $dateTo = new DateTime('today');
// $user->ageYears = $dateFrom->diff($dateTo)->y;
//verificar se eu sigo o usuario
// //instancia a database de post
// $postDao = new PostDaoMysql($pdo);
// //chama nossa função de feed
// $feed = $postDao->getHomeFeed($userInfo->id);
// // echo '<pre>';
// // print_r($feed);
// // echo '</pre>';
// // exit;
require 'partials/header.php';
require 'partials/menu.php';
//require 'app.php';
?>
<section class="feed">
<div class="row">
<div class="box flex-1 border-top-flat">
<div class="box-body">
<div class="profile-cover" style="background-image: url('<?=$base?>/media/covers/<?=$user->cover?>');"></div>
<div class="profile-info m-20 row">
<div class="profile-info-avatar">
<img src="<?=$base?>/media/avatars/<?=$user->avatar?>" />
</div>
<div class="profile-info-name">
<div class="profile-info-name-text"><?=$user->name?></div>
<?php if(!empty ($user->city)):?>
<div class="profile-info-location"><?=$user->city?></div>
<?php endif;?>
</div>
<div class="profile-info-data row">
<div class="profile-info-item m-width-20">
<div class="profile-info-item-n"><?=count($user->followers);?></div>
<div class="profile-info-item-s">Seguidores</div>
</div>
<div class="profile-info-item m-width-20">
<div class="profile-info-item-n"><?=count($user->following);?></div>
<div class="profile-info-item-s">Seguindo</div>
</div>
<div class="profile-info-item m-width-20">
<div class="profile-info-item-n"><?=count($user->photos);?></div>
<div class="profile-info-item-s">Fotos</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="column">
<div class="box">
<div class="box-body">
<div class="full-user-photos">
<?php foreach($user->photos as $key=> $item): ;?>
<div class="user-photo-item">
<a href="#modal-<?=$key;?>" rel="modal:open">
<img src="<?=$base;?>/media/uploads/<?=$item->body;?>" />
</a>
<div id="modal-<?=$key;?>" style="display:none">
<img src="<?=$base;?>/media/uploads/<?=$item->body;?>" />
</div>
</div>
<?php endforeach;?>
<?php if(count($user->photos)=== 0):?>
Não há fotos deste usuario.
<?php endif;?>
</div>
</div>
</div>
</div>
</div>
</section>
<script type="text/javascript" src="assets/js/script.js"></script>
<script type="text/javascript" src="assets/js/vanillaModal.js"></script>
<?php
require 'partials/footer.php';
?>