CoreFiles by mySites.guru
HtmlView.php118 lines, 3,044 bytes, from Joomla_4.2.1-rc2-Release_Candidate-Full_Package.zip
Raw History Compare with 4.2.1-rc1
md5
46a249e7ec9700422b506c4d7d578928
sha1
cef7bf5a41ab136c48c96a09a4dc65ee9c929d90
sha256
26a448794681c19aacd49cb85d72154b9746d845b80959b1da2c407c70e0bb2c
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Config\Administrator\View\Application;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;

/**
 * View for the global configuration
 *
 * @since  3.2
 */
class HtmlView extends BaseHtmlView
{
    /**
     * The model state
     *
     * @var    \Joomla\CMS\Object\CMSObject
     * @since  3.2
     */
    public $state;

    /**
     * The form object
     *
     * @var    \Joomla\CMS\Form\Form
     * @since  3.2
     */
    public $form;

    /**
     * The data to be displayed in the form
     *
     * @var   array
     * @since 3.2
     */
    public $data;

    /**
     * Execute and display a template script.
     *
     * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
     *
     * @return  void
     *
     * @see     \JViewLegacy::loadTemplate()
     * @since   3.0
     */
    public function display($tpl = null)
    {
        try {
            // Load Form and Data
            $form = $this->get('form');
            $data = $this->get('data');
            $user = $this->getCurrentUser();
        } catch (\Exception $e) {
            Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');

            return;
        }

        // Bind data
        if ($form && $data) {
            $form->bind($data);
        }

        // Get the params for com_users.
        $usersParams = ComponentHelper::getParams('com_users');

        // Get the params for com_media.
        $mediaParams = ComponentHelper::getParams('com_media');

        $this->form        = &$form;
        $this->data        = &$data;
        $this->usersParams = &$usersParams;
        $this->mediaParams = &$mediaParams;
        $this->components  = ConfigHelper::getComponentsWithConfig();
        ConfigHelper::loadLanguageForComponents($this->components);

        $this->userIsSuperAdmin = $user->authorise('core.admin');

        $this->addToolbar();

        parent::display($tpl);
    }

    /**
     * Add the page title and toolbar.
     *
     * @return  void
     *
     * @since   3.2
     */
    protected function addToolbar()
    {
        ToolbarHelper::title(Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'), 'cog config');
        ToolbarHelper::apply('application.apply');
        ToolbarHelper::divider();
        ToolbarHelper::save('application.save');
        ToolbarHelper::divider();
        ToolbarHelper::cancel('application.cancel', 'JTOOLBAR_CLOSE');
        ToolbarHelper::divider();
        ToolbarHelper::inlinehelp();
        ToolbarHelper::help('Site_Global_Configuration');
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.