english/components/com_users/controller.php
/**
	 * Method to display a view.
	 *
	 * @param	boolean			If true, the view output will be cached
	 * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
	 *
	 * @return	JController		This object to support chaining.
	 * @since	1.5
	 */
Method to display a view.
@param       boolean                 If true, the view output will be cached
@param       array                   An array of safe url parameters and their variable types, for valid values see  JFilterInput::clean().

@return      JController             This object to support chaining.
Method to display a view . @param boolean If true the view output will be cached @param array An array of safe url parameters and their variable types for valid values see JFilterInput :: clean () . @return JController This object to support chaining .
public function display($cachable = false, $urlparams = false)
	{
		$document	= JFactory::getDocument();
		$vName	 = JRequest::getCmd('view', 'login');
		$vFormat = $document->getType();
		$lName	 = JRequest::getCmd('layout', 'default');
		if ($view = $this->getView($vName, $vFormat)) {
			switch ($vName) {
				case 'registration':
					$user = JFactory::getUser();
					if ($user->get('guest') != 1) {
						$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile', false));
						return;
					}
            		if(JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) {
						$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
						return;
            		}
					$model = $this->getModel('Registration');
					break;
				case 'profile':
					$user = JFactory::getUser();
					if ($user->get('guest') == 1) {
						$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
						return;
					}
					$model = $this->getModel($vName);
					break;
				case 'login':
					$model = $this->getModel($vName);
					break;
				case 'reset':
					$user = JFactory::getUser();
					if ($user->get('guest') != 1) {
						$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile', false));
						return;
					}
					$model = $this->getModel($vName);
					break;
				case 'remind':
					$user = JFactory::getUser();
					if ($user->get('guest') != 1) {
						$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile', false));
						return;
					}
					$model = $this->getModel($vName);
					break;
				default:
					$model = $this->getModel('Login');
					break;
			}
			$view->setModel($model, true);
			$view->setLayout($lName);
			$view->assignRef('document', $document);
			$view->display();
		}
	}
public function display ( $ cachable = false , $ urlparams = false ) { $ document = JFactory :: getDocument ( ) ; $ vName = JRequest :: getCmd ( 'view' , 'login' ) ; $ vFormat = $ document -> getType ( ) ; $ lName = JRequest :: getCmd ( 'layout' , 'default' ) ; if ( $ view = $ this -> getView ( $ vName , $ vFormat ) ) { switch ( $ vName ) { case 'registration' : $ user = JFactory :: getUser ( ) ; if ( $ user -> get ( 'guest' ) != 1 ) { $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=com_users&view=profile' , false ) ) ; return ; } if ( JComponentHelper :: getParams ( 'com_users' ) -> get ( 'allowUserRegistration' ) == 0 ) { $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=com_users&view=login' , false ) ) ; return ; } $ model = $ this -> getModel ( 'Registration' ) ; break ; case 'profile' : $ user = JFactory :: getUser ( ) ; if ( $ user -> get ( 'guest' ) == 1 ) { $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=com_users&view=login' , false ) ) ; return ; } $ model = $ this -> getModel ( $ vName ) ; break ; case 'login' : $ model = $ this -> getModel ( $ vName ) ; break ; case 'reset' : $ user = JFactory :: getUser ( ) ; if ( $ user -> get ( 'guest' ) != 1 ) { $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=com_users&view=profile' , false ) ) ; return ; } $ model = $ this -> getModel ( $ vName ) ; break ; case 'remind' : $ user = JFactory :: getUser ( ) ; if ( $ user -> get ( 'guest' ) != 1 ) { $ this -> setRedirect ( JRoute :: _ ( 'index.php?option=com_users&view=profile' , false ) ) ; return ; } $ model = $ this -> getModel ( $ vName ) ; break ; default : $ model = $ this -> getModel ( 'Login' ) ; break ; } $ view -> setModel ( $ model , true ) ; $ view -> setLayout ( $ lName ) ; $ view -> assignRef ( 'document' , $ document ) ; $ view -> display ( ) ; } }
Method to display a view.
Method to display a view .
// Get the document object. // Set the default view name and format from the Request. // Do any specific processing by view. // If the user is already logged in, redirect to the profile page. // Redirect to profile page. // Check if user registration is enabled // Registration is disabled - Redirect to login page. // The user is a guest, load the registration model and show the registration page. // Handle view specific models. // If the user is a guest, redirect to the login page. // Redirect to login page. // Handle the default views. // If the user is already logged in, redirect to the profile page. // Redirect to profile page. // If the user is already logged in, redirect to the profile page. // Redirect to profile page. // Push the model into the view (as default). // Push document object into the view.