| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Joomla.Site 4 * @subpackage com_users 5 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 9 defined('_JEXEC') or die; 10 11 /** 12 * Users Route Helper 13 * 14 * @package Joomla.Site 15 * @subpackage com_users 16 * @since 1.6 17 */ 18 class UsersHelperRoute 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 // Include the site app in case we are loading this from the admin. 33 require_once JPATH_SITE.'/includes/application.php'; 34 35 $app = JFactory::getApplication(); 36 $menu = $app->getMenu(); 37 $com = JComponentHelper::getComponent('com_users'); 38 $items = $menu->getItems('component_id', $com->id); 39 40 // If no items found, set to empty array. 41 if (!$items) { 42 $items = array(); 43 } 44 } 45 46 return $items; 47 } 48 49 /** 50 * Method to get a route configuration for the login view. 51 * 52 * @return mixed Integer menu id on success, null on failure. 53 * @since 1.6 54 * @static 55 */ 56 public static function getLoginRoute() 57 { 58 // Get the items. 59 $items = self::getItems(); 60 $itemid = null; 61 62 // Search for a suitable menu id. 63 foreach ($items as $item) { 64 if (isset($item->query['view']) && $item->query['view'] === 'login') { 65 $itemid = $item->id; 66 break; 67 } 68 } 69 70 return $itemid; 71 } 72 73 /** 74 * Method to get a route configuration for the profile view. 75 * 76 * @return mixed Integer menu id on success, null on failure. 77 * @since 1.6 78 */ 79 public static function getProfileRoute() 80 { 81 // Get the items. 82 $items = self::getItems(); 83 $itemid = null; 84 85 // Search for a suitable menu id. 86 //Menu link can only go to users own profile. 87 88 foreach ($items as $item) { 89 if (isset($item->query['view']) && $item->query['view'] === 'profile') { 90 $itemid = $item->id; 91 break; 92 } 93 94 } 95 return $itemid; 96 } 97 98 /** 99 * Method to get a route configuration for the registration view. 100 * 101 * @return mixed Integer menu id on success, null on failure. 102 * @since 1.6 103 */ 104 public static function getRegistrationRoute() 105 { 106 // Get the items. 107 $items = self::getItems(); 108 $itemid = null; 109 110 // Search for a suitable menu id. 111 foreach ($items as $item) { 112 if (isset($item->query['view']) && $item->query['view'] === 'registration') { 113 $itemid = $item->id; 114 break; 115 } 116 } 117 118 return $itemid; 119 } 120 121 /** 122 * Method to get a route configuration for the remind view. 123 * 124 * @return mixed Integer menu id on success, null on failure. 125 * @since 1.6 126 */ 127 public static function getRemindRoute() 128 { 129 // Get the items. 130 $items = self::getItems(); 131 $itemid = null; 132 133 // Search for a suitable menu id. 134 foreach ($items as $item) { 135 if (isset($item->query['view']) && $item->query['view'] === 'remind') { 136 $itemid = $item->id; 137 break; 138 } 139 } 140 141 return $itemid; 142 } 143 144 /** 145 * Method to get a route configuration for the resend view. 146 * 147 * @return mixed Integer menu id on success, null on failure. 148 * @since 1.6 149 */ 150 public static function getResendRoute() 151 { 152 // Get the items. 153 $items = self::getItems(); 154 $itemid = null; 155 156 // Search for a suitable menu id. 157 foreach ($items as $item) { 158 if (isset($item->query['view']) && $item->query['view'] === 'resend') { 159 $itemid = $item->id; 160 break; 161 } 162 } 163 164 return $itemid; 165 } 166 167 /** 168 * Method to get a route configuration for the reset view. 169 * 170 * @return mixed Integer menu id on success, null on failure. 171 * @since 1.6 172 */ 173 public static function getResetRoute() 174 { 175 // Get the items. 176 $items = self::getItems(); 177 $itemid = null; 178 179 // Search for a suitable menu id. 180 foreach ($items as $item) { 181 if (isset($item->query['view']) && $item->query['view'] === 'reset') { 182 $itemid = $item->id; 183 break; 184 } 185 } 186 187 return $itemid; 188 } 189 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |