Пример #1
0
 public function listAll()
 {
     redirect_guest_user(LOGIN_URL);
     $auth_user = User::getAuthenticated();
     $follows = Follow::getAll($auth_user);
     $updates = Follow::getUpdates($auth_user);
     $threads = array();
     $updated_threads = array();
     foreach ($follows as $follow) {
         $threads[] = Thread::get($follow->thread_id);
     }
     foreach ($updates as $update) {
         $thread = Thread::get($update->thread_id);
         $thread->update_count = $update->count;
         $thread->follow_id = $update->id;
         $updated_threads[] = $thread;
     }
     $title = 'Follows';
     $this->set(get_defined_vars());
 }
Пример #2
0
 public function view()
 {
     $id = Param::get('id');
     $auth_user = User::getAuthenticated();
     if ($id) {
         $user = User::getOrFail($id);
     } elseif ($auth_user) {
         $user = $auth_user;
     } else {
         redirect(LOGIN_URL);
     }
     $threads = Thread::getAllByUser($user);
     $comments = Comment::getAllByUser($user);
     $follows = Follow::getAll($user);
     foreach ($follows as $follow_key => $follow_element) {
         $thread = Thread::get($follow_element->thread_id);
         $follow_element->thread_title = $thread->title;
     }
     $title = $user->username;
     $this->set(get_defined_vars());
 }