Source for file association.php

Documentation is available at association.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_content
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. JLoader::register('ContentHelper'JPATH_ADMINISTRATOR '/components/com_content/helpers/content.php');
  13. JLoader::register('CategoryHelperAssociation'JPATH_ADMINISTRATOR '/components/com_categories/helpers/association.php');
  14.  
  15. /**
  16.  * Content Component Association Helper
  17.  *
  18.  * @package     Joomla.Site
  19.  * @subpackage  com_content
  20.  * @since       3.0
  21.  */
  22. {
  23.     /**
  24.      * Method to get the associations for a given item
  25.      *
  26.      * @param   integer  $id    Id of the item
  27.      * @param   string   $view  Name of the view
  28.      *
  29.      * @return  array   Array of associations for the item
  30.      *
  31.      * @since  3.0
  32.      */
  33.  
  34.     public static function getAssociations($id 0$view null)
  35.     {
  36.         jimport('helper.route'JPATH_COMPONENT_SITE);
  37.  
  38.         $app JFactory::getApplication();
  39.         $jinput $app->input;
  40.         $view is_null($view$jinput->get('view'$view;
  41.         $id empty($id$jinput->getInt('id'$id;
  42.  
  43.         if ($view == 'article')
  44.         {
  45.             if ($id)
  46.             {
  47.                 $associations JLanguageAssociations::getAssociations('com_content''#__content''com_content.item'$id);
  48.  
  49.                 $return array();
  50.  
  51.                 foreach ($associations as $tag => $item)
  52.                 {
  53.                     $return[$tagContentHelperRoute::getArticleRoute($item->id$item->catid$item->language);
  54.                 }
  55.  
  56.                 return $return;
  57.             }
  58.         }
  59.  
  60.         if ($view == 'category' || $view == 'categories')
  61.         {
  62.             return self::getCategoryAssociations($id'com_content');
  63.         }
  64.  
  65.         return array();
  66.  
  67.     }
  68. }

Documentation generated on Tue, 19 Nov 2013 14:54:06 +0100 by phpDocumentor 1.4.3