public function rejectrequestAction() { if ($this->getRequest()->isGet() && !$this->_ajaxRequest) { if ($request = $this->getRequest()->getParam('requestid', FALSE)) { $friendService = new Service_Friend(); if ($result = $friendService->deleteRequest($request, $this->_user->id)) { return $this->_render('requestrejectedsuccess'); } else { $this->view->error = "Sorry. There was a problem processing your request. Please try again later."; return $this->render('friendrequesterror'); } } else { $this->view->error = "Sorry. There was a problem processing your request. Please try again later."; return $this->render('friendrequesterror'); } } else { if ($this->_ajaxRequest) { if ($request = $this->getRequest()->getParam('requestid', FALSE)) { $friendService = new Service_Friend(); if ($result = $friendService->deleteRequest($request, $this->_user->id)) { $this->_response->appendBody("1"); return; } else { $this->_response->appendBody("0"); return; } } else { $this->_response->appendBody("0"); return; } } } }
public function loadnewstoriesAction() { if ($this->getRequest()->isGet() && $this->_ajaxRequest) { $friendService = new Service_Friend(); $storyService = new Service_Userstory(); $friendList = $friendService->fetchFriendIds($this->_user->id); if (is_array($stories = $storyService->fetchByUsersAndTime($this->_user->storyNotificationPeriod, $friendList))) { $results['root'] = $stories; $this->_response->appendBody(Zend_Json::encode($results)); return; } else { $this->_response->appendBody('0'); return; } } else { return $this->_redirect('/notifications'); } }