- md5
- 77d765ce9c751b9ffb031af7942507a8
- sha1
- 73bb03f21c17ff559105a697eb9660d87418b283
- sha256
- fda377ec6dbcce32f98d5fdbf39f524a38cc016ee28f214fc1bb4ee25ed3d77a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
<?php
/**
* @package Joomla.Administrator
* @subpackage com_mails
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Mails\Administrator\View\Templates;
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
/**
* View for the mail templates configuration
*
* @since 4.0.0
*/
class HtmlView extends BaseHtmlView
{
/**
* An array of items
*
* @var array
*/
protected $items;
/**
* An array of installed languages
*
* @var array
*/
protected $languages;
/**
* The pagination object
*
* @var Pagination
*/
protected $pagination;
/**
* The model state
*
* @var CMSObject
*/
protected $state;
/**
* Form object for search filters
*
* @var Form
*/
public $filterForm;
/**
* The active search filters
*
* @var array
*/
public $activeFilters;
/**
* 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
*
* @since 4.0.0
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->languages = $this->get('Languages');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new GenericDataException(implode("\n", $errors), 500);
}
$cache = array();
$language = Factory::getLanguage();
foreach ($this->items as $item)
{
list($component, $template_id) = explode('.', $item->template_id, 2);
if (isset($cache[$component]))
{
continue;
}
$language->load($component, JPATH_ADMINISTRATOR);
$cache[$component] = true;
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 4.0.0
*/
protected function addToolbar()
{
// Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar');
$user = Factory::getUser();
ToolbarHelper::title(Text::_('COM_MAILS_MAILS_TITLE'), 'envelope');
if ($user->authorise('core.admin', 'com_mails') || $user->authorise('core.options', 'com_mails'))
{
$toolbar->preferences('com_mails');
}
$toolbar->help('JHELP_COMPONENTS_MAILS_TEMPLATES');
}
}
No other release has this exact content. See every version of this file.