Source for file view.html.php

Documentation is available at view.html.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.  * Login view class for Users.
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_users
  17.  * @since       1.5
  18.  */
  19. class UsersViewLogin extends JViewLegacy
  20. {
  21.     protected $form;
  22.  
  23.     protected $params;
  24.  
  25.     protected $state;
  26.  
  27.     protected $user;
  28.  
  29.     /**
  30.      * Method to display the view.
  31.      *
  32.      * @param   string    The template file to include
  33.      * @since   1.5
  34.      */
  35.     public function display($tpl null)
  36.     {
  37.         // Get the view data.
  38.         $this->user        = JFactory::getUser();
  39.         $this->form        = $this->get('Form');
  40.         $this->state    = $this->get('State');
  41.         $this->params    = $this->state->get('params');
  42.  
  43.         // Check for errors.
  44.         if (count($errors $this->get('Errors')))
  45.         {
  46.             JError::raiseError(500implode('<br />'$errors));
  47.             return false;
  48.         }
  49.  
  50.         // Check for layout override
  51.         $active JFactory::getApplication()->getMenu()->getActive();
  52.         if (isset($active->query['layout']))
  53.         {
  54.             $this->setLayout($active->query['layout']);
  55.         }
  56.  
  57.         //Escape strings for HTML output
  58.         $this->pageclass_sfx htmlspecialchars($this->params->get('pageclass_sfx'));
  59.  
  60.         $this->prepareDocument();
  61.  
  62.         parent::display($tpl);
  63.     }
  64.  
  65.     /**
  66.      * Prepares the document
  67.      * @since   1.6
  68.      */
  69.     protected function prepareDocument()
  70.     {
  71.         $app        JFactory::getApplication();
  72.         $menus        $app->getMenu();
  73.         $user        JFactory::getUser();
  74.         $login        $user->get('guest'true false;
  75.         $title         null;
  76.  
  77.         // Because the application sets a default page title,
  78.         // we need to get it from the menu item itself
  79.         $menu $menus->getActive();
  80.         if ($menu)
  81.         {
  82.             $this->params->def('page_heading'$this->params->get('page_title'$menu->title));
  83.         }
  84.         else
  85.         {
  86.             $this->params->def('page_heading'$login JText::_('JLOGIN'JText::_('JLOGOUT'));
  87.         }
  88.  
  89.         $title $this->params->get('page_title''');
  90.         if (empty($title))
  91.         {
  92.             $title $app->getCfg('sitename');
  93.         }
  94.         elseif ($app->getCfg('sitename_pagetitles'0== 1)
  95.         {
  96.             $title JText::sprintf('JPAGETITLE'$app->getCfg('sitename')$title);
  97.         }
  98.         elseif ($app->getCfg('sitename_pagetitles'0== 2)
  99.         {
  100.             $title JText::sprintf('JPAGETITLE'$title$app->getCfg('sitename'));
  101.         }
  102.         $this->document->setTitle($title);
  103.  
  104.         if ($this->params->get('menu-meta_description'))
  105.         {
  106.             $this->document->setDescription($this->params->get('menu-meta_description'));
  107.         }
  108.  
  109.         if ($this->params->get('menu-meta_keywords'))
  110.         {
  111.             $this->document->setMetadata('keywords'$this->params->get('menu-meta_keywords'));
  112.         }
  113.  
  114.         if ($this->params->get('robots'))
  115.         {
  116.             $this->document->setMetadata('robots'$this->params->get('robots'));
  117.         }
  118.     }
  119. }

Documentation generated on Tue, 19 Nov 2013 15:17:11 +0100 by phpDocumentor 1.4.3