2 defined('_JEXEC') or die;
4 Artx::load("Artx_Content_Item");
6 class ArtxContentSingleArticle extends ArtxContentItem
16 public function __construct($component, $componentParams, $article, $articleParams, $properties)
18 parent::__construct($component, $componentParams, $article, $articleParams);
19 $this->print = isset($properties['print']) ? $properties['print'] : '';
20 $this->pageHeading = $this->_componentParams->get('show_page_heading', 1)
21 ? $this->_componentParams->get('page_heading') : '';
22 $this->titleLink = $this->_articleParams->get('link_titles') && !empty($this->_article->readmore_link)
23 ? $this->_article->readmore_link : '';
24 $this->emailIconVisible = $this->emailIconVisible && !$this->print;
25 $this->editIconVisible = $this->editIconVisible && !$this->print;
26 $this->categoryLink = $this->_articleParams->get('link_category') && $this->_article->catslug
27 ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->catslug))
29 $this->category = $this->_articleParams->get('show_category') ? $this->_article->category_title : '';
30 $this->categoryLink = $this->_articleParams->get('link_category') && $this->_article->catslug
31 ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->catslug))
33 $this->parentCategory = $this->_articleParams->get('show_parent_category') && $this->_article->parent_slug != '1:root'
34 ? $this->_article->parent_title : '';
35 $this->parentCategoryLink = $this->_articleParams->get('link_parent_category') && $this->_article->parent_slug
36 ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->parent_slug))
38 $this->author = $this->_articleParams->get('show_author') && !empty($this->_article->author)
39 ? ($this->_article->created_by_alias ? $this->_article->created_by_alias : $this->_article->author)
41 if (strlen($this->author) && $this->_articleParams->get('link_author')) {
42 $needle = 'index.php?option=com_contact&view=contact&id=' . $this->_article->contactid;
43 $menu = JFactory::getApplication()->getMenu();
44 $item = $menu->getItems('link', $needle, true);
45 $this->authorLink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
47 $this->authorLink = '';
48 $this->toc = isset($this->_article->toc) ? $this->_article->toc : '';
49 $this->text = $this->_articleParams->get('access-view') ? $this->_article->text : '';
50 $user = JFactory::getUser();
51 $this->introVisible = !$this->_articleParams->get('access-view') && $params->get('show_noauth') && $user->get('guest');
52 $this->intro = $this->_article->introtext;
53 if (!$this->_articleParams->get('access-view') && $this->_articleParams->get('show_noauth') && $user->get('guest')
54 && $this->_articleParams->get('show_readmore') && $this->_article->fulltext != null)
56 $attribs = json_decode($this->_article->attribs);
57 if ($attribs->alternative_readmore == null)
58 $this->readmore = JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
59 elseif ($this->readmore = $this->_article->alternative_readmore) {
60 if ($this->_articleParams->get('show_readmore_title', 0) != 0)
61 $this->readmore .= JHtml::_('string.truncate', ($this->_article->title), $this->_articleParams->get('readmore_limit'));
62 } elseif ($this->_articleParams->get('show_readmore_title', 0) == 0)
63 $this->readmore = JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
65 $this->readmore = JText::_('COM_CONTENT_READ_MORE')
66 . JHtml::_('string.truncate', $this->_article->title,
67 $this->_articleParams->get('readmore_limit'));
68 $link = new JURI(JRoute::_('index.php?option=com_users&view=login'));
69 $this->readmoreLink = $link->__toString();
72 $this->readmoreLink = '';
74 $this->paginationPosition = (isset($this->_article->pagination) && $this->_article->pagination && isset($this->_article->paginationposition))
75 ? (($this->_article->paginationposition ? 'below' : 'above') . ' ' . ($this->_article->paginationrelative ? 'full article' : 'text'))
77 $this->showLinks = isset($this->_article->urls) && is_string($this->_article->urls) && !empty($this->_article->urls);
80 public function printIcon()
82 return JHTML::_($this->print ? 'icon.print_screen' : 'icon.print_popup', $this->_article, $this->_articleParams);
85 public function toc($toc)
87 return '<div class="art-article">' . $toc . '</div>';
90 public function intro($intro)
92 return '<div class="art-article">' . $intro . '</div>';
95 public function text($text)
97 return '<div class="art-article">' . $text . '</div>';
100 public function pagination() {
101 return $this->_article->pagination;