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