- md5
- a55054ffd199c4e0bdc6efa00bce9d54
- sha1
- b1623805b2f36a562715f19b4809341d8c1f879e
- sha256
- da4943886db6680f97f4b628bba835f347ded25ece7d7d858a351a75b8ce51e2
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
<?php
/**
* @package Joomla.Administrator
* @subpackage com_cache
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Cache\Administrator\View\Cache;
\defined('_JEXEC') or die;
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;
use Joomla\Component\Cache\Administrator\Model\CacheModel;
/**
* HTML View class for the Cache component
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* The search tools form
*
* @var Form
* @since 1.6
*/
public $filterForm;
/**
* The active search filters
*
* @var array
* @since 1.6
*/
public $activeFilters = [];
/**
* The cache data
*
* @var array
* @since 1.6
*/
protected $data = [];
/**
* The pagination object
*
* @var Pagination
* @since 1.6
*/
protected $pagination;
/**
* Total number of cache groups
*
* @var integer
* @since 1.6
*/
protected $total = 0;
/**
* The model state
*
* @var CMSObject
* @since 1.6
*/
protected $state;
/**
* Display a view.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 1.6
*
* @throws GenericDataException
*/
public function display($tpl = null): void
{
/** @var CacheModel $model */
$model = $this->getModel();
$this->data = $model->getData();
$this->pagination = $model->getPagination();
$this->total = $model->getTotal();
$this->state = $model->getState();
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
// Check for errors.
if (\count($errors = $this->get('Errors')))
{
throw new GenericDataException(implode("\n", $errors), 500);
}
if (!\count($this->data))
{
$this->setLayout('emptystate');
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_CACHE_CLEAR_CACHE'), 'bolt clear');
// Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar');
if (\count($this->data))
{
$toolbar->delete('delete')
->listCheck(true);
$toolbar->confirmButton('delete', 'JTOOLBAR_DELETE_ALL', 'deleteAll')
->icon('icon-remove')
->listCheck(false)
->buttonClass('button-remove btn btn-primary');
$toolbar->confirmButton('delete', 'COM_CACHE_PURGE_EXPIRED', 'purge')
->name('delete')
->message('COM_CACHE_RESOURCE_INTENSIVE_WARNING');
$toolbar->divider();
}
if ($this->getCurrentUser()->authorise('core.admin', 'com_cache'))
{
$toolbar->preferences('com_cache');
$toolbar->divider();
}
$toolbar->help('Maintenance:_Clear_Cache');
}
}
No other release has this exact content. See every version of this file.