$associated) { $associations[$tag] = (int) $associated->id; } // Get the associated contact items $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('c.id, c.name as title') ->select('l.sef as lang_sef') ->from('#__contact_details 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); return false; } if ($items) { foreach ($items as &$item) { $text = strtoupper($item->lang_sef); $url = JRoute::_('index.php?option=com_contact&task=contact.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; } /** * Show the featured/not-featured icon. * * @param int $value The featured value. * @param int $i Id of the item. * @param bool $canChange Whether the value can be changed or not. * * @return string The anchor tag to toggle featured/unfeatured contacts. * * @since 1.6 */ public static function featured($value = 0, $i, $canChange = true) { // Array of image, task, title, action $states = array( 0 => array('unfeatured', 'contacts.featured', 'COM_CONTACT_UNFEATURED', 'JGLOBAL_TOGGLE_FEATURED'), 1 => array('featured', 'contacts.unfeatured', 'JFEATURED', 'JGLOBAL_TOGGLE_FEATURED'), ); $state = JArrayHelper::getValue($states, (int) $value, $states[1]); $icon = $state[0]; if ($canChange) { $html = ''; } else { $html = ''; } return $html; } }