<aside class="main-sidebar"> <!-- sidebar: style can be found in sidebar.less --> <section class="sidebar"> <!-- Sidebar user panel (optional) --> <div class="user-panel"> <div class="pull-left image"> <img src="img/user2-128x128.jpg" class="img-circle" alt="User Image" /> </div> <div class="pull-left info"> <p><?php echo user_fullname(); ?> </p> <!-- Status --> <a href="#"><i class="fa fa-circle text-success"></i> Online</a> </div> </div> <!-- search form (Optional) --> <form action="#" method="get" class="sidebar-form"> <div class="input-group"> <input type="text" name="q" class="form-control" placeholder="Search..."/> <span class="input-group-btn"> <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button> </span> </div> </form> <!-- /.search form -->
?> </td> <td class="column-fullname"><?php user_fullname(); ?> <br /> <div class="row-actions"> <span class='edit'><a href="<?php editstudentlink(); ?> "><?php _e("Edit"); ?> </a> | </span> <span class='delete'><a onclick="return confirm('Bạn có chắc muốn xóa <?php user_fullname(); ?> ?');" href="<?php deletestudentlink(); ?> "><?php _e("Delete"); ?> </a></span> <!--<span class='email'> | <?php echo make_clickable(user_email()); ?> </span>--> </div> </td>
<?php require 'config.php'; require $root_dir . '/inc/func.php'; require $root_dir . '/inc/db.php'; require $root_dir . '/inc/user.php'; header("Expires: 0"); header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Content-type: application/json"); $chat_id = $_SESSION['chat_id']; $chat = []; if (!empty($chat_id)) { $query = $db->prepare('SELECT *, chat_msg.id as msg_id, chat_msg.date as date_sent ' . 'FROM chat,chat_msg WHERE chat.id = chat_msg.chat_id AND chat.id = :id ORDER BY msg_id ASC'); $query->bindValue(':id', $chat_id); $query->execute(); $messages = $query->fetchAll(); foreach ($messages as $key => $message) { if ($key == 0) { $fullname = user_fullname($message['to_user_id']); } $chat[] = ['msg_id' => $message['msg_id'], 'fullname' => $fullname, 'date_sent' => $message['date_sent'], 'photo' => 'user' . $message['from_user_id'] . '-128x128.jpg', 'message' => $message['message'], 'user_id' => $message['to_user_id']]; } } // [ "Alexander Pierce", "23 Jan 2:00 pm", "user1-128x128.jpg", "Is this template really for free? That's unbelievable!" ], echo json_encode($chat);