public function getnotificationsAction() { return; //RC fix :) $favouritesModel = new Default_Model_UserHasFavourites(); $auth = Zend_Auth::getInstance(); $id_usr = 0; if ($auth->hasIdentity()) { $id_usr = $auth->getIdentity()->user_id; } $notifications = $favouritesModel->getAllUpdatedContents($id_usr); //print_r($notifications);die; $ids = array(); if ($notifications) { foreach ($notifications as $k => $notification) { foreach ($notification as $l => $content) { $this->gtranslate->setLangFrom($content['original']['language_cnt']); $translang = $this->gtranslate->getLangPair(); $notifications[$k][$l]['translated'] = $this->gtranslate->translateContent($content['original']); $notifications[$k][$l]['original']['translang'] = $translang; $notifications[$k][$l]['translated']['translang'] = $translang; $ids[] = $l; } } } else { $this->_helper->viewRenderer->setNoRender(true); } $jsonIds = json_encode($ids); $this->view->notifications = $notifications; $this->view->ids = $jsonIds; }
public function getnotificationsAction() { $favouritesModel = new Default_Model_UserHasFavourites(); $auth = Zend_Auth::getInstance(); $id_usr = 0; if ($auth->hasIdentity()) { $id_usr = $auth->getIdentity()->user_id; } //print_r($notifications);die; $ids = array(); $total = 0; $cache = Zend_Registry::get('cache'); if (!($cacheResult = $cache->load('Notifications_' . $id_usr))) { $notifications = $favouritesModel->getAllUpdatedContents($id_usr); $cache->save($notifications, 'Notifications_' . $id_usr); } else { $notifications = $cacheResult; } //print_r($notifications);die; if ($notifications) { foreach ($notifications as $k => $notification) { foreach ($notification as $l => $content) { $this->gtranslate->setLangFrom($content['original']['language_cnt']); $translang = $this->gtranslate->getLangPair(); $notifications[$k][$l]['translated'] = $this->gtranslate->translateContent($content['original']); $notifications[$k][$l]['original']['translang'] = $translang; $notifications[$k][$l]['translated']['translang'] = $translang; $ids[] = $l; $total += $content['updates']['total']; } } } else { $this->_helper->viewRenderer->setNoRender(true); } $jsonIds = Zend_Json::encode($ids); $this->view->notifications = $notifications; $this->view->ids = $jsonIds; $this->view->total = $total; }