CMS  Version 3.9
DefaultBlogViewHandler Class Reference

DefaultBlogViewHandler provides a standard, no-frills display for blog entries. More...

+ Inheritance diagram for DefaultBlogViewHandler:
+ Collaboration diagram for DefaultBlogViewHandler:

Public Member Functions

 DefaultBlogViewHandler ()
 
 drawArticleList ($blog, $year=false, $month=false, $term_id=null)
 
 formatArticle ($article)
 
 drawArticle ($blog, $article_id)
 Draw the specific article in the blog. More...
 
- Public Member Functions inherited from IBlogViewHandler
 drawArticleList ($blog)
 Draw the list of articles for the specified blog. More...
 

Static Public Member Functions

static register ($view)
 

Detailed Description

DefaultBlogViewHandler provides a standard, no-frills display for blog entries.

Author
andy

Definition at line 70 of file blog_view.inc.

Member Function Documentation

◆ DefaultBlogViewHandler()

DefaultBlogViewHandler::DefaultBlogViewHandler ( )

Definition at line 72 of file blog_view.inc.

73  {
74  }

◆ drawArticle()

DefaultBlogViewHandler::drawArticle (   $blog,
  $article_id 
)

Draw the specific article in the blog.

Parameters
Blog$blogthe Blog object
integer$article_idthe ID of the Article

Implements IBlogViewHandler.

Definition at line 151 of file blog_view.inc.

152  {
153  global $page;
155  $page->page_title = $article->title;
156 
157  echo $article->message;
158  echo "<div class='blog_timestamp'>";
159  echo "By " . $article->author . ", posted on " .$article->formatPostDate();
160  echo "</div>";
161  if ($article->tags)
162  {
163  echo "<div class='blog_tags'>" . $article->tags . "</div>";
164  }
165  }
$article
$article_id
$page
Definition: help.inc:39
Defines the Article class.
Definition: article.inc:45

◆ drawArticleList()

DefaultBlogViewHandler::drawArticleList (   $blog,
  $year = false,
  $month = false,
  $term_id = null 
)

Definition at line 82 of file blog_view.inc.

83  {
84  global $page;
85  global $script;
86 
87  $this->blog = $blog;
88 
89  $page->page_title = $blog->title;
90 
91  if ($year)
92  {
93  $constraint = " AND YEAR(publish_date)=$year";
94 
95  if ($month)
96  {
97  $constraint .= " AND MONTH(publish_date) = $month";
98  }
99 
100  }
101 
102  if ($term_id)
103  {
104  $constraint .= " AND article_id IN (SELECT id FROM taxonomy_term_association where class='Article' AND term_id=$term_id)";
105  }
106 
107  $articles = $blog->Articles("WHERE published=1 AND publish_date <= curdate()" . $constraint);
108 
109  echo "<div id='blog_description' class='Standard'>{$blog->description}</div>";
110 
112 
113  $list = new ServerPagedList($articles, "article_list", array($this, formatArticle));
114  $list->CSSclass = "Standard";
115  $list->styles = "clear: both";
116 
117  if ($blog->articles_per_page)
118  {
119  $list->pageSize = $blog->articles_per_page;
120  }
121  else
122  {
123  $list->pageSize = 5;
124  }
125 
126  $script .= $list->writeScript();
127  $list->drawList();
128  }
$constraint
$blog
static inlineEditingControls($blog)
$list
Definition: list_images.inc:41
$term_id
Definition: blog.inc:40
$month
Definition: blog.inc:39
$year
Definition: blog.inc:38
$articles
Definition: rss.inc:62

◆ formatArticle()

DefaultBlogViewHandler::formatArticle (   $article)

Definition at line 130 of file blog_view.inc.

131  {
132  $out = "<div class='article_summary'>";
133 
134  if ($article->image_id)
135  {
136  $image = $article->Image();
137  $out .= "<img src='/action/image/iconize?image_id={$article->image_id}&size=120' alt='{$image->ALT_tag}' align='left'/>";
138  }
139 
140  $out .= "<h4><a href='{$this->blog->identifier}?article_id={$article->article_id}'>";
141  $out .= "{$article->title}</a></h4>";
142 
143  if ($article->teaser) $out .= $article->teaser;
144  $out .= "<div class='blog_timestamp'>";
145  $out .= "By " . $article->author . ", posted on " . $article->formatPostDate();
146  $out .= "</div>";
147  $out .= "</div>";
148  return $out;
149  }
$out
Definition: page.inc:66
$image
Definition: image_form.inc:46

◆ register()

static DefaultBlogViewHandler::register (   $view)
static

Definition at line 76 of file blog_view.inc.

77  {
78  $view->registerHandler("Standard", new DefaultBlogViewHandler());
79  return $view;
80  }
$view
Definition: help.inc:42

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