Source for file route.php

Documentation is available at route.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_users
  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. /**
  13.  * Users Route Helper
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_users
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Method to get the menu items for the component.
  22.      *
  23.      * @return  array      An array of menu items.
  24.      * @since   1.6
  25.      */
  26.     public static function &getItems()
  27.     {
  28.         static $items;
  29.  
  30.         // Get the menu items for this component.
  31.         if (!isset($items))
  32.         {
  33.             $app    JFactory::getApplication();
  34.             $menu    $app->getMenu();
  35.             $com    JComponentHelper::getComponent('com_users');
  36.             $items    $menu->getItems('component_id'$com->id);
  37.  
  38.             // If no items found, set to empty array.
  39.             if (!$items)
  40.             {
  41.                 $items array();
  42.             }
  43.         }
  44.  
  45.         return $items;
  46.     }
  47.  
  48.     /**
  49.      * Method to get a route configuration for the login view.
  50.      *
  51.      * @return  mixed      Integer menu id on success, null on failure.
  52.      * @since   1.6
  53.      * @static
  54.      */
  55.     public static function getLoginRoute()
  56.     {
  57.         // Get the items.
  58.         $items    self::getItems();
  59.         $itemid    null;
  60.  
  61.         // Search for a suitable menu id.
  62.         foreach ($items as $item)
  63.         {
  64.             if (isset($item->query['view']&& $item->query['view'=== 'login')
  65.             {
  66.                 $itemid $item->id;
  67.                 break;
  68.             }
  69.         }
  70.  
  71.         return $itemid;
  72.     }
  73.  
  74.     /**
  75.      * Method to get a route configuration for the profile view.
  76.      *
  77.      * @return  mixed      Integer menu id on success, null on failure.
  78.      * @since   1.6
  79.      */
  80.     public static function getProfileRoute()
  81.     {
  82.         // Get the items.
  83.         $items    self::getItems();
  84.         $itemid    null;
  85.  
  86.         // Search for a suitable menu id.
  87.         //Menu link can only go to users own profile.
  88.  
  89.         foreach ($items as $item)
  90.         {
  91.             if (isset($item->query['view']&& $item->query['view'=== 'profile')
  92.             {
  93.                 $itemid $item->id;
  94.                 break;
  95.             }
  96.  
  97.         }
  98.         return $itemid;
  99.     }
  100.  
  101.     /**
  102.      * Method to get a route configuration for the registration view.
  103.      *
  104.      * @return  mixed      Integer menu id on success, null on failure.
  105.      * @since   1.6
  106.      */
  107.     public static function getRegistrationRoute()
  108.     {
  109.         // Get the items.
  110.         $items    self::getItems();
  111.         $itemid    null;
  112.  
  113.         // Search for a suitable menu id.
  114.         foreach ($items as $item)
  115.         {
  116.             if (isset($item->query['view']&& $item->query['view'=== 'registration')
  117.             {
  118.                 $itemid $item->id;
  119.                 break;
  120.             }
  121.         }
  122.  
  123.         return $itemid;
  124.     }
  125.  
  126.     /**
  127.      * Method to get a route configuration for the remind view.
  128.      *
  129.      * @return  mixed      Integer menu id on success, null on failure.
  130.      * @since   1.6
  131.      */
  132.     public static function getRemindRoute()
  133.     {
  134.         // Get the items.
  135.         $items    self::getItems();
  136.         $itemid    null;
  137.  
  138.         // Search for a suitable menu id.
  139.         foreach ($items as $item)
  140.         {
  141.             if (isset($item->query['view']&& $item->query['view'=== 'remind')
  142.             {
  143.                 $itemid $item->id;
  144.                 break;
  145.             }
  146.         }
  147.  
  148.         return $itemid;
  149.     }
  150.  
  151.     /**
  152.      * Method to get a route configuration for the resend view.
  153.      *
  154.      * @return  mixed      Integer menu id on success, null on failure.
  155.      * @since   1.6
  156.      */
  157.     public static function getResendRoute()
  158.     {
  159.         // Get the items.
  160.         $items    self::getItems();
  161.         $itemid    null;
  162.  
  163.         // Search for a suitable menu id.
  164.         foreach ($items as $item)
  165.         {
  166.             if (isset($item->query['view']&& $item->query['view'=== 'resend')
  167.             {
  168.                 $itemid $item->id;
  169.                 break;
  170.             }
  171.         }
  172.  
  173.         return $itemid;
  174.     }
  175.  
  176.     /**
  177.      * Method to get a route configuration for the reset view.
  178.      *
  179.      * @return  mixed      Integer menu id on success, null on failure.
  180.      * @since   1.6
  181.      */
  182.     public static function getResetRoute()
  183.     {
  184.         // Get the items.
  185.         $items    self::getItems();
  186.         $itemid    null;
  187.  
  188.         // Search for a suitable menu id.
  189.         foreach ($items as $item)
  190.         {
  191.             if (isset($item->query['view']&& $item->query['view'=== 'reset')
  192.             {
  193.                 $itemid $item->id;
  194.                 break;
  195.             }
  196.         }
  197.  
  198.         return $itemid;
  199.     }
  200. }

Documentation generated on Tue, 19 Nov 2013 15:12:20 +0100 by phpDocumentor 1.4.3