This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmessages.php
68 lines (67 loc) · 2.75 KB
/
messages.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
<?php
require_once 'init.php';
if (!$currentUser) {
header('Location: index.php');
exit();
}
$conversations = getLatestConversations($currentUser['id']);
?>
<?php include 'header.php' ?>
<p><a href="new-message.php" class="btn btn-outline-success btn-lg active" role="button" aria-pressed="true"> <i
class="far fa-edit"></i> Tin nhắn mới</a></p>
<div id="message-wrapper">
<div class="message-box d-flex flex-column">
<span class="close">×</span>
<div class="px-3 py-2">
<img id="toUserImage" class="rounded-circle" style="width:60px;height:60px;" />
<div class="d-inline-block text-success pl-2">
<h5 id="toUserName" class="mb-2"></h5>
</div>
<hr />
</div>
<div class="messages">
</div>
<div class="content-input py-2 px-4 pt-4">
<form id="message-form">
<div class="row">
<div class="input-group mb-2">
<input type="text" class="form-control" placeholder="Nhập tin nhắn ở đây..." required>
<div class="input-group-append">
<button style="width: 80px;" class="btn btn-success" type="submit">
<i class="fa fa-paper-plane"></i>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<?php foreach ($conversations as $conversation) : ?>
<div>
<div class="message-list">
<!-- clicking on message element to show the message box -->
<div class="message-bar hover-secondary" data-toUserId="<?php echo $conversation['id']; ?>">
<div class="
d-flex
align-items-center
border
border-right-0
border-left-0
border-bottom-0
px-3
py-2">
<?php echo '<img class="rounded-circle" style="width:100px;height:100px;" src="data:image/jpeg;base64,' . base64_encode($conversation['avatarImage']) . '"/>'; ?>
<div class="d-inline-block text-success pl-2">
<h5 class="mb-2"><?php echo $conversation['displayName'] ?></h5>
<small class="custom-time">Tin nhắn cuối:
<?php echo $conversation['lastMessage']['createdAt'] ?></small>
<!-- should use subString that paragraph -->
<p class="text-secondary"><?php echo $conversation['lastMessage']['content']; ?></p>
</div>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php include 'footer.php' ?>