本文整理汇总了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;
}
示例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) {
示例3: __construct
function __construct($user, $elementID, $data, $con)
{
parent::__construct($user, Thread::getByID(intval($elementID)), $data, $con);
}
示例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'>↓</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>";
}
示例5: getParent
public function getParent()
{
return Thread::getByID($this->fields["Parent"]);
}