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


PHP Thread::getByID方法代码示例

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


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

示例1: getElementFromCode

 public static function getElementFromCode($string)
 {
     if (strstr($string, "c")) {
         return Category::getByID(intval(str_replace("c", "", $string)));
     } else {
         if (strstr($string, "b")) {
             return Board::getByID(intval(str_replace("b", "", $string)));
         } else {
             if (strstr($string, "t")) {
                 return Thread::getByID(intval(str_replace("t", "", $string)));
             } else {
                 if (strstr($string, "p")) {
                     return Post::getByID(intval(str_replace("p", "", $string)));
                 }
             }
         }
     }
     return null;
 }
开发者ID:shauncjones,项目名称:Simple-Forum,代码行数:19,代码来源:forum_element.php

示例2: clean

                         $thread = $board->createThread($currentUser, clean($_POST["title"], true), clean($_POST["editableContent"]), time(), $con);
                         $successes[] = "Created forum thread!";
                     } else {
                         if ($_POST["board_name"] || $_POST["editableContent"]) {
                             $board->createBoard($currentUser, clean($_POST["board_name"]), clean($_POST["editableContent"]))->save($con);
                         }
                     }
                 }
             }
         }
         $printContent .= $board->printNewThreadForm();
         $printContent .= $board->printBoardContent($currentUser, $con);
     }
 } else {
     if (strstr($_GET["p"], "t")) {
         $thread = Thread::getByID(intval(str_replace("t", "", $_GET["p"])));
         if ($thread != null) {
             if ($_GET["a"] == "new" && $_POST["editableContent"]) {
                 if ($currentUser != null) {
                     if ($currentUser->id > 0) {
                         $post = $thread->createPost(clean($_POST["editableContent"]), $currentUser, time(), $con);
                     }
                 }
             }
             $printContent .= $thread->printThreadContent($currentUser, $con, intval($_GET["page"]));
             $thread->view($currentUser, $con);
         }
     } else {
         if (strstr($_GET["p"], "c")) {
             $category = Category::getByID(intval(str_replace("c", "", $_GET["p"])));
             if ($category != null) {
开发者ID:shauncjones,项目名称:Simple-Forum,代码行数:31,代码来源:forum.php

示例3: __construct

 function __construct($user, $elementID, $data, $con)
 {
     parent::__construct($user, Thread::getByID(intval($elementID)), $data, $con);
 }
开发者ID:shauncjones,项目名称:Simple-Forum,代码行数:4,代码来源:process.php

示例4: printBoard

 /**
  * Prints out the board as a forum block.
  * @param ForumUser $user - The current user.
  * @return string To be printed.
  */
 public function printBoard($user)
 {
     global $posts_per_page, $permission;
     /**
      * Display the stats.
      */
     $stats = count($this->getPosts()) . " post(s) " . $this->getViews() . " view(s)";
     $printLatestPost = "No posts.";
     $latestPost = $this->getLatestPost();
     if ($latestPost != null) {
         $latestPostUser = getUserByID($latestPost->fields["User"]);
         $thread = Thread::getByID($latestPost->fields["Parent"]);
         if ($latestPostUser != null && $thread != null) {
             $printLatestPost = "Lastest: <a href='{$_SERVER['PHP_SELF']}?p=t" . $thread->getID() . "&page=" . ceil(count($thread->getPosts()) / $posts_per_page) . "#" . $latestPost->getID() . "'>" . limitString($latestPost->name) . "</a><br /> By: <b>" . limitString($latestPostUser->username, 20) . "</b>, " . $latestPost->getDate() . ".";
         }
     }
     $subBoards = "";
     foreach ($this->getChildren() as $child) {
         if ($child instanceof Board) {
             $subBoards .= "<li><a href='{$_SERVER['PHP_SELF']}?p=b{$child->getID()}'>{$child->name}</a></li>";
         }
     }
     if (!empty($subBoards)) {
         $subBoards = "<ul>Sub-Boards: " . $subBoards . "</ul>";
     }
     if ($user->hasPermission($permission['board_edit'], $this->getParent())) {
         $orderHTML = "<a href=\"{$_SERVER['PHP_SELF']}?&o=b{$this->getID()}\" class='btn_small btn_silver btn_flat'>&darr;</a>";
     }
     return "\r\n\t    \t<div class='board_box forum_element'>\r\n\t    \t\t<div class='two_third'>\r\n\t    \t\t\t<span class='" . ($this->isUnread($user) ? "icon_on" : "icon_off") . "'></span>\r\n\t    \t\t\t<div class='board_content'>\r\n\t    \t\t\t\t<h3 class='element_title'><a href='{$_SERVER['PHP_SELF']}?p=b{$this->getID()}'>{$this->name}</a> {$orderHTML}</h3>\r\n\t    \t\t\t\t<div class='element_text'>\r\n\t    \t\t\t\t\t<span>{$this->fields["Description"]}</span>\r\n\t    \t\t\t\t\t<div class='forum_element_info'>{$stats}</div>\r\n\t    \t\t\t\t</div>\r\n\t    \t\t\t</div>\r\n\t    \t\t</div>\r\n\t    \t\t<div class='board_info forum_element_info one_third column-last'>\r\n\t    \t\t\t<p>{$printLatestPost}</p>\r\n\t    \t\t\t<div class='sub_boards'>\r\n\t    \t\t\t\t{$subBoards}\r\n\t    \t\t\t\t<div class='clear'></div>\r\n\t    \t\t\t</div>\r\n\t    \t\t</div>\r\n                <div class='clear'></div>\r\n\t    \t</div>\r\n\t\t\t<div class='hrline_silver'></div>";
 }
开发者ID:shauncjones,项目名称:Simple-Forum,代码行数:35,代码来源:board.php

示例5: getParent

 public function getParent()
 {
     return Thread::getByID($this->fields["Parent"]);
 }
开发者ID:shauncjones,项目名称:Simple-Forum,代码行数:4,代码来源:post.php


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