Skip to content

Commit

Permalink
Namespace controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Apr 14, 2019
1 parent 13378fd commit 9782f52
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 87 deletions.
Expand Up @@ -7,14 +7,20 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Privacy\Administrator\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;

/**
* Consents management controller class.
*
* @since 3.9.0
*/
class PrivacyControllerConsents extends JControllerForm
class ConsentsController extends FormController
{
/**
* Method to invalidate specific consents.
Expand All @@ -26,13 +32,13 @@ class PrivacyControllerConsents extends JControllerForm
public function invalidate($key = null, $urlVar = null)
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$this->checkToken();

$ids = $this->input->get('cid', array(), 'array');
$ids = $this->input->get('cid', [], 'array');

if (empty($ids))
{
$this->setError(JText::_('JERROR_NO_ITEMS_SELECTED'));
$this->setError(Text::_('JERROR_NO_ITEMS_SELECTED'));
}
else
{
Expand All @@ -46,10 +52,10 @@ public function invalidate($key = null, $urlVar = null)
$this->setError($model->getError());
}

$message = JText::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids));
$message = Text::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids));
}

$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=consents', false), $message);
$this->setRedirect(Route::_('index.php?option=com_privacy&view=consents', false), $message);
}

/**
Expand All @@ -62,17 +68,17 @@ public function invalidate($key = null, $urlVar = null)
public function invalidateAll()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$this->checkToken();

$filters = $this->input->get('filter', array(), 'array');
$filters = $this->input->get('filter', [], 'array');

if (isset($filters['subject']) && $filters['subject'] != '')
{
$subject = $filters['subject'];
}
else
{
$this->setError(JText::_('JERROR_NO_ITEMS_SELECTED'));
$this->setError(Text::_('JERROR_NO_ITEMS_SELECTED'));
}

// Get the model.
Expand All @@ -85,8 +91,8 @@ public function invalidateAll()
$this->setError($model->getError());
}

$message = JText::_('COM_PRIVACY_CONSENTS_INVALIDATED_ALL');
$message = Text::_('COM_PRIVACY_CONSENTS_INVALIDATED_ALL');

$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=consents', false), $message);
$this->setRedirect(Route::_('index.php?option=com_privacy&view=consents', false), $message);
}
}

0 comments on commit 9782f52

Please sign in to comment.