예제 #1
0
 function getLikes()
 {
     global $current_user;
     $current_user = new CurrentUser();
     if (!$current_user->id) {
         return;
     }
     $ids = isset($_POST['wall']) ? $_POST['wall'] : array();
     $realids = array();
     foreach ($ids as $id) {
         $realids[$id] = $id;
     }
     $likes = MongoDatabase::getEventsLikes(array_keys($realids));
     foreach ($likes as $id => $likesArray) {
         if (isset($likesArray[$current_user->id])) {
             $likes[$id]['can'] = 1;
         } else {
             $likes[$id]['can'] = 0;
         }
     }
     $this->data['likes'] = $likes;
 }