| Current Path : /home/lejardintz/www/components/com_kunena/controller/user/edit/ |
| Current File : /home/lejardintz/www/components/com_kunena/controller/user/edit/display.php |
<?php
/**
* Kunena Component
* @package Kunena.Site
* @subpackage Controller.User
*
* @copyright (C) 2008 - 2016 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/
defined('_JEXEC') or die;
/**
* Class ComponentKunenaControllerUserEditDisplay
*
* @since K4.0
*/
class ComponentKunenaControllerUserEditDisplay extends KunenaControllerDisplay
{
protected $name = 'User/Edit';
/**
* @var jUser
*/
public $user;
/**
* @var KunenaUser
*/
public $profile;
/**
* Prepare user for editing.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
// If profile integration is disabled, this view doesn't exist.
$integration = KunenaFactory::getProfile();
if (get_class($integration) == 'KunenaProfileNone')
{
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
}
$userid = $this->input->getInt('userid');
$this->user = JFactory::getUser($userid);
$this->profile = KunenaUserHelper::get($userid);
$this->profile->tryAuthorise('edit');
$this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
}
/**
* Prepare document.
*
* @return void
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menu_item = $app->getMenu()->getActive(); // get the active item
if ($menu_item)
{
$params = $menu_item->params; // get the params
$params_title = $params->get('page_title');
$params_keywords = $params->get('menu-meta_keywords');
$params_description = $params->get('menu-meta_description');
if (!empty($params_title))
{
$title = $params->get('page_title');
$this->setTitle($title);
}
else
{
$this->setTitle($this->headerText);
}
if (!empty($params_keywords))
{
$keywords = $params->get('menu-meta_keywords');
$this->setKeywords($keywords);
}
else
{
$this->setKeywords($this->headerText);
}
if (!empty($params_description))
{
$description = $params->get('menu-meta_description');
$this->setDescription($description);
}
else
{
$this->setDescription($this->headerText);
}
}
}
}