[ 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\Controller; 12 13 use Joomla\CMS\Application\CMSApplication; 14 use Joomla\CMS\Language\Text; 15 use Joomla\CMS\MVC\Controller\FormController; 16 use Joomla\CMS\Router\Route; 17 use Joomla\Component\Privacy\Administrator\Model\ConsentsModel; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('_JEXEC') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * Consents management controller class. 25 * 26 * @since 3.9.0 27 */ 28 class ConsentsController extends FormController 29 { 30 /** 31 * Method to invalidate specific consents. 32 * 33 * @return void 34 * 35 * @since 3.9.0 36 */ 37 public function invalidate() 38 { 39 // Check for request forgeries 40 $this->checkToken(); 41 42 $ids = (array) $this->input->get('cid', [], 'int'); 43 44 // Remove zero values resulting from input filter 45 $ids = array_filter($ids); 46 47 if (empty($ids)) { 48 $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), CMSApplication::MSG_ERROR); 49 } else { 50 /** @var ConsentsModel $model */ 51 $model = $this->getModel(); 52 53 if (!$model->invalidate($ids)) { 54 $this->setMessage($model->getError()); 55 } else { 56 $this->setMessage(Text::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids))); 57 } 58 } 59 60 $this->setRedirect(Route::_('index.php?option=com_privacy&view=consents', false)); 61 } 62 63 /** 64 * Method to invalidate all consents of a specific subject. 65 * 66 * @return void 67 * 68 * @since 3.9.0 69 */ 70 public function invalidateAll() 71 { 72 // Check for request forgeries 73 $this->checkToken(); 74 75 $filters = $this->input->get('filter', [], 'array'); 76 77 $this->setRedirect(Route::_('index.php?option=com_privacy&view=consents', false)); 78 79 if (isset($filters['subject']) && $filters['subject'] != '') { 80 $subject = $filters['subject']; 81 } else { 82 $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED')); 83 84 return; 85 } 86 87 /** @var ConsentsModel $model */ 88 $model = $this->getModel(); 89 90 if (!$model->invalidateAll($subject)) { 91 $this->setMessage($model->getError()); 92 } 93 94 $this->setMessage(Text::_('COM_PRIVACY_CONSENTS_INVALIDATED_ALL')); 95 } 96 }
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 |