[ 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_finder 6 * 7 * @copyright (C) 2011 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\Finder\Administrator\View\Index; 12 13 use Joomla\CMS\Helper\ContentHelper; 14 use Joomla\CMS\Language\Multilanguage; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\MVC\View\GenericDataException; 17 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 18 use Joomla\CMS\Plugin\PluginHelper; 19 use Joomla\CMS\Toolbar\Toolbar; 20 use Joomla\CMS\Toolbar\ToolbarHelper; 21 use Joomla\Component\Finder\Administrator\Helper\FinderHelper; 22 use Joomla\Component\Finder\Administrator\Helper\LanguageHelper; 23 24 // phpcs:disable PSR1.Files.SideEffects 25 \defined('_JEXEC') or die; 26 // phpcs:enable PSR1.Files.SideEffects 27 28 /** 29 * Index view class for Finder. 30 * 31 * @since 2.5 32 */ 33 class HtmlView extends BaseHtmlView 34 { 35 /** 36 * An array of items 37 * 38 * @var array 39 * 40 * @since 3.6.1 41 */ 42 protected $items; 43 44 /** 45 * The pagination object 46 * 47 * @var \Joomla\CMS\Pagination\Pagination 48 * 49 * @since 3.6.1 50 */ 51 protected $pagination; 52 53 /** 54 * The state of core Smart Search plugins 55 * 56 * @var array 57 * 58 * @since 3.6.1 59 */ 60 protected $pluginState; 61 62 /** 63 * The id of the content - finder plugin in mysql 64 * 65 * @var integer 66 * 67 * @since 4.0.0 68 */ 69 protected $finderPluginId = 0; 70 71 /** 72 * The model state 73 * 74 * @var mixed 75 * 76 * @since 3.6.1 77 */ 78 protected $state; 79 80 /** 81 * The total number of items 82 * 83 * @var integer 84 * 85 * @since 3.6.1 86 */ 87 protected $total; 88 89 /** 90 * Form object for search filters 91 * 92 * @var \Joomla\CMS\Form\Form 93 * 94 * @since 4.0.0 95 */ 96 public $filterForm; 97 98 /** 99 * The active search filters 100 * 101 * @var array 102 * 103 * @since 4.0.0 104 */ 105 public $activeFilters; 106 107 /** 108 * @var mixed 109 * 110 * @since 4.0.0 111 */ 112 private $isEmptyState = false; 113 114 /** 115 * Method to display the view. 116 * 117 * @param string $tpl A template file to load. [optional] 118 * 119 * @return void 120 * 121 * @since 2.5 122 */ 123 public function display($tpl = null) 124 { 125 // Load plugin language files. 126 LanguageHelper::loadPluginLanguage(); 127 128 $this->items = $this->get('Items'); 129 $this->total = $this->get('Total'); 130 $this->pagination = $this->get('Pagination'); 131 $this->state = $this->get('State'); 132 $this->pluginState = $this->get('pluginState'); 133 $this->filterForm = $this->get('FilterForm'); 134 $this->activeFilters = $this->get('ActiveFilters'); 135 136 if ($this->get('TotalIndexed') === 0 && $this->isEmptyState = $this->get('IsEmptyState')) { 137 $this->setLayout('emptystate'); 138 } 139 140 // We do not need to filter by language when multilingual is disabled 141 if (!Multilanguage::isEnabled()) { 142 unset($this->activeFilters['language']); 143 $this->filterForm->removeField('language', 'filter'); 144 } 145 146 // Check for errors. 147 if (count($errors = $this->get('Errors'))) { 148 throw new GenericDataException(implode("\n", $errors), 500); 149 } 150 151 // Check that the content - finder plugin is enabled 152 if (!PluginHelper::isEnabled('content', 'finder')) { 153 $this->finderPluginId = FinderHelper::getFinderPluginId(); 154 } 155 156 // Configure the toolbar. 157 $this->addToolbar(); 158 159 parent::display($tpl); 160 } 161 162 /** 163 * Method to configure the toolbar for this view. 164 * 165 * @return void 166 * 167 * @since 2.5 168 */ 169 protected function addToolbar() 170 { 171 $canDo = ContentHelper::getActions('com_finder'); 172 173 // Get the toolbar object instance 174 $toolbar = Toolbar::getInstance('toolbar'); 175 176 ToolbarHelper::title(Text::_('COM_FINDER_INDEX_TOOLBAR_TITLE'), 'search-plus finder'); 177 178 $toolbar->appendButton( 179 'Popup', 180 'archive', 181 'COM_FINDER_INDEX', 182 'index.php?option=com_finder&view=indexer&tmpl=component', 183 500, 184 210, 185 0, 186 0, 187 'window.parent.location.reload()', 188 Text::_('COM_FINDER_HEADING_INDEXER') 189 ); 190 191 if (!$this->isEmptyState) { 192 if ($canDo->get('core.edit.state')) { 193 $dropdown = $toolbar->dropdownButton('status-group') 194 ->text('JTOOLBAR_CHANGE_STATUS') 195 ->toggleSplit(false) 196 ->icon('icon-ellipsis-h') 197 ->buttonClass('btn btn-action') 198 ->listCheck(true); 199 200 $childBar = $dropdown->getChildToolbar(); 201 202 $childBar->publish('index.publish')->listCheck(true); 203 $childBar->unpublish('index.unpublish')->listCheck(true); 204 } 205 206 $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350, '', '', '', Text::_('COM_FINDER_STATISTICS_TITLE')); 207 208 if ($canDo->get('core.delete')) { 209 $toolbar->confirmButton('', 'JTOOLBAR_DELETE', 'index.delete') 210 ->icon('icon-delete') 211 ->message('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT') 212 ->listCheck(true); 213 $toolbar->divider(); 214 } 215 216 if ($canDo->get('core.edit.state')) { 217 $dropdown = $toolbar->dropdownButton('maintenance-group'); 218 $dropdown->text('COM_FINDER_INDEX_TOOLBAR_MAINTENANCE') 219 ->toggleSplit(false) 220 ->icon('icon-wrench') 221 ->buttonClass('btn btn-action'); 222 223 $childBar = $dropdown->getChildToolbar(); 224 225 $childBar->standardButton('cog', 'COM_FINDER_INDEX_TOOLBAR_OPTIMISE', 'index.optimise', false); 226 $childBar->confirmButton('index.purge', 'COM_FINDER_INDEX_TOOLBAR_PURGE', 'index.purge') 227 ->icon('icon-trash') 228 ->message('COM_FINDER_INDEX_CONFIRM_PURGE_PROMPT'); 229 } 230 } 231 232 if ($canDo->get('core.admin') || $canDo->get('core.options')) { 233 ToolbarHelper::preferences('com_finder'); 234 } 235 236 ToolbarHelper::help('Smart_Search:_Indexed_Content'); 237 } 238 }
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 |