You've already forked joomla_test
first commit
This commit is contained in:
1
components/com_newsfeeds/views/categories/index.html
Normal file
1
components/com_newsfeeds/views/categories/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
17
components/com_newsfeeds/views/categories/tmpl/default.php
Normal file
17
components/com_newsfeeds/views/categories/tmpl/default.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
||||
JHtml::_('behavior.caption');
|
||||
echo JLayoutHelper::render('joomla.content.categories_default', $this);
|
||||
echo $this->loadTemplate('items');
|
||||
?>
|
||||
</div>
|
289
components/com_newsfeeds/views/categories/tmpl/default.xml
Normal file
289
components/com_newsfeeds/views/categories/tmpl/default.xml
Normal file
@ -0,0 +1,289 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_TITLE" option="COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_OPTION">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_CATEGORIES"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
>
|
||||
<field name="id" type="category"
|
||||
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
|
||||
extension="com_newsfeeds"
|
||||
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
|
||||
show_root="true"
|
||||
required="true"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="JGLOBAL_CATEGORIES_OPTIONS">
|
||||
<field name="show_base_description" type="list"
|
||||
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
|
||||
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="categories_description" type="textarea"
|
||||
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
|
||||
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
|
||||
cols="25"
|
||||
rows="5"
|
||||
/>
|
||||
<field name="maxLevelcat" type="list"
|
||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="-1">JALL</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
</field>
|
||||
|
||||
<field name="show_empty_categories_cat" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_subcat_desc_cat" type="list"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_cat_items_cat" type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS">
|
||||
<field name="spacer2" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field name="show_category_title" type="list"
|
||||
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description_image" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="maxLevel" type="list"
|
||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="-1">JALL</option>
|
||||
<option value="0">JNONE</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
</field>
|
||||
|
||||
<field name="show_empty_categories" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_subcat_desc" type="list"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field id="show_cat_items"
|
||||
name="show_cat_items"
|
||||
type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
|
||||
<field name="spacer1" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter_field"
|
||||
type="list"
|
||||
default=""
|
||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination_limit"
|
||||
type="list"
|
||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="show_headings"
|
||||
name="show_headings"
|
||||
type="list"
|
||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||
description="JGLOBAL_SHOW_HEADINGS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="show_articles"
|
||||
name="show_articles"
|
||||
type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="show_link"
|
||||
name="show_link"
|
||||
type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_LABEL"
|
||||
description="JGLOBAL_PAGINATION_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">JGLOBAL_AUTO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_pagination_results"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||
description="JGLOBAL_PAGINATION_RESULTS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
<fieldset name="newsfeed" label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
|
||||
|
||||
<field name="show_feed_image" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_feed_description" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_item_description" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="feed_character_count" type="text"
|
||||
default="0"
|
||||
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
|
||||
size="6"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
</fields>
|
||||
</metadata>
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$class = ' class="first"';
|
||||
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
|
||||
?>
|
||||
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
|
||||
<?php
|
||||
if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
|
||||
if (!isset($this->items[$this->parent->id][$id + 1]))
|
||||
{
|
||||
$class = ' class="last"';
|
||||
}
|
||||
?>
|
||||
<div <?php echo $class; ?> >
|
||||
<?php $class = ''; ?>
|
||||
<h3 class="page-header item-title">
|
||||
<a href="<?php echo JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($item->id));?>">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<?php if ($this->params->get('show_cat_items_cat') == 1) :?>
|
||||
<span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_NEWSFEEDS_NUM_ITEMS'); ?>">
|
||||
<?php echo $item->numitems; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if (count($item->getChildren()) > 0) : ?>
|
||||
<a href="#category-<?php echo $item->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
|
||||
<?php endif;?>
|
||||
</h3>
|
||||
<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
|
||||
<?php if ($item->description) : ?>
|
||||
<div class="category-desc">
|
||||
<?php echo JHtml::_('content.prepare', $item->description, '', 'com_newsfeeds.categories'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($item->getChildren()) > 0) :?>
|
||||
<div class="collapse fade" id="category-<?php echo $item->id;?>">
|
||||
<?php
|
||||
$this->items[$item->id] = $item->getChildren();
|
||||
$this->parent = $item;
|
||||
$this->maxLevelcat--;
|
||||
echo $this->loadTemplate('items');
|
||||
$this->parent = $item->getParent();
|
||||
$this->maxLevelcat++;
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
122
components/com_newsfeeds/views/categories/view.html.php
Normal file
122
components/com_newsfeeds/views/categories/view.html.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Content categories view.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
* @since 1.5
|
||||
*/
|
||||
class NewsfeedsViewCategories extends JViewLegacy
|
||||
{
|
||||
protected $state = null;
|
||||
|
||||
protected $item = null;
|
||||
|
||||
protected $items = null;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @return mixed False on error, null otherwise.
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
$parent = $this->get('Parent');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseWarning(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($items === false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
if ($parent == false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
$params = &$state->params;
|
||||
|
||||
$items = array($parent->id => $items);
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$this->maxLevelcat = $params->get('maxLevelcat', -1);
|
||||
$this->params = &$params;
|
||||
$this->parent = &$parent;
|
||||
$this->items = &$items;
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_NEWSFEEDS_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
$title = $this->params->get('page_title', '');
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_newsfeeds/views/category/index.html
Normal file
1
components/com_newsfeeds/views/category/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
8
components/com_newsfeeds/views/category/metadata.xml
Normal file
8
components/com_newsfeeds/views/category/metadata.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="COM_NEWSFEEDS_CATEGORY_GROUP_LABEL">
|
||||
<message>
|
||||
<![CDATA[COM_NEWSFEEDS_CATEGORY_GROUP_DESC]]>
|
||||
</message>
|
||||
</view>
|
||||
</metadata>
|
54
components/com_newsfeeds/views/category/tmpl/default.php
Normal file
54
components/com_newsfeeds/views/category/tmpl/default.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');
|
||||
|
||||
JHtml::_('behavior.caption');
|
||||
|
||||
$pageClass = $this->params->get('pageclass_sfx');
|
||||
?>
|
||||
<div class="newsfeed-category<?php echo $this->pageclass_sfx;?>">
|
||||
<?php if ($this->params->get('show_page_heading')) : ?>
|
||||
<h1>
|
||||
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_category_title', 1)) : ?>
|
||||
<h2>
|
||||
<?php echo JHtml::_('content.prepare', $this->category->title, '', 'com_newsfeeds.category'); ?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_tags', 1) && !empty($this->category->tags->itemTags)) : ?>
|
||||
<?php $this->category->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
|
||||
<?php echo $this->category->tagLayout->render($this->category->tags->itemTags); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_description', 1) || $this->params->def('show_description_image', 1)) : ?>
|
||||
<div class="category-desc">
|
||||
<?php if ($this->params->get('show_description_image') && $this->category->getParams()->get('image')) : ?>
|
||||
<img src="<?php echo $this->category->getParams()->get('image'); ?>"/>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_description') && $this->category->description) : ?>
|
||||
<?php echo JHtml::_('content.prepare', $this->category->description, '', 'com_newsfeeds.category'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->loadTemplate('items'); ?>
|
||||
|
||||
<?php if (!empty($this->children[$this->category->id])&& $this->maxLevel != 0) : ?>
|
||||
<div class="cat-children">
|
||||
<h3><?php echo JText::_('JGLOBAL_SUBCATEGORIES'); ?></h3>
|
||||
<?php echo $this->loadTemplate('children'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
241
components/com_newsfeeds/views/category/tmpl/default.xml
Normal file
241
components/com_newsfeeds/views/category/tmpl/default.xml
Normal file
@ -0,0 +1,241 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_TITLE" option="COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_OPTION">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_CATEGORY"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
addfieldpath="/administrator/components/com_newsfeeds/models/fields"
|
||||
>
|
||||
|
||||
<field name="id" type="category"
|
||||
default="0"
|
||||
description="COM_NEWSFEEDS_FIELD_SELECT_CATEGORY_DESC"
|
||||
extension="com_newsfeeds"
|
||||
label="JCATEGORY"
|
||||
required="true"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="JGLOBAL_CATEGORY_OPTIONS">
|
||||
<field name="spacer1" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field name="show_category_title" type="list"
|
||||
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description_image" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="maxLevel" type="list"
|
||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="-1">JALL</option>
|
||||
<option value="0">JNONE</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
</field>
|
||||
|
||||
<field name="show_empty_categories" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_subcat_desc" type="list"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field id="show_cat_items"
|
||||
name="show_cat_items"
|
||||
type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
|
||||
<field name="spacer2" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
<field
|
||||
name="filter_field"
|
||||
type="list"
|
||||
default=""
|
||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination_limit"
|
||||
type="list"
|
||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="show_headings"
|
||||
name="show_headings"
|
||||
type="list"
|
||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||
description="JGLOBAL_SHOW_HEADINGS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="show_articles"
|
||||
name="show_articles"
|
||||
type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="show_link"
|
||||
name="show_link"
|
||||
type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_LABEL"
|
||||
description="JGLOBAL_PAGINATION_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">JGLOBAL_AUTO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_pagination_results"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||
description="JGLOBAL_PAGINATION_RESULTS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="newsfeed" label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
|
||||
|
||||
<field name="show_feed_image" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_feed_description" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_item_description" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="feed_character_count" type="text"
|
||||
default="0"
|
||||
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
|
||||
size="6"
|
||||
/>
|
||||
|
||||
<field name="feed_display_order" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="des">JGLOBAL_MOST_RECENT_FIRST</option>
|
||||
<option value="asc">JGLOBAL_OLDEST_FIRST</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
</fields>
|
||||
</metadata>
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$class = ' class="first"';
|
||||
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
|
||||
?>
|
||||
<ul>
|
||||
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
|
||||
<?php
|
||||
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) :
|
||||
if (!isset($this->children[$this->category->id][$id + 1]))
|
||||
{
|
||||
$class = ' class="last"';
|
||||
}
|
||||
?>
|
||||
<li<?php echo $class; ?>>
|
||||
<?php $class = ''; ?>
|
||||
<span class="item-title"><a href="<?php echo JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($child->id));?>">
|
||||
<?php echo $this->escape($child->title); ?></a>
|
||||
</span>
|
||||
|
||||
<?php if ($this->params->get('show_subcat_desc') == 1) :?>
|
||||
<?php if ($child->description) : ?>
|
||||
<div class="category-desc">
|
||||
<?php echo JHtml::_('content.prepare', $child->description, '', 'com_newsfeeds.category'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_cat_items') == 1) :?>
|
||||
<dl class="newsfeed-count"><dt>
|
||||
<?php echo JText::_('COM_NEWSFEEDS_CAT_NUM'); ?></dt>
|
||||
<dd><?php echo $child->numitems; ?></dd>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($child->getChildren()) > 0) :
|
||||
$this->children[$child->id] = $child->getChildren();
|
||||
$this->category = $child;
|
||||
$this->maxLevel--;
|
||||
echo $this->loadTemplate('children');
|
||||
$this->category = $child->getParent();
|
||||
$this->maxLevel++;
|
||||
endif; ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif;
|
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('behavior.framework');
|
||||
|
||||
$n = count($this->items);
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<p> <?php echo JText::_('COM_NEWSFEEDS_NO_ARTICLES'); ?></p>
|
||||
<?php else : ?>
|
||||
|
||||
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if ($this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) :?>
|
||||
<fieldset class="filters btn-toolbar">
|
||||
<?php if ($this->params->get('filter_field') != 'hide') :?>
|
||||
<div class="btn-group">
|
||||
<label class="filter-search-lbl element-invisible" for="filter-search"><span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span><?php echo JText::_('COM_NEWSFEEDS_FILTER_LABEL').' '; ?></label>
|
||||
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="limit" class="element-invisible">
|
||||
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
|
||||
</label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
<ul class="category list-striped list-condensed">
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<?php if ($this->items[$i]->published == 0) : ?>
|
||||
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
|
||||
<?php else: ?>
|
||||
<li class="cat-list-row<?php echo $i % 2; ?>" >
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_articles')) : ?>
|
||||
<span class="list-hits badge badge-info pull-right">
|
||||
<?php echo JText::sprintf('COM_NEWSFEEDS_NUM_ARTICLES_COUNT', $item->numarticles); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<span class="list pull-left">
|
||||
<div class="list-title">
|
||||
<a href="<?php echo JRoute::_(NewsFeedsHelperRoute::getNewsfeedRoute($item->slug, $item->catid)); ?>">
|
||||
<?php echo $item->name; ?></a>
|
||||
</div>
|
||||
</span>
|
||||
<?php if ($this->items[$i]->published == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<?php if ($this->params->get('show_link')) : ?>
|
||||
<?php $link = JStringPunycode::urlToUTF8($item->link); ?>
|
||||
<span class="list pull-left">
|
||||
<a href="<?php echo $item->link; ?>"><?php echo $link; ?></a>
|
||||
</span>
|
||||
<br/>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php // Add pagination links ?>
|
||||
<?php if (!empty($this->items)) : ?>
|
||||
<?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
|
||||
<div class="pagination">
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
<p class="counter pull-right">
|
||||
<?php echo $this->pagination->getPagesCounter(); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php endif; ?>
|
1
components/com_newsfeeds/views/category/tmpl/index.html
Normal file
1
components/com_newsfeeds/views/category/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
225
components/com_newsfeeds/views/category/view.html.php
Normal file
225
components/com_newsfeeds/views/category/view.html.php
Normal file
@ -0,0 +1,225 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Newsfeeds component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
* @since 1.0
|
||||
*/
|
||||
class NewsfeedsViewCategory extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $items;
|
||||
|
||||
protected $category;
|
||||
|
||||
protected $categories;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$params = $app->getParams();
|
||||
|
||||
// Get some data from the models
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
$category = $this->get('Category');
|
||||
$children = $this->get('Children');
|
||||
$parent = $this->get('Parent');
|
||||
$pagination = $this->get('Pagination');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($category == false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
if ($parent == false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Check whether category access level allows access.
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
if (!in_array($category->access, $groups))
|
||||
{
|
||||
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
// Prepare the data.
|
||||
// Compute the newsfeed slug.
|
||||
for ($i = 0, $n = count($items); $i < $n; $i++)
|
||||
{
|
||||
$item = &$items[$i];
|
||||
$item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id;
|
||||
$temp = new JRegistry;
|
||||
$temp->loadString($item->params);
|
||||
$item->params = clone($params);
|
||||
$item->params->merge($temp);
|
||||
}
|
||||
|
||||
// Setup the category parameters.
|
||||
$cparams = $category->getParams();
|
||||
$category->params = clone($params);
|
||||
$category->params->merge($cparams);
|
||||
|
||||
$children = array($category->id => $children);
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$maxLevel = $params->get('maxLevel', -1);
|
||||
$this->maxLevel = &$maxLevel;
|
||||
$this->state = &$state;
|
||||
$this->items = &$items;
|
||||
$this->category = &$category;
|
||||
$this->children = &$children;
|
||||
$this->params = &$params;
|
||||
$this->parent = &$parent;
|
||||
$this->pagination = &$pagination;
|
||||
$this->user = &$user;
|
||||
|
||||
// Check for layout override only if this is not the active menu item
|
||||
// If it is the active menu item, then the view and category id will match
|
||||
$active = $app->getMenu()->getActive();
|
||||
if ((!$active) || ((strpos($active->link, 'view=category') === false) || (strpos($active->link, '&id=' . (string) $this->category->id) === false)))
|
||||
{
|
||||
if ($layout = $category->params->get('category_layout'))
|
||||
{
|
||||
$this->setLayout($layout);
|
||||
}
|
||||
}
|
||||
elseif (isset($active->query['layout']))
|
||||
{
|
||||
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
|
||||
$this->setLayout($active->query['layout']);
|
||||
}
|
||||
|
||||
$this->category->tags = new JHelperTags;
|
||||
$this->category->tags->getItemTags('com_newsfeeds.category', $this->category->id);
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$pathway = $app->getPathway();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_NEWSFEEDS_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
|
||||
$id = (int) @$menu->query['id'];
|
||||
|
||||
if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $this->category->id))
|
||||
{
|
||||
$path = array(array('title' => $this->category->title, 'link' => ''));
|
||||
$category = $this->category->getParent();
|
||||
|
||||
while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1)
|
||||
{
|
||||
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
|
||||
$category = $category->getParent();
|
||||
}
|
||||
|
||||
$path = array_reverse($path);
|
||||
|
||||
foreach ($path as $item)
|
||||
{
|
||||
$pathway->addItem($item['title'], $item['link']);
|
||||
}
|
||||
}
|
||||
|
||||
$title = $this->params->get('page_title', '');
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->category->metadesc)
|
||||
{
|
||||
$this->document->setDescription($this->category->metadesc);
|
||||
}
|
||||
elseif (!$this->category->metadesc && $this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->category->metakey)
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->category->metakey);
|
||||
}
|
||||
elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
|
||||
if ($app->getCfg('MetaAuthor') == '1')
|
||||
{
|
||||
$this->document->setMetaData('author', $this->category->getMetadata()->get('author'));
|
||||
}
|
||||
|
||||
$mdata = $this->category->getMetadata()->toArray();
|
||||
|
||||
foreach ($mdata as $k => $v)
|
||||
{
|
||||
if ($v)
|
||||
{
|
||||
$this->document->setMetadata($k, $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_newsfeeds/views/index.html
Normal file
1
components/com_newsfeeds/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
components/com_newsfeeds/views/newsfeed/index.html
Normal file
1
components/com_newsfeeds/views/newsfeed/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
8
components/com_newsfeeds/views/newsfeed/metadata.xml
Normal file
8
components/com_newsfeeds/views/newsfeed/metadata.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="NEWSFEEDS_NEWSFEED_INDIVIDUAL_FEED_LABEL">
|
||||
<message>
|
||||
<![CDATA[NEWSFEEDS_NEWSFEED_INDIVIDUAL_FEED_DESC]]>
|
||||
</message>
|
||||
</view>
|
||||
</metadata>
|
137
components/com_newsfeeds/views/newsfeed/tmpl/default.php
Normal file
137
components/com_newsfeeds/views/newsfeed/tmpl/default.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<?php
|
||||
if (!empty($this->msg))
|
||||
{
|
||||
echo $this->msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
$myrtl = $this->newsfeed->rtl;
|
||||
$direction = " ";
|
||||
|
||||
if ($lang->isRTL() && $myrtl == 0)
|
||||
{
|
||||
$direction = " redirect-rtl";
|
||||
}
|
||||
elseif ($lang->isRTL() && $myrtl == 1)
|
||||
{
|
||||
$direction = " redirect-ltr";
|
||||
}
|
||||
elseif ($lang->isRTL() && $myrtl == 2)
|
||||
{
|
||||
$direction = " redirect-rtl";
|
||||
}
|
||||
elseif ($myrtl == 0)
|
||||
{
|
||||
$direction = " redirect-ltr";
|
||||
}
|
||||
elseif ($myrtl == 1)
|
||||
{
|
||||
$direction = " redirect-ltr";
|
||||
}
|
||||
elseif ($myrtl == 2)
|
||||
{
|
||||
$direction = " redirect-rtl";
|
||||
}
|
||||
$images = json_decode($this->item->images);
|
||||
?>
|
||||
<div class="newsfeed<?php echo $this->pageclass_sfx?><?php echo $direction; ?>">
|
||||
<?php if ($this->params->get('display_num')) : ?>
|
||||
<h1 class="<?php echo $direction; ?>">
|
||||
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
<h2 class="<?php echo $direction; ?>">
|
||||
<?php if ($this->item->published == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo $this->item->link; ?>" target="_blank">
|
||||
<?php echo str_replace(''', "'", $this->item->name); ?></a>
|
||||
</h2>
|
||||
|
||||
<?php if ($this->params->get('show_tags', 1)) : ?>
|
||||
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
|
||||
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Show Images from Component -->
|
||||
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
|
||||
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
|
||||
<div class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>"> <img
|
||||
<?php if ($images->image_first_caption):
|
||||
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_first_caption) .'"';
|
||||
endif; ?>
|
||||
src="<?php echo htmlspecialchars($images->image_first); ?>" alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/> </div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
|
||||
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
|
||||
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
|
||||
<?php if ($images->image_second_caption):
|
||||
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_second_caption) .'"';
|
||||
endif; ?>
|
||||
src="<?php echo htmlspecialchars($images->image_second); ?>" alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
|
||||
<?php endif; ?>
|
||||
<!-- Show Description from Component -->
|
||||
<?php echo $this->item->description; ?>
|
||||
<!-- Show Feed's Description -->
|
||||
|
||||
<?php if ($this->params->get('show_feed_description')) : ?>
|
||||
<div class="feed-description">
|
||||
<?php echo str_replace(''', "'", $this->rssDoc->description); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Show Image -->
|
||||
<?php if (isset($this->rssDoc->image) && isset($this->rssDoc->imagetitle) && $this->params->get('show_feed_image')) : ?>
|
||||
<div>
|
||||
<img src="<?php echo $this->rssDoc->image; ?>" alt="<?php echo $this->rssDoc->image->decription; ?>" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Show items -->
|
||||
<?php if (!empty($this->rssDoc[0])) { ?>
|
||||
<ol>
|
||||
<?php for ($i = 0; $i < $this->item->numarticles; $i++) { ?>
|
||||
|
||||
<?php
|
||||
$uri = !empty($this->rssDoc[$i]->guid) || !is_null($this->rssDoc[$i]->guid) ? $this->rssDoc[$i]->guid : $this->rssDoc[$i]->uri;
|
||||
$uri = substr($uri, 0, 4) != 'http' ? $this->item->link : $uri;
|
||||
$text = !empty($this->rssDoc[$i]->content) || !is_null($this->rssDoc[$i]->content) ? $this->rssDoc[$i]->content : $this->rssDoc[$i]->description;
|
||||
?>
|
||||
<li>
|
||||
<?php if (!empty($this->rssDoc[$i]->uri)) : ?>
|
||||
<a href="<?php echo $this->rssDoc[$i]->uri; ?>" target="_blank">
|
||||
<?php echo $this->rssDoc[$i]->title; ?></a>
|
||||
<?php else : ?>
|
||||
<h3><?php echo '<a target="_blank" href="' .$this->rssDoc[$i]->uri . '">' .$this->rssDoc[$i]->title. '</a>'; ?></h3>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_item_description') && !empty($text)) : ?>
|
||||
<div class="feed-item-description">
|
||||
<?php if ($this->params->get('show_feed_image', 0) == 0)
|
||||
{
|
||||
$text = JFilterOutput::stripImages($text);
|
||||
}
|
||||
$text = JHtml::_('string.truncate', $text, $this->params->get('feed_character_count'));
|
||||
echo str_replace(''', "'", $text);
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ol>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
87
components/com_newsfeeds/views/newsfeed/tmpl/default.xml
Normal file
87
components/com_newsfeeds/views/newsfeed/tmpl/default.xml
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_TITLE" option="COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_OPTION">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_SINGLE_NEWSFEED"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
addfieldpath="/administrator/components/com_newsfeeds/models/fields"
|
||||
>
|
||||
|
||||
<field name="id" type="modal_newsfeed"
|
||||
description="COM_NEWSFEEDS_FIELD_SELECT_FEED_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SELECT_FEED_LABEL"
|
||||
required="true"
|
||||
edit="true"
|
||||
clear="false"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
|
||||
<!-- Basic options. -->
|
||||
<fieldset name="basic" label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
|
||||
<field name="show_feed_image" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_feed_description" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_item_description" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_tags" type="list"
|
||||
label="COM_NEWSFEEDS_FIELD_SHOW_TAGS_LABEL"
|
||||
description="COM_NEWSFEEDS_FIELD_SHOW_TAGS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="feed_character_count" type="text"
|
||||
default="0"
|
||||
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
|
||||
size="6"
|
||||
/>
|
||||
|
||||
<field name="feed_display_order" type="list"
|
||||
description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
|
||||
label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="des">JGLOBAL_MOST_RECENT_FIRST</option>
|
||||
<option value="asc">JGLOBAL_OLDEST_FIRST</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
1
components/com_newsfeeds/views/newsfeed/tmpl/index.html
Normal file
1
components/com_newsfeeds/views/newsfeed/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
315
components/com_newsfeeds/views/newsfeed/view.html.php
Normal file
315
components/com_newsfeeds/views/newsfeed/view.html.php
Normal file
@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Newsfeeds component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_newsfeeds
|
||||
* @since 1.0
|
||||
*/
|
||||
class NewsfeedsViewNewsfeed extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* @var object
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $print;
|
||||
|
||||
/**
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Get view related request variables.
|
||||
$print = $app->input->getBool('print');
|
||||
|
||||
// Get model data.
|
||||
$state = $this->get('State');
|
||||
$item = $this->get('Item');
|
||||
|
||||
if ($item)
|
||||
{
|
||||
// Get Category Model data
|
||||
$categoryModel = JModelLegacy::getInstance('Category', 'NewsfeedsModel', array('ignore_request' => true));
|
||||
$categoryModel->setState('category.id', $item->catid);
|
||||
$categoryModel->setState('list.ordering', 'a.name');
|
||||
$categoryModel->setState('list.direction', 'asc');
|
||||
// TODO: $items is not used. Remove this line?
|
||||
$items = $categoryModel->getItems();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
// @TODO Maybe this could go into JComponentHelper::raiseErrors($this->get('Errors'))
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseWarning(500, implode("\n", $errors));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add router helpers.
|
||||
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
||||
$item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid;
|
||||
$item->parent_slug = $item->category_alias ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id;
|
||||
|
||||
// check if cache directory is writeable
|
||||
$cacheDir = JPATH_CACHE . '/';
|
||||
|
||||
if (!is_writable($cacheDir))
|
||||
{
|
||||
JError::raiseNotice('0', JText::_('COM_NEWSFEEDS_CACHE_DIRECTORY_UNWRITABLE'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Merge newsfeed params. If this is single-newsfeed view, menu params override newsfeed params
|
||||
// Otherwise, newsfeed params override menu item params
|
||||
$params = $state->get('params');
|
||||
$newsfeed_params = clone $item->params;
|
||||
$active = $app->getMenu()->getActive();
|
||||
$temp = clone ($params);
|
||||
|
||||
// Check to see which parameters should take priority
|
||||
if ($active)
|
||||
{
|
||||
$currentLink = $active->link;
|
||||
// If the current view is the active item and an newsfeed view for this feed, then the menu item params take priority
|
||||
if (strpos($currentLink, 'view=newsfeed') && (strpos($currentLink, '&id='.(string) $item->id)))
|
||||
{
|
||||
// $item->params are the newsfeed params, $temp are the menu item params
|
||||
// Merge so that the menu item params take priority
|
||||
$newsfeed_params->merge($temp);
|
||||
$item->params = $newsfeed_params;
|
||||
// Load layout from active query (in case it is an alternative menu item)
|
||||
if (isset($active->query['layout']))
|
||||
{
|
||||
$this->setLayout($active->query['layout']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Current view is not a single newsfeed, so the newsfeed params take priority here
|
||||
// Merge the menu item params with the newsfeed params so that the newsfeed params take priority
|
||||
$temp->merge($newsfeed_params);
|
||||
$item->params = $temp;
|
||||
// Check for alternative layouts (since we are not in a single-newsfeed menu item)
|
||||
if ($layout = $item->params->get('newsfeed_layout'))
|
||||
{
|
||||
$this->setLayout($layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Merge so that newsfeed params take priority
|
||||
$temp->merge($newsfeed_params);
|
||||
$item->params = $temp;
|
||||
// Check for alternative layouts (since we are not in a single-newsfeed menu item)
|
||||
if ($layout = $item->params->get('newsfeed_layout'))
|
||||
{
|
||||
$this->setLayout($layout);
|
||||
}
|
||||
}
|
||||
|
||||
// Check the access to the newsfeed
|
||||
$levels = $user->getAuthorisedViewLevels();
|
||||
|
||||
if (!in_array($item->access, $levels) or ((in_array($item->access, $levels) and (!in_array($item->category_access, $levels)))))
|
||||
{
|
||||
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current menu item
|
||||
$params = $app->getParams();
|
||||
|
||||
// Get the newsfeed
|
||||
$newsfeed = $item;
|
||||
|
||||
$temp = new JRegistry;
|
||||
$temp->loadString($item->params);
|
||||
$params->merge($temp);
|
||||
|
||||
try
|
||||
{
|
||||
$feed = new JFeedFactory;
|
||||
$this->rssDoc = $feed->getFeed($newsfeed->link);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
catch (RunTimeException $e)
|
||||
{
|
||||
$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
if (empty($this->rssDoc))
|
||||
{
|
||||
$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
$feed_display_order = $params->get('feed_display_order', 'des');
|
||||
if ($feed_display_order == 'asc')
|
||||
{
|
||||
$newsfeed->items = array_reverse($newsfeed->items);
|
||||
}
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$this->assignRef('params', $params);
|
||||
$this->assignRef('newsfeed', $newsfeed);
|
||||
$this->assignRef('state', $state);
|
||||
$this->assignRef('item', $item);
|
||||
$this->assignRef('user', $user);
|
||||
if (!empty($msg))
|
||||
{
|
||||
$this->assignRef('msg', $msg);
|
||||
}
|
||||
$this->print = $print;
|
||||
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getItemTags('com_newsfeeds.newsfeed', $item->id);
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$pathway = $app->getPathway();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_NEWSFEEDS_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
|
||||
$title = $this->params->get('page_title', '');
|
||||
|
||||
$id = (int) @$menu->query['id'];
|
||||
|
||||
// if the menu item does not concern this newsfeed
|
||||
if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] != 'newsfeed' || $id != $this->item->id))
|
||||
{
|
||||
// If this is not a single newsfeed menu item, set the page title to the newsfeed title
|
||||
if ($this->item->name)
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
|
||||
$path = array(array('title' => $this->item->name, 'link' => ''));
|
||||
$category = JCategories::getInstance('Newsfeeds')->get($this->item->catid);
|
||||
while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1)
|
||||
{
|
||||
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
|
||||
$category = $category->getParent();
|
||||
}
|
||||
$path = array_reverse($path);
|
||||
foreach ($path as $item)
|
||||
{
|
||||
$pathway->addItem($item['title'], $item['link']);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->item->metadesc)
|
||||
{
|
||||
$this->document->setDescription($this->item->metadesc);
|
||||
}
|
||||
elseif (!$this->item->metadesc && $this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->item->metakey)
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->item->metakey);
|
||||
}
|
||||
elseif (!$this->item->metakey && $this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
|
||||
if ($app->getCfg('MetaTitle') == '1')
|
||||
{
|
||||
$this->document->setMetaData('title', $this->item->name);
|
||||
}
|
||||
|
||||
if ($app->getCfg('MetaAuthor') == '1')
|
||||
{
|
||||
$this->document->setMetaData('author', $this->item->author);
|
||||
}
|
||||
|
||||
$mdata = $this->item->metadata->toArray();
|
||||
foreach ($mdata as $k => $v)
|
||||
{
|
||||
if ($v)
|
||||
{
|
||||
$this->document->setMetadata($k, $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user