CMS  Version 3.9
article_view.inc
Go to the documentation of this file.
1 <?php
9 {
10  var $table;
11 
12  function ArticleListView()
13  {
14 
15  $articles = query(Article, "ORDER BY last_modified DESC");
16 
17  $this->table = $this->buildTable($articles);
18  }
19 
21  {
22  $table = new DataListView($articles, "articles");
23  $table->column("Title", array($this, formatTitle), true)
24  ->column("Article Type", "{article_type}", true)
25  ->column("Author", "{getAuthorName()}", true)
26  ->column("Date Created", "{created_date}", true)
27  ->column("Published", array($this, showPublished), false, "text-align: center");
28 
29  $table->sortable = true;
30  $table->filter = true;
31  $table->excelFile = "articles.xls";
32  $table->pageSize = 20;
33  $table->emptyMessage = "No articles have been created yet.";
34 
35  return $table;
36  }
37 
38  function writeScript()
39  {
40  return $this->table->writeScript();
41  }
42 
43  function drawView()
44  {
45  $this->table->drawView();
46  }
47 
48 
50  {
51  $img = $article->published ? "on.png" : "off.png";
52  $alt = $article->published ? "Published" : "Unpublished";
53 
54  return "<img src='/fakoli/images/$img' alt='$alt' onclick='toggleArticlePublished(this, {$article->article_id})' style='display: inline-block; vertical-align: middle; border: none; cursor: pointer'/>";
55  }
56 
57  function formatTitle($item)
58  {
59  return "<a title=\"{$item->title}\" href=\"/article_form?article_id={$item->article_id}\">". ellipsis($item->title, 80) ."</a>";
60  }
61 }
62 
64 {
66  {
67  parent::ArticleListView();
68  }
69 
70  function formatTitle($item)
71  {
72  return "<a title=\"{$item->title}\" href=\"/admin/article_form?article_id={$item->article_id}\">". ellipsis($item->title, 80) ."</a>";
73  }
74 }?>
$article
formatTitle($item)
AdminArticleListView()
Defines the Article class.
Definition: article.inc:45
Definition: article_view.inc:9
buildTable($articles)
drawView()
$table
writeScript()
formatTitle($item)
showPublished($article)
ArticleListView()
$articles
Definition: rss.inc:62