public function getLastEntries() { $gid = isset($_GET['gid']) ? addslashes($_GET['gid']) : die("NO GID"); $latest = isset($_GET['latest']) ? addslashes($_GET['latest']) : die("NO GID"); $c = new ChatMsg(); $latest_entry = 0; $arrChat = $c->getWhere("chat_group_id = '{$gid}' AND inbox_reply_id > {$latest} ORDER BY inbox_createdate ASC"); foreach ($arrChat as $num => $obja) { $acc = new Account(); $acc->getByID($obja->inbox_from); $latest_entry = $obja->inbox_reply_id; $replyid = isset($obja->inbox_reply_id) ? $obja->inbox_reply_id : $obja->inbox_id; //cek prevID if ($prevID == $obja->inbox_from) { $skipbalon = 0; } else { $skipbalon = 1; $prevID = $obja->inbox_from; } ?> <div class="row <?php echo $class; ?> baloon" id="inbox-<?php echo $replyid; ?> "> <div class="skipbalon<?php echo $skipbalon; ?> "> <div style="float:left; width: 45px; padding-left:10px; padding-right: 10px; padding-top: 10px;"> <?php if ($skipbalon) { $foto = Account::getFoto($acc->admin_foto); ?> <div class="senderfoto"><?php Account::printFoto($foto, 45); ?> </div> <?php } ?> </div> <div style="margin-left:65px; padding-left: 10px; border:1px dotted #dedede; padding: 10px;"> <div class="senderdate"><?php echo ago(strtotime($obja->inbox_createdate)); ?> </div> <?php if ($skipbalon) { ?> <div class="sendername"><?php echo $acc->admin_nama_depan; ?> </div> <?php } ?> <div style="padding-top:10px;"> <?php echo stripslashes($obja->inbox_msg); ?> </div> </div> </div> </div> <?php } //remove notif from this group $g = new ChatGroup(); $g->removeNotifPortal($gid); ?> <script> latest_entry = '<?php echo $latest_entry; ?> '; </script> <?php }