CMS  Version 3.9
ForumDetailsView Class Reference

Public Member Functions

 ForumDetailsView ($forum, $topicLink)
 
 formatTitle ($topic)
 
 formatLastPost ($topic)
 
 writeScript ()
 
 drawView ()
 

Public Attributes

 $forum
 
 $topics
 
 $messages
 
 $table
 
 $topicLink
 
 $width
 
 $subscriptionView
 

Detailed Description

Definition at line 115 of file forum_view.inc.

Member Function Documentation

◆ drawView()

ForumDetailsView::drawView ( )

Definition at line 182 of file forum_view.inc.

183  {
184  echo "<div style='width: {$this->width}'>";
185 ?>
186  <form method="get" action="forum_search_by_author">
187  <input type="hidden" name="forum_id" value="<?echo $this->forum->forum_id?>"/>
188  <label for="author">Search by Author</label> <input type="text" name="author" style="width: 200px"> <input class='button' type='submit' value="Search"/>
189  </form>
190 <?
191  $this->subscriptionView->drawLink();
192  $this->table->drawView();
193  echo "</div>";
194  }
$helpTree style
Definition: tree.inc:46
$form action
Definition: edit.inc:67

◆ formatLastPost()

ForumDetailsView::formatLastPost (   $topic)

Definition at line 160 of file forum_view.inc.

161  {
162  $lastPost = $topic->LastPost();
163  if (!$lastPost) return "<em>No posts</em>";
164  $user = $lastPost->Author();
165 
166  $userProfile = ForumManager::formatUserProfile($user);
167 
168  $title = $lastPost->title ? $lastPost->title : "No Title";
169 
170  return "<a href='{$this->topicLink}?forum_id={$lastPost->forum_id}&topic_id={$lastPost->topic_id}'>{$title}</a><br/>".
171  "<span class='small'>by ".$userProfile." ({$lastPost->date_posted})</span>";
172  }
static formatUserProfile($u)
global $user
$topic
Definition: topic_form.inc:42

◆ formatTitle()

ForumDetailsView::formatTitle (   $topic)

Definition at line 147 of file forum_view.inc.

148  {
149  if (!array_key_exists($topic->topic_id, $this->messages)) return "";
150 
151  $message = $this->messages[$topic->topic_id];
152  $user = $message->Author();
153  $userProfile = ForumManager::formatUserProfile($user);
154 
155  $title = $message->title ? $message->title : "No Title";
156 
157  return "<a href='{$this->topicLink}?forum_id={$topic->forum_id}&topic_id={$topic->topic_id}'>{$title}</a><br/><span class='small'>(Created by ".$userProfile.")</span>";
158  }
$message
Definition: mail_to.inc:49

◆ ForumDetailsView()

ForumDetailsView::ForumDetailsView (   $forum,
  $topicLink 
)

Definition at line 125 of file forum_view.inc.

126  {
127  $this->forum = $forum;
128  $this->topicLink = $topicLink;
129 
130  $msgTable = new ForumMessage();
131  $this->topics = $this->forum->Topics("WHERE message_id not in (select message_id from {$msgTable->table} where deleted=true)");
132  $this->messages = indexedQuery(ForumMessage, "WHERE forum_id={$forum->forum_id} AND deleted=false AND parent_id=0", "topic_id");
133 
134  $this->table = new DataListView($this->topics, "topic_list");
135  $this->table->column("Title", array($this, formatTitle), true, "width: 40%")
136  ->column("Last Post", array($this, formatLastPost), true, "width: 40%")
137  ->column("Views", "{views}", true, "width: 10%; text-align: center")
138  ->column("Replies", "{countReplies()}", true, "width: 10%; text-align: center");
139  $this->table->emptyMessage = "No topics have been started in this discussion forum";
140  $this->table->filter = true;
141  $this->table->pageSize = Settings::getValue("forum", "forum_topics_per_page");
142 
143  $this->subscriptionView = new ForumSubscriptionHelper($this->forum);
144 
145  }
formatTitle($topic)
Definition: forum_view.inc:147
formatLastPost($topic)
Definition: forum_view.inc:160
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104

◆ writeScript()

ForumDetailsView::writeScript ( )

Definition at line 174 of file forum_view.inc.

175  {
176  $script = $this->table->writeScript();
177  $script .= $this->subscriptionView->writeScript();
178 
179  return $script;
180  }

Member Data Documentation

◆ $forum

ForumDetailsView::$forum

Definition at line 117 of file forum_view.inc.

◆ $messages

ForumDetailsView::$messages

Definition at line 119 of file forum_view.inc.

◆ $subscriptionView

ForumDetailsView::$subscriptionView

Definition at line 123 of file forum_view.inc.

◆ $table

ForumDetailsView::$table

Definition at line 120 of file forum_view.inc.

◆ $topicLink

ForumDetailsView::$topicLink

Definition at line 121 of file forum_view.inc.

◆ $topics

ForumDetailsView::$topics

Definition at line 118 of file forum_view.inc.

◆ $width

ForumDetailsView::$width

Definition at line 122 of file forum_view.inc.


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