CMS  Version 3.9
NewsBlogViewHandler Class Reference

NewsBlogViewHandler provides a simple blog view tailored displaying news articles. More...

+ Inheritance diagram for NewsBlogViewHandler:
+ Collaboration diagram for NewsBlogViewHandler:

Public Member Functions

 NewsBlogViewHandler ()
 
 drawArticleList ($blog, $year=false, $month=false, $term=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

NewsBlogViewHandler provides a simple blog view tailored displaying news articles.

Author
andy

Definition at line 176 of file blog_view.inc.

Member Function Documentation

◆ drawArticle()

NewsBlogViewHandler::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 247 of file blog_view.inc.

248  {
249  global $page;
251  $page->page_title = $article->title;
252 
253  echo $article->message;
254 
255 ?><br/><a class="button" href="/<?echo $blog->identifier?>">&laquo; Back to <?echo $blog->title?></a><?
256  }
$article
$article_id
$blog
$page
Definition: help.inc:39
Defines the Article class.
Definition: article.inc:45
$forumRequest to

◆ drawArticleList()

NewsBlogViewHandler::drawArticleList (   $blog,
  $year = false,
  $month = false,
  $term = null 
)

Definition at line 188 of file blog_view.inc.

189  {
190  global $page;
191  global $script;
192 
193  $this->blog = $blog;
194 
195  $page->page_title = $blog->title;
196 
197  if ($year)
198  {
199  $constraint = " AND YEAR(publish_date) = $year";
200 
201  if ($month)
202  {
203  $constraint .= " AND MONTH(publish_date) = $month";
204  }
205 
206  }
207 
208  if ($term_id)
209  {
210  $constraint .= " AND article_id IN (SELECT id FROM taxonomy_term_association where class='Article' AND term_id=$term_id)";
211  }
212 
213  $articles = $blog->Articles("WHERE published=1 AND publish_date <= curdate()" . $constraint);
214 
215  echo "<div id='blog_description' class='Standard'>{$blog->description}</div>";
216 
218 
219  $list = new ServerPagedList($articles, "article_list", array($this, formatArticle));
220  $list->CSSclass = "Standard";
221  $list->styles = "clear: both";
222  $list->pageSize = $blog->articles_per_page;
223 
224  $script .= $list->writeScript();
225  $list->drawList();
226  }
$constraint
static inlineEditingControls($blog)
formatArticle($article)
Definition: blog_view.inc:228
$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()

NewsBlogViewHandler::formatArticle (   $article)

Definition at line 228 of file blog_view.inc.

229  {
230 
231  $out = "<div class='article_summary'>";
232 
233  if ($article->image_id)
234  {
235  $image = $article->Image();
236  $out .= "<img src='/action/image/iconize?image_id={$article->image_id}&size=120' alt='{$image->ALT_tag}' align='left'/>";
237  }
238 
239  $out .= "<h4><a href='{$this->blog->identifier}?article_id={$article->article_id}'>";
240  $out .= "{$article->title}</a></h4>";
241  $out .= $article->format("<strong>{formatPostDate()}</strong>");
242  if ($article->teaser) $out .= " - ".$article->teaser;
243  $out .= "<br/><a href='{$this->blog->identifier}?article_id={$article->article_id}'>Read More &raquo;</a></div>";
244  return $out;
245  }
$out
Definition: page.inc:66
$image
Definition: image_form.inc:46

◆ NewsBlogViewHandler()

NewsBlogViewHandler::NewsBlogViewHandler ( )

Definition at line 178 of file blog_view.inc.

179  {
180  }

◆ register()

static NewsBlogViewHandler::register (   $view)
static

Definition at line 182 of file blog_view.inc.

183  {
184  $view->registerHandler("News", new NewsBlogViewHandler());
185  return $view;
186  }
$view
Definition: help.inc:42

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