[ 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_languages 6 * 7 * @copyright (C) 2008 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\Languages\Administrator\View\Languages; 12 13 use Joomla\CMS\Helper\ContentHelper; 14 use Joomla\CMS\Language\Text; 15 use Joomla\CMS\MVC\View\GenericDataException; 16 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 17 use Joomla\CMS\Toolbar\Toolbar; 18 use Joomla\CMS\Toolbar\ToolbarHelper; 19 20 // phpcs:disable PSR1.Files.SideEffects 21 \defined('_JEXEC') or die; 22 // phpcs:enable PSR1.Files.SideEffects 23 24 /** 25 * HTML Languages View class for the Languages component. 26 * 27 * @since 1.6 28 */ 29 class HtmlView extends BaseHtmlView 30 { 31 /** 32 * An array of items 33 * 34 * @var array 35 */ 36 protected $items; 37 38 /** 39 * The pagination object 40 * 41 * @var \Joomla\CMS\Pagination\Pagination 42 */ 43 protected $pagination; 44 45 /** 46 * The model state 47 * 48 * @var \Joomla\CMS\Object\CMSObject 49 * 50 * @since 4.0.0 51 */ 52 protected $state; 53 54 /** 55 * Form object for search filters 56 * 57 * @var \Joomla\CMS\Form\Form 58 * 59 * @since 4.0.0 60 */ 61 public $filterForm; 62 63 /** 64 * The active search filters 65 * 66 * @var array 67 * @since 4.0.0 68 */ 69 public $activeFilters; 70 71 /** 72 * Display the view. 73 * 74 * @param string $tpl The name of the template file to parse. 75 * 76 * @return void 77 */ 78 public function display($tpl = null) 79 { 80 $this->items = $this->get('Items'); 81 $this->pagination = $this->get('Pagination'); 82 $this->state = $this->get('State'); 83 $this->filterForm = $this->get('FilterForm'); 84 $this->activeFilters = $this->get('ActiveFilters'); 85 86 // Check for errors. 87 if (count($errors = $this->get('Errors'))) { 88 throw new GenericDataException(implode("\n", $errors), 500); 89 } 90 91 $this->addToolbar(); 92 93 parent::display($tpl); 94 } 95 96 /** 97 * Add the page title and toolbar. 98 * 99 * @return void 100 * 101 * @since 1.6 102 */ 103 protected function addToolbar(): void 104 { 105 $canDo = ContentHelper::getActions('com_languages'); 106 107 ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'comments langmanager'); 108 109 // Get the toolbar object instance 110 $toolbar = Toolbar::getInstance('toolbar'); 111 112 if ($canDo->get('core.create')) { 113 $toolbar->addNew('language.add'); 114 } 115 116 if ($canDo->get('core.edit.state')) { 117 $dropdown = $toolbar->dropdownButton('status-group') 118 ->text('JTOOLBAR_CHANGE_STATUS') 119 ->toggleSplit(false) 120 ->icon('icon-ellipsis-h') 121 ->buttonClass('btn btn-action') 122 ->listCheck(true); 123 124 $childBar = $dropdown->getChildToolbar(); 125 126 $childBar->publish('languages.publish')->listCheck(true); 127 $childBar->unpublish('languages.unpublish')->listCheck(true); 128 129 if ($this->state->get('filter.published') != -2) { 130 $childBar->trash('languages.trash')->listCheck(true); 131 } 132 } 133 134 if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { 135 $toolbar->delete('languages.delete') 136 ->text('JTOOLBAR_EMPTY_TRASH') 137 ->message('JGLOBAL_CONFIRM_DELETE') 138 ->listCheck(true); 139 } 140 141 if ($canDo->get('core.admin')) { 142 // Add install languages link to the lang installer component. 143 $bar = Toolbar::getInstance('toolbar'); 144 $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages'); 145 ToolbarHelper::divider(); 146 147 ToolbarHelper::preferences('com_languages'); 148 ToolbarHelper::divider(); 149 } 150 151 ToolbarHelper::help('Languages:_Content'); 152 } 153 }
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 |