- md5
- ed1044d2882349bfad508d5072e537fe
- sha1
- d8097a6af34ff94f58a8e9753b6c456600c5d643
- sha256
- 125e817d1a4e5864d0ff615ce8e21b9973c2ba8fe6e45cc06c03042c840825db
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2015 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.
*
* @since 1.5
*/
class JHtmlNewsfeed
{
/**
* Get the associated language flags
*
* @param int $newsfeedid The item id to search associations
*
* @return string The language HTML
*
* @throws Exception Throws a 500 Exception on Database failure
*/
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;
}
}
The same content is in 20 releases, Joomla 3.4.0-beta1 to 3.5.0-beta. See them all, or every version of this file.