[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_mails 6 * 7 * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Mails\Administrator\View\Templates; 12 13 use Joomla\CMS\Component\ComponentHelper; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Form\Form; 16 use Joomla\CMS\Language\Text; 17 use Joomla\CMS\MVC\View\GenericDataException; 18 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 19 use Joomla\CMS\Object\CMSObject; 20 use Joomla\CMS\Pagination\Pagination; 21 use Joomla\CMS\Toolbar\Toolbar; 22 use Joomla\CMS\Toolbar\ToolbarHelper; 23 use Joomla\Component\Mails\Administrator\Helper\MailsHelper; 24 25 // phpcs:disable PSR1.Files.SideEffects 26 \defined('_JEXEC') or die; 27 // phpcs:enable PSR1.Files.SideEffects 28 29 /** 30 * View for the mail templates configuration 31 * 32 * @since 4.0.0 33 */ 34 class HtmlView extends BaseHtmlView 35 { 36 /** 37 * An array of items 38 * 39 * @var array 40 */ 41 protected $items; 42 43 /** 44 * An array of installed languages 45 * 46 * @var array 47 */ 48 protected $languages; 49 50 /** 51 * Site default language 52 * 53 * @var \stdClass 54 */ 55 protected $defaultLanguage; 56 57 /** 58 * The pagination object 59 * 60 * @var Pagination 61 */ 62 protected $pagination; 63 64 /** 65 * The model state 66 * 67 * @var CMSObject 68 */ 69 protected $state; 70 71 /** 72 * Form object for search filters 73 * 74 * @var Form 75 */ 76 public $filterForm; 77 78 /** 79 * The active search filters 80 * 81 * @var array 82 */ 83 public $activeFilters; 84 85 /** 86 * Execute and display a template script. 87 * 88 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 89 * 90 * @return void 91 * 92 * @since 4.0.0 93 */ 94 public function display($tpl = null) 95 { 96 $this->items = $this->get('Items'); 97 $this->languages = $this->get('Languages'); 98 $this->pagination = $this->get('Pagination'); 99 $this->state = $this->get('State'); 100 $this->filterForm = $this->get('FilterForm'); 101 $this->activeFilters = $this->get('ActiveFilters'); 102 $extensions = $this->get('Extensions'); 103 104 // Check for errors. 105 if (count($errors = $this->get('Errors'))) { 106 throw new GenericDataException(implode("\n", $errors), 500); 107 } 108 109 // Find and set site default language 110 $defaultLanguageTag = ComponentHelper::getParams('com_languages')->get('site'); 111 112 foreach ($this->languages as $tag => $language) { 113 if ($tag === $defaultLanguageTag) { 114 $this->defaultLanguage = $language; 115 break; 116 } 117 } 118 119 foreach ($extensions as $extension) { 120 MailsHelper::loadTranslationFiles($extension); 121 } 122 123 $this->addToolbar(); 124 125 parent::display($tpl); 126 } 127 128 /** 129 * Add the page title and toolbar. 130 * 131 * @return void 132 * 133 * @since 4.0.0 134 */ 135 protected function addToolbar() 136 { 137 // Get the toolbar object instance 138 $toolbar = Toolbar::getInstance('toolbar'); 139 $user = $this->getCurrentUser(); 140 141 ToolbarHelper::title(Text::_('COM_MAILS_MAILS_TITLE'), 'envelope'); 142 143 if ($user->authorise('core.admin', 'com_mails') || $user->authorise('core.options', 'com_mails')) { 144 $toolbar->preferences('com_mails'); 145 } 146 147 $toolbar->help('Mail_Templates'); 148 } 149 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |