You've already forked joomla_test
first commit
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user