protected function _notifications() { $user = new User(null); $u = iterator_to_array($user->filter(array())); if ($id = $this->input->post('id')) { $notify = new Notify(); $this->_display->view('debug/notification.php', array('users' => $u, 'selected' => $id, 'notifications' => $notify->get_all(new \MongoId($id)))); } else { $this->_display->view('debug/notification.php', array('users' => $u, 'selected' => null, 'notifications' => array())); } }
protected function _notify() { // Fix URLs b/w migrations & remove deleted users $notify = new Notify(); foreach ($notify->all() as $n) { $u = null; $uinfo = (new \app\models\simple\User($n['sender']))->get(); $u = $uinfo['type']; if ($u) { $notify->modify(array('_id' => $n['_id']), array('$set' => array('url' => Url::base($u)))); } else { $notify->purge(array('_id' => $n['_id'])); } } }
protected function _cleanup() { $notify = new Notify(); $notify->mail_purge(array('$or' => array(array('sent' => true), array('tries' => self::MAX_TRIES)))); }
protected function _view($id) { $notify = new Notify(); $n = $notify->get(new \MongoId($id), true, UserSession::get('user._id')); Url::redirect(empty($n['url']) ? Url::referrer() : $n['url']); }