예제 #1
0
 private function add_existing_friends_from_post(&$view, $list)
 {
     $added = 0;
     if (arr::get($_POST, 'id')) {
         foreach (arr::get($_POST, 'id') as $friend_id) {
             $friend = new Model_Friend((int) $friend_id);
             if (!$friend->loaded()) {
                 $view->errors['existing'] = 'Could not find your friend.';
                 break;
             }
             // TODO: make sure you created your friends
             $friend->add('lists', $list);
             $added++;
         }
     }
     return $added;
 }
예제 #2
0
 /**
  * See if $this is on $user's friends list
  */
 public function is_on_friends_friends_list(Model_User $user)
 {
     $friends_friend = new Model_Friend(array('email' => $this->email, 'creator_id' => $user->id));
     return $friends_friend->loaded();
 }