OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / templates / art41_sample2 / library / Artx / Content.php
1 <?php
2 defined('_JEXEC') or die;
3
4 /**
5  * Contains the article factory method and content component rendering helpers.
6  */
7 Artx::load("Artx_Content_ArchivedArticle");
8 Artx::load("Artx_Content_SingleArticle");
9 Artx::load("Artx_Content_CategoryArticle");
10 Artx::load("Artx_Content_FeaturedArticle");
11
12 class ArtxContent
13 {
14     protected $_component;
15     protected $_componentParams;
16
17     public $pageClassSfx;
18
19     public $pageHeading;
20
21     public function __construct($component, $params)
22     {
23         $this->_component = $component;
24         $this->_componentParams = $params;
25
26         $this->pageClassSfx = $component->pageclass_sfx;
27         $this->pageHeading = $this->_componentParams->get('show_page_heading', 1)
28                                ? $this->_componentParams->get('page_heading') : '';
29     }
30
31     public function pageHeading($title = null)
32     {
33         return artxPost(array('header-text' => $this->_component->escape(null == $title ? $this->pageHeading : $title)));
34     }
35
36     public function article($view, $article, $params, $properties = array())
37     {
38         switch ($view) {
39             case 'archive':
40                 return new ArtxContentArchivedArticle($this->_component, $this->_componentParams,
41                                                       $article, $params);
42             case 'article':
43                 return new ArtxContentSingleArticle($this->_component, $this->_componentParams,
44                                                     $article, $params, $properties);
45             case 'category':
46                 return new ArtxContentCategoryArticle($this->_component, $this->_componentParams,
47                                                       $article, $params);
48             case 'featured':
49                 return new ArtxContentFeaturedArticle($this->_component, $this->_componentParams,
50                                                       $article, $params);
51         }
52     }
53
54     public function beginPageContainer($class)
55     {
56         return '<div class="' . $class . $this->pageClassSfx .'">';
57     }
58
59     public function endPageContainer()
60     {
61         return '</div>';
62     }
63 }