$associated)
{
$associations[$tag] = (int) $associated->id;
}
// Get the associated menu items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('c.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__content 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)) . ')')
->where('c.id != ' . $articleid)
->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, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = JRoute::_('index.php?option=com_content&task=article.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '
' . JText::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = ''
. $text . '';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
/**
* Show the feature/unfeature links
*
* @param integer $value The state value
* @param integer $i Row number
* @param boolean $canChange Is user allowed to change?
*
* @return string HTML code
*/
public static function featured($value = 0, $i, $canChange = true)
{
JHtml::_('bootstrap.tooltip');
// Array of image, task, title, action
$states = array(
0 => array('unfeatured', 'articles.featured', 'COM_CONTENT_UNFEATURED', 'JGLOBAL_TOGGLE_FEATURED'),
1 => array('featured', 'articles.unfeatured', 'COM_CONTENT_FEATURED', 'JGLOBAL_TOGGLE_FEATURED'),
);
$state = ArrayHelper::getValue($states, (int) $value, $states[1]);
$icon = $state[0];
if ($canChange)
{
$html = '';
}
else
{
$html = '';
}
return $html;
}
}