-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathPostTable.php
More file actions
92 lines (82 loc) · 2.47 KB
/
Copy pathPostTable.php
File metadata and controls
92 lines (82 loc) · 2.47 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
87
88
89
90
91
92
<?php
require_once("action/PostTableAction.php");
$action = new PostTableAction();
$action->execute();
?>
<div class="my-3">
<?php
foreach ($action->posts as $index=>$post) {
$postCreator = $action->getUserByID($post["post_creator"]);
?>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="container">
<div>
<!-- Single post starts here -->
<form name="title" action="index.php" method="post">
<input type="hidden" name="post_id" value="<?=$post["post_id"]?>">
<button type="submit" class="notButton"><?=$post["post_title"]?></button>
</form>
<div class="media text-muted pt-0 mb-3 border-bottom border-gray">
<table>
<tr>
<td>
<strong class="d-block text-gray-dark">From:<?=$postCreator["user_name"]?>
</strong>
<strong class="d-block text-gray-dark">Posted: <?=$post["post_creation_time"]?></strong>
<strong class="d-block">Answers: <?=$post["post_nb_answers"]?></strong>
<strong id="likes" class="d-block"><span class="likes_count">Likes: <?=$post["post_nb_likes"]?></span></strong>
<!--<span class="like fa fa-thumbs-up" data-id="<?=$post["post_id"]?>"></span>
<span class="dislike fa fa-thumbs-down" data-id="<?=$post["post_id"]?>"></span>-->
</td>
<td style="padding: 5px;"><?=$post["post_content"]?></td>
</tr>
</table>
<!-- End of single post -->
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
<!--
<script src="js/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.like').on('click', function(){
var postid = $(this).data('id');
$post = $(this);
$.ajax({
url: 'Post Table.php',
type: 'post',
data: {
'post_liked': 1,
'postid': postid
},
success: function(response){
$post.parent().find('span.likes_count').text("Likes: " + response);
}
});
});
$('.dislike').on('click', function(){
var postid = $(this).data('id');
$post = $(this);
$.ajax({
url: 'Post Table.php',
type: 'post',
data: {
'post_disliked': 1,
'postid': postid
},
success: function(response){
$post.parent().find('span.likes_count').text("Likes: " + response);
}
});
});
});
</script>
-->