[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/components/com_weblinks/helpers/ -> route.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: route.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Weblinks
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant to the
   9   * GNU General Public License, and as distributed it includes or is derivative
  10   * of works licensed under the GNU General Public License or other free or open
  11   * source software licenses. See COPYRIGHT.php for copyright notices and
  12   * details.
  13   */
  14  
  15  // no direct access
  16  defined('_JEXEC') or die('Restricted access');
  17  
  18  // Component Helper
  19  jimport('joomla.application.component.helper');
  20  
  21  /**
  22   * Weblinks Component Route Helper
  23   *
  24   * @static
  25   * @package        Joomla
  26   * @subpackage    Weblinks
  27   * @since 1.5
  28   */
  29  class WeblinksHelperRoute
  30  {
  31  	function getWeblinkRoute($id, $catid) {
  32          $needles = array(
  33              'category' => (int) $catid,
  34              'categories' => null
  35          );
  36  
  37          //Find the itemid
  38          $itemid = WeblinksHelperRoute::_findItem($needles);
  39          $itemid = $itemid ? '&Itemid='.$itemid : '';
  40  
  41          //Create the link
  42          $link = 'index.php?option=com_weblinks&view=weblink&id='. $id . '&catid='.$catid . $itemid;
  43  
  44          return $link;
  45      }
  46  
  47  	function _findItem($needles)
  48      {
  49          static $items;
  50  
  51          if (!$items)
  52          {
  53              $component =& JComponentHelper::getComponent('com_weblinks');
  54              $menu = &JSite::getMenu();
  55              $items = $menu->getItems('componentid', $component->id);
  56          }
  57  
  58          if (!is_array($items)) {
  59              return null;
  60          }
  61  
  62          $match = null;
  63          foreach($needles as $needle => $id)
  64          {
  65              foreach($items as $item)
  66              {
  67                  if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id)) {
  68                      $match = $item->id;
  69                      break;
  70                  }
  71              }
  72  
  73              if(isset($match)) {
  74                  break;
  75              }
  76          }
  77  
  78          return $match;
  79      }
  80  }
  81  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1