public function see() { $inbox_id = isset($_GET['id']) ? addslashes($_GET['id']) : die('inbox id empty'); $begin = isset($_GET['begin']) ? addslashes($_GET['begin']) : '0'; $limit = 20; $all = 0; //for all $id = Account::getMyID(); $inbox = new Inbox(); $inbox->getByID($inbox_id); //set read utk inbox if ($inbox->inbox_read == 0) { if ($inbox->inbox_giliran_read == $id) { $inbox->setRead($inbox_id); // set read to 1 $inbox->setOld($inbox_id); // set notification - 1 } } $ir = new InboxReply(); //ambil jumlah total $clause = " inbox_id = '{$inbox_id}' "; $return['total'] = $ir->getJumlah($clause); if ($begin == "all") { $all = 1; $begin = $limit; $limit = $return['total'] - $limit; // echo $return['total']. " " .$begin." ".$limit; } $whereClause = "inbox_id = '{$inbox_id}' ORDER BY inbox_createdate DESC LIMIT {$begin},{$limit}"; $arrReply = $ir->getWhere($whereClause); //set read foreach ($arrReply as $num => $obja) { if ($obja->inbox_read == 0) { if ($inbox->inbox_giliran_read == $id) { //dicomment sementara roy. $obja->setReadReply($obja->inbox_reply_id); } } } //pr($inbox); //pr($arrReply); $newArr[] = $inbox; if ($all) { $merge = array_reverse($arrReply); } else { $merge = array_merge($newArr, array_reverse($arrReply)); } //to $to = new Account(); $to->getByID($inbox->inbox_to); //from $from = new Account(); $from->getByID($inbox->inbox_from); $return['limit'] = $limit; $return['begin'] = $begin; $return['merge'] = $merge; $return['inbox'] = $inbox; $return['arrReply'] = $arrReply; $return['to'] = $to; $return['from'] = $from; $return['webClass'] = __CLASS__; $return['method'] = __FUNCTION__; $return['id'] = $id; $return['all'] = $all; // get all di set jadi di return tanpa chatbox dan judul, isinya aja... if (isset($_GET['all'])) { $return['all'] = $_GET['all']; } Mold::both("inbox/see", $return); }