function Inbox($POD, $count = 20, $offset = 0) { $this->POD = $POD; if (!$this->POD) { return false; } if (!$this->POD->isAuthenticated()) { return false; } // get unread count. $sql = "SELECT count(1) as count FROM messages WHERE userId=" . $this->POD->currentUser()->get('id') . " and status='new';"; $this->POD->tolog($sql, 2); $res = mysql_query($sql, $this->POD->DATABASE); if ($ur = mysql_fetch_assoc($res)) { $this->UNREAD_COUNT = $ur['count']; } mysql_free_result($res); $conditions = array(); $conditions['userId'] = $this->POD->currentUser()->get('id'); $sort = 'GROUP by targetUserId ORDER BY max(date) DESC'; $tables = 'FROM messages m'; $select = 'SELECT m.targetUserId as id, m.userId as ownerId,m.targetUserId,max(m.date) as latestMessage,(TIME_TO_SEC(TIMEDIFF(NOW(),max(date))) / 60) as minutes'; parent::Stack($POD, 'threads', $conditions, $sort, $count, $offset, $tables, $select); return $this; }
function RBStack() { Stack::Stack(); $this->marker_ar = new Stack(); }