Example #1
0
 /**
  * View your inbox
  * @return void
  */
 private function viewInbox()
 {
     require_once FRAMEWORK_PATH . 'models/messages.php';
     $messages = new Messages($this->registry);
     $cache = $messages->getInbox($this->registry->getObject('authenticate')->getUser()->getUserID());
     $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'messages/inbox.tpl.php', 'footer.tpl.php');
     $this->registry->getObject('template')->getPage()->addTag('messages', array('SQL', $cache));
 }
 /**
  * List latest messages
  * 
  * @return Response
  */
 public function inbox()
 {
     if (!empty($this->app['auth']['id'])) {
         $msg = new Messages();
         $offset = $this->app->request->getQuery("offset");
         $limit = $this->app->request->getQuery("limit");
         $this->app->response->setJsonContent($msg->getInbox($this->app['auth']['id'], $offset, $limit));
         return $this->app->response;
     } else {
         $this->app->response->setStatusCode(401, "Unauthorized")->setJsonContent(array('status' => 'ERROR', 'data' => 'Access is not authorized'));
     }
     return $this->app->response;
 }