-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
92 lines (82 loc) · 2.33 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
include ('includes/header.php');
if (!isset($_GET['user'])) header("Location: profile.php?user=".$user->getUsername());
include ('includes/classes/Message.php');
include ('includes/classes/Follow.php');
$profile_user=new User($pdo,$_GET['user']);
$follow_obj=new Follow($pdo,$profile_user,$user);
?>
<title><?php echo "Viewing Profile - ".$profile_user->getFullName()?></title>
<link rel="stylesheet" type="text/css" href="assets/css/messages.css"/>
<link rel="stylesheet" type="text/css" href="assets/css/profile.css"/>
<?php
//show messages tab
if (isset($_GET['msg']) and $_GET['msg']==1){
echo "<script type='text/javascript'>
$(()=>{
$('#profileTabs a[href=\"#messages\"]').tab('show');
})
</script>";
}
?>
<main>
<div class='userProfileCard'>
<div class="user_details column">
<a href="#">
<img class="user_profile_pic_main" src="<?php echo $profile_user->getProfilePic()?>">
</a>
<span class="name_field">
<a href=""><?php echo $profile_user->getFullName()?></a>
</span>
<div class='profile_user_data'>
<span class='data_username'>(@<?php echo $profile_user->getUsername()?>)</span>
<div class="other_details">
<i class="fa fa-users"></i> <?php echo $profile_user->getNumFriends()?>
<i class="fa fa-edit"></i> <?php echo $profile_user->getNumPosts()?>
<i class="fa fa-heart"></i> <?php echo $profile_user->getNumLikes()?>
</div>
<div id='friendBtnContainer'>
<?php
echo $follow_obj->getButtonState();
?>
</div>
</div>
</div></div>
<?php echo $follow_obj->getNewsfeed(); ?>
<script type="text/javascript">
$('#msg_btn').on('click',function(){
$.post(
"ajax/submit_message.php",
$('form.message_form').serialize()
).done(function(result){
location.reload()
})
})
$('#msgTabBtn').on('click',function(){
$.post(
"ajax/submit_message.php",
$('form.msgTabForm').serialize()
).done(function(result){
window.location=window.location.href+"&msg=1"; //show messages tab
})
})
$('#toast_btn').on('click',function(){
$.post(
"ajax/submit_post.php",
$('form.toast_form').serialize()
).done(function(result){
location.reload()
})
})
$('#home form button').on('click',function(){
console.log('working')
$.post(
"ajax/submit_post.php",
$('#home form').serialize()
).done(()=>{
location.reload()
})
})
</script>
</main>
</body></html>