You've already forked joomla_test
first commit
This commit is contained in:
1
components/com_weblinks/views/category/index.html
Normal file
1
components/com_weblinks/views/category/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
6
components/com_weblinks/views/category/metadata.xml
Normal file
6
components/com_weblinks/views/category/metadata.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="Category">
|
||||
<message><![CDATA[TYPECATEGORYDESC]]></message>
|
||||
</view>
|
||||
</metadata>
|
14
components/com_weblinks/views/category/tmpl/default.php
Normal file
14
components/com_weblinks/views/category/tmpl/default.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @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');
|
||||
$this->subtemplatename = 'items';
|
||||
echo JLayoutHelper::render('joomla.content.category_default', $this);
|
195
components/com_weblinks/views/category/tmpl/default.xml
Normal file
195
components/com_weblinks/views/category/tmpl/default.xml
Normal file
@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="com_weblinks_category_view_default_title" option="com_weblinks_category_view_default_option">
|
||||
<help
|
||||
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORY"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[com_weblinks_category_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"
|
||||
default="0"
|
||||
description="COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC"
|
||||
extension="com_weblinks"
|
||||
label="COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL"
|
||||
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="0">JNONE</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" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_WEBLINKS_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"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_cat_num_links" type="list"
|
||||
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
|
||||
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
||||
>
|
||||
<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 name="show_headings" type="list"
|
||||
description="JGLOBAL_SHOW_HEADINGS_DESC"
|
||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_link_description" type="list"
|
||||
|
||||
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
|
||||
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_link_hits" type="list"
|
||||
|
||||
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
|
||||
label="JGLOBAL_HITS"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="show_pagination" type="list"
|
||||
description="JGLOBAL_PAGINATION_DESC"
|
||||
label="JGLOBAL_PAGINATION_LABEL"
|
||||
>
|
||||
<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="integration"
|
||||
>
|
||||
|
||||
<field name="show_feed_link" type="list"
|
||||
description="JGLOBAL_SHOW_FEED_LINK_DESC"
|
||||
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @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::_(WeblinksHelperRoute::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_weblinks.category'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
|
||||
<dl class="weblink-count"><dt>
|
||||
<?php echo JText::_('COM_WEBLINKS_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;
|
177
components/com_weblinks/views/category/tmpl/default_items.php
Normal file
177
components/com_weblinks/views/category/tmpl/default_items.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @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/html');
|
||||
|
||||
JHtml::_('behavior.framework');
|
||||
|
||||
// Create a shortcut for params.
|
||||
$params = &$this->item->params;
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Check if user is allowed to add/edit based on weblinks permissinos.
|
||||
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.'.$this->category->id);
|
||||
$canCreate = $user->authorise('core.create', 'com_weblinks');
|
||||
$canEditState = $user->authorise('core.edit.state', 'com_weblinks');
|
||||
|
||||
$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_WEBLINKS_NO_WEBLINKS'); ?></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_WEBLINKS_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_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_WEBLINKS_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 (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
|
||||
<?php if ($this->items[$i]->state == 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_link_hits', 1)) : ?>
|
||||
<span class="list-hits badge badge-info pull-right">
|
||||
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canEdit) : ?>
|
||||
<span class="list-edit pull-left width-50">
|
||||
<?php echo JHtml::_('icon.edit', $item, $params); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="list-title">
|
||||
<?php if ($this->params->get('icons', 1) == 0) : ?>
|
||||
<?php echo JText::_('COM_WEBLINKS_LINK'); ?>
|
||||
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
|
||||
<?php if (!$this->params->get('link_icons')) : ?>
|
||||
<?php echo JHtml::_('image', 'system/weblink.png', JText::_('COM_WEBLINKS_LINK'), null, true); ?>
|
||||
<?php else: ?>
|
||||
<?php echo '<img src="'.$this->params->get('link_icons').'" alt="'.JText::_('COM_WEBLINKS_LINK').'" />'; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
// Compute the correct link
|
||||
$menuclass = 'category'.$this->pageclass_sfx;
|
||||
$link = $item->link;
|
||||
$width = $item->params->get('width');
|
||||
$height = $item->params->get('height');
|
||||
if ($width == null || $height == null)
|
||||
{
|
||||
$width = 600;
|
||||
$height = 500;
|
||||
}
|
||||
if ($this->items[$i]->state == 0) : ?>
|
||||
<span class="label label-warning">Unpublished</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php switch ($item->params->get('target', $this->params->get('target')))
|
||||
{
|
||||
case 1:
|
||||
// open in a new window
|
||||
echo '<a href="'. $link .'" target="_blank" class="'. $menuclass .'" rel="nofollow">'.
|
||||
$this->escape($item->title) .'</a>';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// open in a popup window
|
||||
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='.$this->escape($width).',height='.$this->escape($height).'';
|
||||
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '".$attribs."'); return false;\">".
|
||||
$this->escape($item->title).'</a>';
|
||||
break;
|
||||
case 3:
|
||||
// open in a modal window
|
||||
JHtml::_('behavior.modal', 'a.modal');
|
||||
echo '<a class="modal" href="'.$link.'" rel="{handler: \'iframe\', size: {x:'.$this->escape($width).', y:'.$this->escape($height).'}}">'.
|
||||
$this->escape($item->title). ' </a>';
|
||||
break;
|
||||
|
||||
default:
|
||||
// open in parent window
|
||||
echo '<a href="'. $link . '" class="'. $menuclass .'" rel="nofollow">'.
|
||||
$this->escape($item->title) . ' </a>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
|
||||
<?php if ($this->params->get('show_tags', 1)) : ?>
|
||||
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
|
||||
<?php echo $this->item->tagLayout->render($tagsData); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
|
||||
<?php $images = json_decode($item->images); ?>
|
||||
<?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; ?>
|
||||
|
||||
<?php echo $item->description; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</li>
|
||||
<?php endif;?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php // Code to add a link to submit a weblink. ?>
|
||||
<?php /* if ($canCreate) : // TODO This is not working due to some problem in the router, I think. Ref issue #23685 ?>
|
||||
<?php echo JHtml::_('icon.create', $item, $item->params); ?>
|
||||
<?php endif; */ ?>
|
||||
<?php if ($this->params->get('show_pagination')) : ?>
|
||||
<div class="pagination">
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
<p class="counter">
|
||||
<?php echo $this->pagination->getPagesCounter(); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php endif; ?>
|
1
components/com_weblinks/views/category/tmpl/index.html
Normal file
1
components/com_weblinks/views/category/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
79
components/com_weblinks/views/category/view.feed.php
Normal file
79
components/com_weblinks/views/category/view.feed.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @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 WebLinks component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
* @since 1.0
|
||||
*/
|
||||
class WeblinksViewCategory extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$document = JFactory::getDocument();
|
||||
|
||||
$document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute($app->input->getInt('id')));
|
||||
|
||||
$app->input->set('limit', $app->getCfg('feed_limit'));
|
||||
$siteEmail = $app->getCfg('mailfrom');
|
||||
$fromName = $app->getCfg('fromname');
|
||||
$feedEmail = $app->getCfg('feed_email', 'author');
|
||||
$document->editor = $fromName;
|
||||
if ($feedEmail != "none")
|
||||
{
|
||||
$document->editorEmail = $siteEmail;
|
||||
}
|
||||
|
||||
// Get some data from the model
|
||||
$items = $this->get('Items');
|
||||
$category = $this->get('Category');
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
// strip html from feed item title
|
||||
$title = $this->escape($item->title);
|
||||
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
// url link to article
|
||||
$link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->id, $item->catid));
|
||||
|
||||
// strip html from feed item description text
|
||||
$description = $item->description;
|
||||
$author = $item->created_by_alias ? $item->created_by_alias : $item->author;
|
||||
$date = ($item->date ? date('r', strtotime($item->date)) : '');
|
||||
|
||||
// load individual item creator class
|
||||
$feeditem = new JFeedItem;
|
||||
$feeditem->title = $title;
|
||||
$feeditem->link = $link;
|
||||
$feeditem->description = $description;
|
||||
$feeditem->date = $date;
|
||||
$feeditem->category = $category->title;
|
||||
$feeditem->author = $author;
|
||||
|
||||
// We don't have the author email so we have to use site in both cases.
|
||||
if ($feedEmail == 'site')
|
||||
{
|
||||
$feeditem->authorEmail = $siteEmail;
|
||||
}
|
||||
elseif ($feedEmail === 'author')
|
||||
{
|
||||
$feeditem->authorEmail = $item->author_email;
|
||||
}
|
||||
|
||||
// loads item info into rss array
|
||||
$document->addItem($feeditem);
|
||||
}
|
||||
}
|
||||
}
|
245
components/com_weblinks/views/category/view.html.php
Normal file
245
components/com_weblinks/views/category/view.html.php
Normal file
@ -0,0 +1,245 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @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 WebLinks component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_weblinks
|
||||
* @since 1.5
|
||||
*/
|
||||
class WeblinksViewCategory extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $items;
|
||||
|
||||
protected $category;
|
||||
|
||||
protected $children;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$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::raiseWarning(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
if ($parent == false)
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Check whether category access level allows access.
|
||||
// TODO: SHould already be computed in $category->params->get('access-view')
|
||||
$user = JFactory::getUser();
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
if (!in_array($category->access, $groups))
|
||||
{
|
||||
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
// Prepare the data.
|
||||
// Compute the weblink slug & link url.
|
||||
for ($i = 0, $n = count($items); $i < $n; $i++)
|
||||
{
|
||||
$item = &$items[$i];
|
||||
$item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id;
|
||||
|
||||
if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1)
|
||||
{
|
||||
$item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&id='. $item->id);
|
||||
}
|
||||
else {
|
||||
$item->link = $item->url;
|
||||
}
|
||||
|
||||
$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);
|
||||
$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;
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
// 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_weblinks.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_WEBLINKS_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
|
||||
$id = (int) @$menu->query['id'];
|
||||
|
||||
if ($menu && ($menu->query['option'] != 'com_weblinks' || $id != $this->category->id))
|
||||
{
|
||||
$this->params->set('page_subheading', $this->category->title);
|
||||
$path = array(array('title' => $this->category->title, 'link' => ''));
|
||||
$category = $this->category->getParent();
|
||||
|
||||
while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1)
|
||||
{
|
||||
$path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::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);
|
||||
}
|
||||
}
|
||||
|
||||
// Add alternative feed link
|
||||
if ($this->params->get('show_feed_link', 1) == 1)
|
||||
{
|
||||
$link = '&format=feed&limitstart=';
|
||||
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
|
||||
$this->document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
|
||||
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
|
||||
$this->document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user