/components/com_content/views/featured/tmpl/default_item.php

https://github.com/fastslack/joomla-cms · PHP · 106 lines · 78 code · 19 blank · 9 comment · 55 complexity · 12b0cdf8394c439cd7b08818780bb224 MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Site
  4. * @subpackage com_content
  5. *
  6. * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  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. $info = $this->item->params->get('info_block_position', 0);
  15. // Check if associations are implemented. If they are, define the parameter.
  16. $assocParam = (JLanguageAssociations::isEnabled() && $params->get('show_associations'));
  17. ?>
  18. <?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate())
  19. || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate())) : ?>
  20. <div class="system-unpublished">
  21. <?php endif; ?>
  22. <?php if ($params->get('show_title')) : ?>
  23. <h2 class="item-title" itemprop="headline">
  24. <?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
  25. <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)); ?>" itemprop="url">
  26. <?php echo $this->escape($this->item->title); ?>
  27. </a>
  28. <?php else : ?>
  29. <?php echo $this->escape($this->item->title); ?>
  30. <?php endif; ?>
  31. </h2>
  32. <?php endif; ?>
  33. <?php if ($this->item->state == 0) : ?>
  34. <span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
  35. <?php endif; ?>
  36. <?php if (strtotime($this->item->publish_up) > strtotime(JFactory::getDate())) : ?>
  37. <span class="label label-warning"><?php echo JText::_('JNOTPUBLISHEDYET'); ?></span>
  38. <?php endif; ?>
  39. <?php if ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate()) : ?>
  40. <span class="label label-warning"><?php echo JText::_('JEXPIRED'); ?></span>
  41. <?php endif; ?>
  42. <?php if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
  43. <?php echo JLayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $this->item, 'print' => false)); ?>
  44. <?php endif; ?>
  45. <?php // Content is generated by content plugin event "onContentAfterTitle" ?>
  46. <?php echo $this->item->event->afterDisplayTitle; ?>
  47. <?php // Todo Not that elegant would be nice to group the params ?>
  48. <?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
  49. || $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author') || $assocParam); ?>
  50. <?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
  51. <?php // Todo: for Joomla4 joomla.content.info_block.block can be changed to joomla.content.info_block ?>
  52. <?php echo JLayoutHelper::render('joomla.content.info_block.block', array('item' => $this->item, 'params' => $params, 'position' => 'above')); ?>
  53. <?php if ($info == 0 && $params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  54. <?php echo JLayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  55. <?php endif; ?>
  56. <?php endif; ?>
  57. <?php if (isset($images->image_intro) && !empty($images->image_intro)) : ?>
  58. <?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
  59. <?php endif; ?>
  60. <?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
  61. <?php echo $this->item->event->beforeDisplayContent; ?>
  62. <?php echo $this->item->introtext; ?>
  63. <?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
  64. <?php // Todo: for Joomla4 joomla.content.info_block.block can be changed to joomla.content.info_block ?>
  65. <?php echo JLayoutHelper::render('joomla.content.info_block.block', array('item' => $this->item, 'params' => $params, 'position' => 'below')); ?>
  66. <?php if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  67. <?php echo JLayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  68. <?php endif; ?>
  69. <?php endif; ?>
  70. <?php if ($params->get('show_readmore') && $this->item->readmore) :
  71. if ($params->get('access-view')) :
  72. $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
  73. else :
  74. $menu = JFactory::getApplication()->getMenu();
  75. $active = $menu->getActive();
  76. $itemId = $active->id;
  77. $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
  78. $link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));
  79. endif; ?>
  80. <?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
  81. <?php endif; ?>
  82. <?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate())
  83. || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != $this->db->getNullDate() )) : ?>
  84. </div>
  85. <?php endif; ?>
  86. <?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
  87. <?php echo $this->item->event->afterDisplayContent; ?>