- md5
- d0aeedbea8f1d97fc37d92dc88b6cca5
- sha1
- 905dcb8e2bd2c4972cb528a86b9eef250cd67698
- sha256
- 3cd15a686854c6928566ce07c1214cb5e33d205d4669cdb6b761a0e34217d674
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\View\Profile;
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
/**
* View class to allow users edit their own profile.
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* The form object
*
* @var \Joomla\CMS\Form\Form
* @since 1.6
*/
protected $form;
/**
* The item being viewed
*
* @var \Joomla\CMS\Object\CMSObject
* @since 1.6
*/
protected $item;
/**
* The model state
*
* @var \Joomla\CMS\Object\CMSObject
* @since 1.6
*/
protected $state;
/**
* Configuration forms for all two-factor authentication methods
*
* @var array
* @since 3.10.0
*/
protected $twofactorform;
/**
* Returns the one time password (OTP) – a.k.a. two factor authentication – configuration for the user.
*
* @var \stdClass
* @since 4.0.0
*/
protected $otpConfig;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.6
*/
public function display($tpl = null)
{
/** @var \Joomla\Component\Admin\Administrator\Model\ProfileModel $model */
$model = $this->getModel();
$this->form = $model->getForm();
$this->item = $model->getItem();
$this->state = $model->getState();
$this->twofactorform = $model->getTwofactorform();
$this->otpConfig = $model->getOtpConfig();
// Check for errors.
if ($errors = $model->getErrors())
{
throw new GenericDataException(implode("\n", $errors), 500);
}
$this->form->setValue('password', null);
$this->form->setValue('password2', null);
$this->addToolbar();
return parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
Factory::getApplication()->input->set('hidemainmenu', 1);
ToolbarHelper::title(Text::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile');
ToolbarHelper::apply('profile.apply');
ToolbarHelper::divider();
ToolbarHelper::save('profile.save');
ToolbarHelper::divider();
ToolbarHelper::cancel('profile.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::divider();
ToolbarHelper::help('JHELP_ADMIN_USER_PROFILE_EDIT');
}
}
The same content is in 2 releases, Joomla 4.0.0-beta6 to 4.0.0-beta7. See them all, or every version of this file.