public function loadGroupChat() { $gid = isset($_GET['gid']) ? addslashes($_GET['gid']) : die("NO GID"); $m = new ChatMember(); $begin = addslashes($_GET['begin']); $acc = new Account(); //global $db; //$q = "SELECT admin_nama_depan,chat_group_id,chat_member_id,admin_foto FROM {$acc->table_name},{$m->table_name} WHERE chat_group_id = '$gid' AND chat_member_id = admin_id"; $arrMember = $m->getMemberFromGID($gid); //$arrMember = $m->getWhere("chat_group_id = '$gid'"); //cek apakah dia anggota group $ok = 0; $arrUser = array(); $arrUserFoto = array(); foreach ($arrMember as $mm) { if ($mm->chat_member_id == Account::getMyID()) { $ok = 1; } //sortmember spy mudah diambil $arrUser[$mm->chat_member_id] = $mm->admin_nama_depan; $arrUserFoto[$mm->chat_member_id] = $mm->admin_foto; } //ok dia member if ($ok) { //get group $g = new ChatGroup(); $g->getByID($gid); ?> <style> .chatboxfullpage{ // background-color: #fff; // border-radius: 5px; } .memberfoto{ float:right; margin:3px; } </style> <script> latest_entry = 0; </script> <div class="chatboxfullpage col-md-8 col-md-offset-2"> <div class="groupname"> <div class="senderdate" style="width:200px;"> <?php echo ago(strtotime($g->inbox_changedate)); ?> </div> <i class="glyphicon glyphicon-comment"></i> <?php echo stripslashes($g->inbox_judul); ?> <div class="members"> <?php foreach ($arrUserFoto as $id => $foto2) { $foto = Account::getFoto($foto2); ?> <div class="memberfoto"><?php Account::printFoto($foto, 25); ?> </div><?php } ?> </div> <div class="chat_action"> <?php if ($g->inbox_from == Account::getMyID()) { ?> <?php BootstrapUX::createModalButton('Edit Chat Group', _SPPATH . "ChatMsgGroupWeb/inviteNewMember?t=" . time() . "&gid=" . $gid, 'edit chat group', 'btn btn-default btn-xs'); ?> <!--<button onclick="invite_group_chat('<?php echo $gid; ?> ');" class="btn btn-default btn-xs">invite new member</button>--> <button onclick="close_group_chat('<?php echo $gid; ?> ');" class="btn btn-default btn-xs"><?php echo Lang::t('close group'); ?> </button> <?php } else { ?> <button onclick="leave_group_chat('<?php echo $gid; ?> ');" class="btn btn-default btn-xs"><?php echo Lang::t('leave chat'); ?> </button> <?php } ?> <button id="close_chat_<?php echo $gid; ?> " class="btn btn-default btn-xs"><?php echo Lang::t('close chat'); ?> </button> <script> $( "#close_chat_<?php echo $gid; ?> " ).click(function( event ) { event.preventDefault(); lwclose(window.selected_page); deActivateChatMode(); }); </script> </div> <div class="clearfix"></div> </div> <?php $c = new ChatMsg(); $all = 0; $limit = 20; if ($begin == "all") { $all = 1; $arrChat = $c->getWhere("chat_group_id = '{$gid}' ORDER BY inbox_createdate DESC"); } else { $arrChat = $c->getWhere("chat_group_id = '{$gid}' ORDER BY inbox_createdate DESC LIMIT 0,{$limit}"); } //pr($arrChat); $total = $c->getJumlah("chat_group_id = '{$gid}'"); ?> <style type="text/css"> .groupname{ padding:10px; font-weight: bold; //background-color: #efefef; border-bottom: 2px solid #efefef; font-size: 15px; } .baloon { margin: 10px; padding: 10px; } .sender { padding: 10px; padding-top: 0px; } .senderdate { font-size: 0.9em; font-style: italic; color: #999; float: right; width:100px; text-align: right; } .sendername { font-weight: bold; } .msg { background-color: #7fffaf; padding: 10px; } .to .sender { } .to .msg { background-color: #7FDBFF; } .judulinbox { font-size: 16px; padding: 5px; margin: 5px; } .skipbalon0 { margin-top: -20px; } </style> <div id="chatboxcontainer"> <?php $merge = array_reverse($arrChat); if (count($merge) > 0) { //set latest entry ?> <script> latest_entry = '<?php echo $arrChat[0]->inbox_reply_id; ?> '; </script> <?php } if ($total > $limit && !$all) { if ($num == 0) { $prevID = 0; $moreresult = $total - $limit; ?> <div id="overwrite<?php echo $t; ?> "> <div id="showallmsg<?php echo $t; ?> " style="cursor: pointer;text-align: center; background-color: #dedede; padding-top: 10px; padding-bottom: 10px; margin-bottom: 10px; margin-top: 10px;"> <?php echo Lang::t('Show all conversations'); ?> <?php echo "({$moreresult})"; ?> </div> </div> <script type="text/javascript"> $("#showallmsg<?php echo $t; ?> ").click(function () { // $("#chatboxcontainer").load('<?php echo _SPPATH; ?> Inboxweb/see?id=<?php echo $inbox->inbox_id; ?> &begin=all'); openLw('groupchat','<?php echo _SPPATH; ?> ChatMsgWeb/loadGroupChat?gid=<?php echo $gid; ?> &begin=all','scrollBottom'); }); </script> <?php } } foreach ($merge as $num => $obja) { $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($arrUserFoto[$obja->inbox_from]); ?> <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 $arrUser[$obja->inbox_from]; ?> </div> <?php } ?> <div style="padding-top:10px;"> <?php echo stripslashes($obja->inbox_msg); ?> </div> </div> </div> </div> <?php } ?> </div><!-- chatbox container --> </div><!-- chatbox --> <?php //remove notif from this group $g = new ChatGroup(); $g->removeNotifPortal($gid); } }