PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_content/views/category/tmpl/blog_item.php

https://bitbucket.org/asosso/joomla25
PHP | 175 lines | 153 code | 14 blank | 8 comment | 46 complexity | 87b673307d27dec90eb9e76636d8926d MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. /**
  3. * @package Joomla.Site
  4. * @subpackage com_content
  5. * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  6. * @license GNU General Public License version 2 or later; see LICENSE.txt
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. // Create a shortcut for params.
  11. $params = &$this->item->params;
  12. $images = json_decode($this->item->images);
  13. $canEdit = $this->item->params->get('access-edit');
  14. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
  15. JHtml::_('behavior.tooltip');
  16. JHtml::_('behavior.framework');
  17. ?>
  18. <?php if ($this->item->state == 0) : ?>
  19. <div class="system-unpublished">
  20. <?php endif; ?>
  21. <?php if ($params->get('show_title')) : ?>
  22. <h2>
  23. <?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
  24. <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
  25. <?php echo $this->escape($this->item->title); ?></a>
  26. <?php else : ?>
  27. <?php echo $this->escape($this->item->title); ?>
  28. <?php endif; ?>
  29. </h2>
  30. <?php endif; ?>
  31. <?php if ($params->get('show_print_icon') || $params->get('show_email_icon') || $canEdit) : ?>
  32. <ul class="actions">
  33. <?php if ($params->get('show_print_icon')) : ?>
  34. <li class="print-icon">
  35. <?php echo JHtml::_('icon.print_popup', $this->item, $params); ?>
  36. </li>
  37. <?php endif; ?>
  38. <?php if ($params->get('show_email_icon')) : ?>
  39. <li class="email-icon">
  40. <?php echo JHtml::_('icon.email', $this->item, $params); ?>
  41. </li>
  42. <?php endif; ?>
  43. <?php if ($canEdit) : ?>
  44. <li class="edit-icon">
  45. <?php echo JHtml::_('icon.edit', $this->item, $params); ?>
  46. </li>
  47. <?php endif; ?>
  48. </ul>
  49. <?php endif; ?>
  50. <?php if (!$params->get('show_intro')) : ?>
  51. <?php echo $this->item->event->afterDisplayTitle; ?>
  52. <?php endif; ?>
  53. <?php echo $this->item->event->beforeDisplayContent; ?>
  54. <?php // to do not that elegant would be nice to group the params ?>
  55. <?php if (($params->get('show_author')) or ($params->get('show_category')) or ($params->get('show_create_date')) or ($params->get('show_modify_date')) or ($params->get('show_publish_date')) or ($params->get('show_parent_category')) or ($params->get('show_hits'))) : ?>
  56. <dl class="article-info">
  57. <dt class="article-info-term"><?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?></dt>
  58. <?php endif; ?>
  59. <?php if ($params->get('show_parent_category') && $this->item->parent_id != 1) : ?>
  60. <dd class="parent-category-name">
  61. <?php $title = $this->escape($this->item->parent_title);
  62. $url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->parent_id)) . '">' . $title . '</a>'; ?>
  63. <?php if ($params->get('link_parent_category')) : ?>
  64. <?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
  65. <?php else : ?>
  66. <?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
  67. <?php endif; ?>
  68. </dd>
  69. <?php endif; ?>
  70. <?php if ($params->get('show_category')) : ?>
  71. <dd class="category-name">
  72. <?php $title = $this->escape($this->item->category_title);
  73. $url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid)) . '">' . $title . '</a>'; ?>
  74. <?php if ($params->get('link_category')) : ?>
  75. <?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
  76. <?php else : ?>
  77. <?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
  78. <?php endif; ?>
  79. </dd>
  80. <?php endif; ?>
  81. <?php if ($params->get('show_create_date')) : ?>
  82. <dd class="create">
  83. <?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC2'))); ?>
  84. </dd>
  85. <?php endif; ?>
  86. <?php if ($params->get('show_modify_date')) : ?>
  87. <dd class="modified">
  88. <?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC2'))); ?>
  89. </dd>
  90. <?php endif; ?>
  91. <?php if ($params->get('show_publish_date')) : ?>
  92. <dd class="published">
  93. <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC2'))); ?>
  94. </dd>
  95. <?php endif; ?>
  96. <?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
  97. <dd class="createdby">
  98. <?php $author = $this->item->author; ?>
  99. <?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>
  100. <?php if (!empty($this->item->contactid ) && $params->get('link_author') == true):?>
  101. <?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY' ,
  102. JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)); ?>
  103. <?php else :?>
  104. <?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
  105. <?php endif; ?>
  106. </dd>
  107. <?php endif; ?>
  108. <?php if ($params->get('show_hits')) : ?>
  109. <dd class="hits">
  110. <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
  111. </dd>
  112. <?php endif; ?>
  113. <?php if (($params->get('show_author')) or ($params->get('show_category')) or ($params->get('show_create_date')) or ($params->get('show_modify_date')) or ($params->get('show_publish_date')) or ($params->get('show_parent_category')) or ($params->get('show_hits'))) :?>
  114. </dl>
  115. <?php endif; ?>
  116. <?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
  117. <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
  118. <div class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>">
  119. <img
  120. <?php if ($images->image_intro_caption):
  121. echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
  122. endif; ?>
  123. src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
  124. </div>
  125. <?php endif; ?>
  126. <?php echo $this->item->introtext; ?>
  127. <?php if ($params->get('show_readmore') && $this->item->readmore) :
  128. if ($params->get('access-view')) :
  129. $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
  130. else :
  131. $menu = JFactory::getApplication()->getMenu();
  132. $active = $menu->getActive();
  133. $itemId = $active->id;
  134. $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
  135. $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
  136. $link = new JURI($link1);
  137. $link->setVar('return', base64_encode(urlencode($returnURL)));
  138. endif;
  139. ?>
  140. <p class="readmore">
  141. <a href="<?php echo $link; ?>">
  142. <?php if (!$params->get('access-view')) :
  143. echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
  144. elseif ($readmore = $this->item->alternative_readmore) :
  145. echo $readmore;
  146. if ($params->get('show_readmore_title', 0) != 0) :
  147. echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
  148. endif;
  149. elseif ($params->get('show_readmore_title', 0) == 0) :
  150. echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
  151. else :
  152. echo JText::_('COM_CONTENT_READ_MORE');
  153. echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
  154. endif; ?></a>
  155. </p>
  156. <?php endif; ?>
  157. <?php if ($this->item->state == 0) : ?>
  158. </div>
  159. <?php endif; ?>
  160. <div class="item-separator"></div>
  161. <?php echo $this->item->event->afterDisplayContent; ?>