Example #1
0
 public function getuserlisttopAction()
 {
     $auth = Zend_Auth::getInstance();
     $userid = 0;
     if ($auth->hasIdentity()) {
         $userid = $auth->getIdentity()->user_id;
     }
     $params = $this->getRequest()->getParams();
     $userModel = new Default_Model_User();
     $userIds = $userModel->sortAndFilterUsers($params, null, null);
     if (!$userIds) {
         die;
     }
     $serializedParams = serialize($params);
     $cacheFile = md5($serializedParams);
     $cache = Zend_Registry::get('short_cache');
     if (!($cacheResult = $cache->load('UserTopList_' . $cacheFile))) {
         $topListUsers = new Oibs_Controller_Plugin_Toplist_Users();
         $topListUsers->setUserIdList($userIds)->autoSet();
         $topListCountries = new Oibs_Controller_Plugin_Toplist_Countries();
         $topListCountries->setUserIdList($userIds)->fetchUserCountries()->setTopAmount()->autoSet();
         $topListGroups = new Oibs_Controller_Plugin_Toplist_Groups();
         $topListGroups->setUserIdList($userIds)->fetchUsersInGroups()->setTopAmount()->autoSet();
         $topListCities = new Oibs_Controller_Plugin_Toplist_Cities();
         $topListCities->setUserIdList($userIds)->fetchUsersWithCity()->setTopAmount()->autoSet();
         $topListClasses = array('Users' => $topListUsers, 'Groups' => $topListGroups, 'Cities' => $topListCities, 'Countries' => $topListCountries);
         $cache->save($topListClasses, 'UserTopList_' . $cacheFile);
     } else {
         $topListClasses = $cacheResult;
     }
     $topListUsers = $topListClasses['Users'];
     $topListCountries = $topListClasses['Countries'];
     $topListCities = $topListClasses['Cities'];
     $topListGroups = $topListClasses['Groups'];
     if ($userid) {
         $topListUsers->addUser($userid);
     }
     $topList = $topListUsers->getTopList();
     if ($userid) {
         $topListCountries->addUser($userid);
     }
     $topCountry = $topListCountries->getTopList();
     $topGroup = $topListGroups->getTopList();
     if ($userid) {
         $topListCities->addUser($userid);
     }
     $topCity = $topListCities->getTopList();
     $topListBoxes = array('Users' => $topList, 'Groups' => $topGroup, 'Cities' => $topCity, 'Countries' => $topCountry);
     //print_r($topListBoxes);die;
     $this->view->topListBoxes = $topListBoxes;
 }
Example #2
0
File: User.php Project: jannev/site
 /**
  * 
  * @return array of toplist classes
  */
 public function getUserTopList()
 {
     $cache = Zend_Registry::get('short_cache');
     if (!($cacheResult = $cache->load('UserTopList'))) {
         $topListUsers = new Oibs_Controller_Plugin_Toplist_Users();
         $topListUsers->setLimit(10)->autoSet();
         $topListCountries = new Oibs_Controller_Plugin_Toplist_Countries();
         $topListCountries->fetchUserCountries()->setTopAmount()->autoSet();
         $topListGroups = new Oibs_Controller_Plugin_Toplist_Groups();
         $topListGroups->fetchUsersInGroups()->setTopAmount()->autoSet();
         $topListCities = new Oibs_Controller_Plugin_Toplist_Cities();
         $topListCities->fetchUsersWithCity()->setTopAmount()->autoSet();
         $topListClasses = array('Users' => $topListUsers, 'Groups' => $topListGroups, 'Cities' => $topListCities, 'Countries' => $topListCountries);
         $cache->save($topListClasses, 'UserTopList');
     } else {
         $topListClasses = $cacheResult;
     }
     return $topListClasses;
 }