当前位置: 首页>>代码示例>>PHP>>正文


PHP Thread::get方法代码示例

本文整理汇总了PHP中Thread::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Thread::get方法的具体用法?PHP Thread::get怎么用?PHP Thread::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Thread的用法示例。


在下文中一共展示了Thread::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 /**
  * To view all comments on a particular thread.
  **/
 public function view()
 {
     $thread = Thread::get(Param::get('thread_id'));
     $comments = $thread->getComments();
     $user_name = $_SESSION['username'];
     $this->set(get_defined_vars());
 }
开发者ID:LowellaMercurio,项目名称:board-1,代码行数:10,代码来源:comment_controller.php

示例2: view

 public function view()
 {
     $comment = Comment::get(Param::get('id'));
     $auth_user = User::getAuthenticated();
     $thread = Thread::get($comment->thread_id);
     $title = "#{$comment->id}";
     $this->set(get_defined_vars());
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:8,代码来源:comment_controller.php

示例3: redirect

 public function redirect()
 {
     $follow = Follow::getOrFail(Param::get('id'));
     $thread = Thread::get($follow->thread_id);
     $last_comment_id = Comment::getLastIdInThread($thread);
     $follow->last_comment = $last_comment_id;
     $follow->update();
     redirect(VIEW_THREAD_URL, array('id' => $thread->id, 'page' => ThreadController::LAST_PAGE));
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:9,代码来源:follow_controller.php

示例4: getTrending

 public static function getTrending($limit)
 {
     $trends = Comment::countToday();
     $threads = array();
     foreach ($trends as $trend) {
         $thread = Thread::get($trend['thread_id']);
         $thread->count = $trend['count'];
         $threads[] = $thread;
     }
     usort($threads, function ($thread_a, $thread_b) {
         $diff = $thread_b->count - $thread_a->count;
         if ($diff != 0) {
             return $diff;
         } else {
             return $thread_b->id - $thread_a->id;
         }
     });
     return array_slice($threads, 0, $limit);
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:19,代码来源:thread.php

示例5: write

 public function write()
 {
     $thread = Thread::get(Param::get('thread_id'));
     $comment = new Comment();
     $page = Param::get('page_next');
     switch ($page) {
         case 'write_end':
             $comment->username = Param::get('username');
             $comment->body = Param::get('body');
             try {
                 $thread->write($comment);
             } catch (ValidationException $e) {
                 $page = 'write';
             }
             break;
         default:
             throw new NotFoundException("{$page} is not found");
             break;
     }
     $this->set(get_defined_vars());
     $this->render($page);
 }
开发者ID:ry-htr,项目名称:dietcake-sample,代码行数:22,代码来源:thread_controller.php

示例6: delete

 public function delete()
 {
     redirect_guest_user(LOGIN_URL);
     $page = Param::get('page_next', 'delete');
     $thread = Thread::get(Param::get('id'));
     $auth_user = User::getAuthenticated();
     if (!$thread->isAuthor($auth_user)) {
         throw new PermissionException();
     }
     switch ($page) {
         case 'delete':
             break;
         case 'delete_end':
             $thread->delete();
             redirect(LIST_THREADS_URL);
             break;
         default:
             break;
     }
     $title = 'Delete thread';
     $this->set(get_defined_vars());
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:22,代码来源:thread_controller.php

示例7: update

 /**
  * Edit title of thread by owner
  */
 public function update()
 {
     $thread = Thread::get(Param::get('thread_id'));
     $thread->title = Param::get('title');
     $status = "";
     if ($thread->title) {
         try {
             $thread->update(User::getId($_SESSION['username']));
             $status = notify("Update Success");
         } catch (AppException $e) {
             $status = notify($e->getMessage(), 'error');
         }
     }
     $this->set(get_defined_vars());
 }
开发者ID:jeszytanada,项目名称:BoardJeszy,代码行数:18,代码来源:thread_controller.php

示例8: isThreadBody

 public function isThreadBody()
 {
     $thread = Thread::get($this->thread_id);
     $first_comment = Comment::getFirstInThread($thread);
     return $first_comment->id == $this->id;
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:6,代码来源:comment.php

示例9: view

 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());
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:21,代码来源:user_controller.php


注:本文中的Thread::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。