You've already forked joomla_test
first commit
This commit is contained in:
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,91 @@
|
||||
<?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;
|
||||
|
||||
JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR . '/components/com_newsfeeds/helpers/newsfeeds.php');
|
||||
|
||||
/**
|
||||
* Utility class for creating HTML Grids
|
||||
*
|
||||
* @static
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_newsfeeds
|
||||
* @since 1.5
|
||||
*/
|
||||
class JHtmlNewsfeed
|
||||
{
|
||||
/**
|
||||
* Get the associated language flags
|
||||
*
|
||||
* @param int $newsfeedid The item id to search associations
|
||||
*
|
||||
* @return string The language HTML
|
||||
*/
|
||||
public static function association($newsfeedid)
|
||||
{
|
||||
// Defaults
|
||||
$html = '';
|
||||
|
||||
// Get the associations
|
||||
if ($associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $newsfeedid))
|
||||
{
|
||||
foreach ($associations as $tag => $associated)
|
||||
{
|
||||
$associations[$tag] = (int) $associated->id;
|
||||
}
|
||||
|
||||
// Get the associated newsfeed items
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('c.id, c.name as title')
|
||||
->select('l.sef as lang_sef')
|
||||
->from('#__newsfeeds as c')
|
||||
->select('cat.title as category_title')
|
||||
->join('LEFT', '#__categories as cat ON cat.id=c.catid')
|
||||
->where('c.id IN (' . implode(',', array_values($associations)) . ')')
|
||||
->join('LEFT', '#__languages as l ON c.language=l.lang_code')
|
||||
->select('l.image')
|
||||
->select('l.title as language_title');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$items = $db->loadObjectList('id');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
throw new Exception($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
if ($items)
|
||||
{
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$text = strtoupper($item->lang_sef);
|
||||
$url = JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id=' . (int) $item->id);
|
||||
$tooltipParts = array(
|
||||
JHtml::_('image', 'mod_languages/' . $item->image . '.gif',
|
||||
$item->language_title,
|
||||
array('title' => $item->language_title),
|
||||
true
|
||||
),
|
||||
$item->title,
|
||||
'(' . $item->category_title . ')'
|
||||
);
|
||||
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
|
||||
}
|
||||
}
|
||||
|
||||
$html = JLayoutHelper::render('joomla.content.associations', $items);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
80
administrator/components/com_newsfeeds/helpers/newsfeeds.php
Normal file
80
administrator/components/com_newsfeeds/helpers/newsfeeds.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user