CMS  Version 3.9
ForumListView Class Reference

Public Member Functions

 ForumListView ($fora, $forumLink, $messageLink, $id="forum_list", $reorder=false)
 
 formatTitle ($item)
 
 formatLastPost ($item)
 
 writeScript ()
 
 drawView ()
 

Public Attributes

 $fora
 
 $id
 
 $table
 
 $forumLink
 
 $messageLink
 
 $reorder
 

Detailed Description

Definition at line 41 of file forum_view.inc.

Member Function Documentation

◆ drawView()

ForumListView::drawView ( )

Definition at line 108 of file forum_view.inc.

109  {
110  $this->table->drawView();
111  }

◆ formatLastPost()

ForumListView::formatLastPost (   $item)

Definition at line 89 of file forum_view.inc.

90  {
91  $lastPost = $item->LastPost();
92  if (!$lastPost) return "<em>No posts</em>";
93  $user = $lastPost->Author();
94  $userProfile = ForumManager::formatUserProfile($user);
95 
96  $title = $lastPost->title ? $lastPost->title : "No Title";
97 
98  return "<a href='{$this->messageLink}?forum_id={$lastPost->forum_id}&topic_id={$lastPost->topic_id}'>{$title}</a><br/>".
99  "<span class='small'>by ".$userProfile." ({$lastPost->date_posted})</span>";
100 
101  }
static formatUserProfile($u)
global $user

◆ formatTitle()

ForumListView::formatTitle (   $item)

Definition at line 79 of file forum_view.inc.

80  {
81  $text = $item->format("<a href='{$this->forumLink}?forum_id={forum_id}'>{title|No Title}</a>");
82  if ($item->teaser)
83  {
84  $text .= "<br/><span class='small'>{$item->teaser}</span>";
85  }
86  return $text;
87  }

◆ ForumListView()

ForumListView::ForumListView (   $fora,
  $forumLink,
  $messageLink,
  $id = "forum_list",
  $reorder = false 
)

Definition at line 50 of file forum_view.inc.

51  {
52  $this->fora = $fora;
53  $this->id = $id;
54 
55  $this->forumLink = $forumLink;
56  $this->messageLink = $messageLink;
57 
58  $this->table = new DataListView($fora, $id);
59 
60 
61  $this->table->column("Title", array($this, formatTitle), true, "width: 40%")
62  ->column("Last Post", array($this, formatLastPost), true, "width: 40%")
63  ->column("Topics", "{topics}", true, "width: 10%;text-align: center")
64  ->column("Posts", "{posts}", true, "width: 10%;text-align: center");
65 
66  if (checkRole("admin") && $reorder)
67  {
68  $this->table->enableDragReorder("/action/forum/reorder_forums");
69  }
70  else
71  {
72  $this->table->pageSize = Settings::getValue("forum", "forum_list_items_per_page");
73  $this->table->filter = true;
74  }
75 
76  $this->table->emptyMessage = "No fora have been created";
77  }
formatLastPost($item)
Definition: forum_view.inc:89
formatTitle($item)
Definition: forum_view.inc:79
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104

◆ writeScript()

ForumListView::writeScript ( )

Definition at line 103 of file forum_view.inc.

104  {
105  return $this->table->writeScript();
106  }

Member Data Documentation

◆ $fora

ForumListView::$fora

Definition at line 43 of file forum_view.inc.

◆ $forumLink

ForumListView::$forumLink

Definition at line 46 of file forum_view.inc.

◆ $id

ForumListView::$id

Definition at line 44 of file forum_view.inc.

◆ $messageLink

ForumListView::$messageLink

Definition at line 47 of file forum_view.inc.

◆ $reorder

ForumListView::$reorder

Definition at line 48 of file forum_view.inc.

◆ $table

ForumListView::$table

Definition at line 45 of file forum_view.inc.


The documentation for this class was generated from the following file: