[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Joomla.Administrator 4 * @subpackage com_media 5 * 6 * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\Component\Media\Administrator\View\Media; 11 12 \defined('_JEXEC') or die; 13 14 use Joomla\CMS\Application\CMSApplication; 15 use Joomla\CMS\Factory; 16 use Joomla\CMS\Language\Text; 17 use Joomla\CMS\Layout\FileLayout; 18 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 19 use Joomla\CMS\Router\Route; 20 use Joomla\CMS\Toolbar\Toolbar; 21 use Joomla\CMS\Toolbar\ToolbarHelper; 22 23 /** 24 * Media List View 25 * 26 * @since 4.0.0 27 */ 28 class HtmlView extends BaseHtmlView 29 { 30 /** 31 * Holds a list of providers 32 * 33 * @var array|string 34 * 35 * @since 4.0.0 36 */ 37 protected $providers = null; 38 39 /** 40 * The current path of the media manager 41 * 42 * @var string 43 * 44 * @since 4.0.0 45 */ 46 protected $currentPath; 47 48 /** 49 * Execute and display a template script. 50 * 51 * @param string $tpl The name of the template file to parse; 52 * automatically searches through the template paths. 53 * 54 * @return void 55 * 56 * @since 4.0.0 57 */ 58 public function display($tpl = null) 59 { 60 // Prepare the toolbar 61 $this->prepareToolbar(); 62 63 // Get enabled adapters 64 $this->providers = $this->get('Providers'); 65 66 // Check that there are providers 67 if (!count($this->providers)) 68 { 69 $link = Route::_('index.php?option=com_plugins&view=plugins&filter[folder]=filesystem'); 70 Factory::getApplication()->enqueueMessage(Text::sprintf('COM_MEDIA_ERROR_NO_PROVIDERS', $link), CMSApplication::MSG_WARNING); 71 } 72 73 $this->currentPath = Factory::getApplication()->input->getString('path'); 74 75 parent::display($tpl); 76 } 77 78 /** 79 * Prepare the toolbar. 80 * 81 * @return void 82 * 83 * @since 4.0.0 84 */ 85 protected function prepareToolbar() 86 { 87 $tmpl = Factory::getApplication()->input->getCmd('tmpl'); 88 89 // Get the toolbar object instance 90 $bar = Toolbar::getInstance('toolbar'); 91 $user = $this->getCurrentUser(); 92 93 // Set the title 94 ToolbarHelper::title(Text::_('COM_MEDIA'), 'images mediamanager'); 95 96 // Add the upload and create folder buttons 97 if ($user->authorise('core.create', 'com_media')) 98 { 99 // Add the upload button 100 $layout = new FileLayout('toolbar.upload', JPATH_COMPONENT_ADMINISTRATOR . '/layouts'); 101 102 $bar->appendButton('Custom', $layout->render([]), 'upload'); 103 ToolbarHelper::divider(); 104 105 // Add the create folder button 106 $layout = new FileLayout('toolbar.create-folder', JPATH_COMPONENT_ADMINISTRATOR . '/layouts'); 107 108 $bar->appendButton('Custom', $layout->render([]), 'new'); 109 ToolbarHelper::divider(); 110 } 111 112 // Add a delete button 113 if ($user->authorise('core.delete', 'com_media')) 114 { 115 // Instantiate a new FileLayout instance and render the layout 116 $layout = new FileLayout('toolbar.delete', JPATH_COMPONENT_ADMINISTRATOR . '/layouts'); 117 118 $bar->appendButton('Custom', $layout->render([]), 'delete'); 119 ToolbarHelper::divider(); 120 } 121 122 // Add the preferences button 123 if (($user->authorise('core.admin', 'com_media') || $user->authorise('core.options', 'com_media')) && $tmpl !== 'component') 124 { 125 ToolbarHelper::preferences('com_media'); 126 ToolbarHelper::divider(); 127 } 128 129 if ($tmpl !== 'component') 130 { 131 ToolbarHelper::help('Media'); 132 } 133 } 134 }
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 |