[ 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_privacy 6 * 7 * @copyright (C) 2018 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\Privacy\Administrator\View\Consents; 12 13 use Joomla\CMS\Form\Form; 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\Object\CMSObject; 18 use Joomla\CMS\Pagination\Pagination; 19 use Joomla\CMS\Toolbar\Toolbar; 20 use Joomla\CMS\Toolbar\ToolbarHelper; 21 use Joomla\Component\Privacy\Administrator\Model\ConsentsModel; 22 23 // phpcs:disable PSR1.Files.SideEffects 24 \defined('_JEXEC') or die; 25 // phpcs:enable PSR1.Files.SideEffects 26 27 /** 28 * Consents view class 29 * 30 * @since 3.9.0 31 */ 32 class HtmlView extends BaseHtmlView 33 { 34 /** 35 * The active search tools filters 36 * 37 * @var array 38 * @since 3.9.0 39 * @note Must be public to be accessed from the search tools layout 40 */ 41 public $activeFilters; 42 43 /** 44 * Form instance containing the search tools filter form 45 * 46 * @var Form 47 * @since 3.9.0 48 * @note Must be public to be accessed from the search tools layout 49 */ 50 public $filterForm; 51 52 /** 53 * The items to display 54 * 55 * @var array 56 * @since 3.9.0 57 */ 58 protected $items; 59 60 /** 61 * The pagination object 62 * 63 * @var Pagination 64 * @since 3.9.0 65 */ 66 protected $pagination; 67 68 /** 69 * The state information 70 * 71 * @var CMSObject 72 * @since 3.9.0 73 */ 74 protected $state; 75 76 /** 77 * Is this view an Empty State 78 * 79 * @var boolean 80 * @since 4.0.0 81 */ 82 private $isEmptyState = false; 83 84 /** 85 * Execute and display a template script. 86 * 87 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 88 * 89 * @return void 90 * 91 * @see BaseHtmlView::loadTemplate() 92 * @since 3.9.0 93 * @throws \Exception 94 */ 95 public function display($tpl = null) 96 { 97 /** @var ConsentsModel $model */ 98 $model = $this->getModel(); 99 $this->items = $model->getItems(); 100 $this->pagination = $model->getPagination(); 101 $this->state = $model->getState(); 102 $this->filterForm = $model->getFilterForm(); 103 $this->activeFilters = $model->getActiveFilters(); 104 105 if (!count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) { 106 $this->setLayout('emptystate'); 107 } 108 109 // Check for errors. 110 if (count($errors = $this->get('Errors'))) { 111 throw new Genericdataexception(implode("\n", $errors), 500); 112 } 113 114 $this->addToolbar(); 115 116 parent::display($tpl); 117 } 118 119 /** 120 * Add the page title and toolbar. 121 * 122 * @return void 123 * 124 * @since 3.9.0 125 */ 126 protected function addToolbar() 127 { 128 ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CONSENTS'), 'lock'); 129 130 $bar = Toolbar::getInstance('toolbar'); 131 132 // Add a button to invalidate a consent 133 if (!$this->isEmptyState) { 134 $bar->appendButton( 135 'Confirm', 136 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_CONFIRM_MSG', 137 'trash', 138 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE', 139 'consents.invalidate', 140 true 141 ); 142 } 143 144 // If the filter is restricted to a specific subject, show the "Invalidate all" button 145 if ($this->state->get('filter.subject') != '') { 146 $bar->appendButton( 147 'Confirm', 148 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL_CONFIRM_MSG', 149 'cancel', 150 'COM_PRIVACY_CONSENTS_TOOLBAR_INVALIDATE_ALL', 151 'consents.invalidateAll', 152 false 153 ); 154 } 155 156 ToolbarHelper::preferences('com_privacy'); 157 158 ToolbarHelper::help('Privacy:_Consents'); 159 } 160 }
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 |