OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / templates / art41_sample1 / library / Artx / Content / ListItem.php
1 <?php
2 defined('_JEXEC') or die;
3
4 Artx::load("Artx_Content_Item");
5
6 abstract class ArtxContentListItem extends ArtxContentItem
7 {
8     public $intro;
9
10     protected function __construct($component, $componentParams, $article, $articleParams)
11     {
12         parent::__construct($component, $componentParams, $article, $articleParams);
13         $this->isPublished = 0 != $this->_article->state;
14         $this->titleLink = $this->_articleParams->get('link_titles') && $this->_articleParams->get('access-view')
15                              ? JRoute::_(ContentHelperRoute::getArticleRoute($this->_article->slug, $this->_article->catid))
16                              : '';
17         $this->intro = $this->_article->introtext;
18         if ($this->_articleParams->get('show_readmore') && $this->_article->readmore) {
19             if (!$this->_articleParams->get('access-view'))
20                 $this->readmore = JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
21             elseif ($this->readmore = $this->_article->alternative_readmore) {
22                 if ($this->_articleParams->get('show_readmore_title', 0) != 0)
23                     $this->readmore .= JHtml::_('string.truncate', ($this->_article->title), $this->_articleParams->get('readmore_limit'));
24             } elseif ($this->_articleParams->get('show_readmore_title', 0) == 0)
25                 $this->readmore = JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
26             else
27                 $this->readmore = JText::_('COM_CONTENT_READ_MORE')
28                                     . JHtml::_('string.truncate', $this->_article->title,
29                                                $this->_articleParams->get('readmore_limit'));
30             if ($this->_articleParams->get('access-view')){
31                 $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->_article->slug, $this->_article->catid));
32                 $this->readmoreLink = $link;
33             } else {
34                 $menu = JFactory::getApplication()->getMenu();
35                 $active = $menu->getActive();
36                 $itemId = $active->id;
37                 $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
38                 $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->_article->slug, $this->_article->catid));
39                 $link = new JURI($link1);
40                 $link->setVar('return', base64_encode($returnURL));
41                 $this->readmoreLink = $link->__toString();
42             }
43         } else {
44             $this->readmore = '';
45             $this->readmoreLink = '';
46         }
47     }
48
49     public function intro($intro)
50     {
51         return "<div class=\"art-article\">" . $intro . "</div>";
52     }
53 }