- md5
- cb70e637a10cb0f9e8c44b73bcdd0dad
- sha1
- 2d0730000bc662f93664155077798c381b6731b4
- sha256
- 83c3197a52b30ae8b2cea9f19688935582bd07c13a94a79bd89d1525fbdf2402
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
<?php
/**
* @package Joomla.Administrator
* @subpackage com_privacy
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Privacy\Administrator\View\Consents;
\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\Privacy\Administrator\Model\ConsentsModel;
/**
* Consents view class
*
* @since 3.9.0
*/
class HtmlView extends BaseHtmlView
{
/**
* The active search tools filters
*
* @var array
* @since 3.9.0
* @note Must be public to be accessed from the search tools layout
*/
public $activeFilters;
/**
* Form instance containing the search tools filter form
*
* @var Form
* @since 3.9.0
* @note Must be public to be accessed from the search tools layout
*/
public $filterForm;
/**
* The items to display
*
* @var array
* @since 3.9.0
*/
protected $items;
/**
* The pagination object
*
* @var Pagination
* @since 3.9.0
*/
protected $pagination;
/**
* The state information
*
* @var CMSObject
* @since 3.9.0
*/
protected $state;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @see BaseHtmlView::loadTemplate()
* @since 3.9.0
* @throws \Exception
*/
public function display($tpl = null)
{
/** @var ConsentsModel $model */
$model = $this->getModel();
$this->items = $model->getItems();
$this->pagination = $model->getPagination();
$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);
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.9.0
*/
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CONSENTS'), 'lock');
$bar = Toolbar::getInstance('toolbar');
// Add a button to invalidate a consent
$bar->appendButton(
'Confirm',
'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_CONFIRM_MSG',
'trash',
'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE',
'consents.invalidate',
true
);
// If the filter is restricted to a specific subject, show the "Invalidate all" button
if ($this->state->get('filter.subject') != '')
{
$bar->appendButton(
'Confirm',
'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL_CONFIRM_MSG',
'cancel',
'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL',
'consents.invalidateAll',
false
);
}
ToolbarHelper::preferences('com_privacy');
ToolbarHelper::help('JHELP_COMPONENTS_PRIVACY_CONSENTS');
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.