[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/components/com_users/views/login/ -> view.html.php (source)

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


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1