示例#1
0
 public function getUsersWhoFollowContent($id_cnt)
 {
     $favouriteModel = new Default_Model_UserHasFavourites();
     $userProfileModel = new Default_Model_UserProfiles();
     $contentHasUserModel = new Default_Model_ContentHasUser();
     $favouriteIds = $this->_simplifyArray($favouriteModel->getAllUserIdsFromFavouriteContent($id_cnt));
     $ownerIds = $this->_simplifyArray($contentHasUserModel->getContentOwners($id_cnt));
     $mergedIds = array_merge($favouriteIds, $ownerIds);
     $followingUsers = array_keys($userProfileModel->getUsersWhoFollowContents($mergedIds));
     return $followingUsers;
 }
示例#2
0
 public function deleteNotificationCache($id_cnt = 0, $user_id = 0)
 {
     $cache = Zend_Registry::get('cache');
     if ($id_cnt > 0) {
         if ($user_id == 0) {
             $contentModel = new Default_Model_Content();
             $owner = $contentModel->getOwnerId($id_cnt);
             $cache->remove('Notifications_' . $owner);
             $favouriteModel = new Default_Model_UserHasFavourites();
             $idlist = $favouriteModel->getAllUserIdsFromFavouriteContent($id_cnt);
             foreach ($idlist as $id) {
                 $cache->remove('Notifications_' . $id['id_usr']);
             }
         } else {
             $cache->remove('Notifications_' . $user_id);
         }
         return true;
     }
     return false;
 }