- md5
- 571fac30c53690896e84e0d1d75c3352
- sha1
- 666272fe67864aaf816613b406f388e0c7162618
- sha256
- e6c667863191a19da8192294f5ded0eccb5bfd08a3297bcbfe6a17c8e9b84633
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
<?php
/**
* @package Joomla.Administrator
* @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;
/**
* Newsfeeds component helper.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsHelper
{
public static $extension = 'com_newsfeeds';
/**
* Configure the Linkbar.
*
* @param string The name of the active view.
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('COM_NEWSFEEDS_SUBMENU_NEWSFEEDS'),
'index.php?option=com_newsfeeds&view=newsfeeds',
$vName == 'newsfeeds'
);
JHtmlSidebar::addEntry(
JText::_('COM_NEWSFEEDS_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&extension=com_newsfeeds',
$vName == 'categories'
);
if ($vName == 'categories')
{
JToolbarHelper::title(
JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_newsfeeds')),
'newsfeeds-categories');
}
}
/**
* Gets a list of the actions that can be performed.
*
* @param integer The category ID.
*
* @return JObject
*/
public static function getActions($categoryId = 0, $newsfeedId = 0)
{
$user = JFactory::getUser();
$result = new JObject;
if (empty($categoryId))
{
$assetName = 'com_newsfeeds';
$level = 'component';
}
else
{
$assetName = 'com_newsfeeds.category.'.(int) $categoryId;
$level = 'category';
}
$actions = JAccess::getActions('com_newsfeeds', $level);
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
public static function getAssociations($pk)
{
$associations = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->from('#__newsfeeds as c');
$query->innerJoin('#__associations as a ON a.id = c.id AND a.context='.$db->quote('com_newsfeeds.item'));
$query->innerJoin('#__associations as a2 ON a.key = a2.key');
$query->innerJoin('#__newsfeeds as c2 ON a2.id = c2.id');
$query->innerJoin('#__categories as ca ON c2.catid = ca.id AND ca.extension = '.$db->quote('com_newsfeeds'));
$query->where('c.id =' . (int) $pk);
$select = array(
'c2.language',
$query->concatenate(array('c2.id', 'c2.alias'), ':') . ' AS id',
$query->concatenate(array('ca.id', 'ca.alias'), ':') . ' AS catid'
);
$query->select($select);
$db->setQuery($query);
$contactitems = $db->loadObjectList('language');
// Check for a database error.
if ($error = $db->getErrorMsg())
{
JError::raiseWarning(500, $error);
return false;
}
foreach ($contactitems as $tag => $item)
{
$associations[$tag] = $item;
}
return $associations;
}
}
The same content is in 2 releases, Joomla 3.0.3 to 3.0.4. See them all, or every version of this file.