This repository has been archived by the owner on Feb 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Frontend Information Request Processing (#33)
* Remove ACL check, this will be done in controllers * Add frontend form for confirming information requests * Handle confirming an information request * Use renderField * Add view for submitting info requests for authenticated frontend users * Add menu items for the component frontend views
- Loading branch information
Michael Babker
authored
May 16, 2018
1 parent
41ab30c
commit 5ce62f6
Showing
19 changed files
with
1,087 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Site | ||
* @subpackage com_privacy | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Request action controller class. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class PrivacyControllerRequest extends JControllerLegacy | ||
{ | ||
/** | ||
* Method to confirm the information request. | ||
* | ||
* @return boolean | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function confirm() | ||
{ | ||
// Check the request token. | ||
$this->checkToken('post'); | ||
|
||
/** @var PrivacyModelConfirm $model */ | ||
$model = $this->getModel('Confirm', 'PrivacyModel'); | ||
$data = $this->input->post->get('jform', array(), 'array'); | ||
|
||
$return = $model->confirmRequest($data); | ||
|
||
// Check for a hard error. | ||
if ($return instanceof Exception) | ||
{ | ||
// Get the error message to display. | ||
if (JFactory::getApplication()->get('error_reporting')) | ||
{ | ||
$message = $return->getMessage(); | ||
} | ||
else | ||
{ | ||
$message = JText::_('COM_PRIVACY_ERROR_CONFIRMING_REQUEST'); | ||
} | ||
|
||
// Go back to the confirm form. | ||
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=confirm', false), $message, 'error'); | ||
|
||
return false; | ||
} | ||
elseif ($return === false) | ||
{ | ||
// Confirm failed. | ||
// Go back to the confirm form. | ||
$message = JText::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REQUEST_FAILED', $model->getError()); | ||
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=confirm', false), $message, 'notice'); | ||
|
||
return false; | ||
} | ||
else | ||
{ | ||
// Confirm succeeded. | ||
$this->setRedirect(JRoute::_(JUri::root()), JText::_('COM_PRIVACY_CONFIRM_REQUEST_SUCCEEDED'), 'info'); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
/** | ||
* Method to submit an information request. | ||
* | ||
* @return boolean | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function submit() | ||
{ | ||
// Check the request token. | ||
$this->checkToken('post'); | ||
|
||
/** @var PrivacyModelRequest $model */ | ||
$model = $this->getModel('Request', 'PrivacyModel'); | ||
$data = $this->input->post->get('jform', array(), 'array'); | ||
|
||
$return = $model->createRequest($data); | ||
|
||
// Check for a hard error. | ||
if ($return instanceof Exception) | ||
{ | ||
// Get the error message to display. | ||
if (JFactory::getApplication()->get('error_reporting')) | ||
{ | ||
$message = $return->getMessage(); | ||
} | ||
else | ||
{ | ||
$message = JText::_('COM_PRIVACY_ERROR_CREATING_REQUEST'); | ||
} | ||
|
||
// Go back to the confirm form. | ||
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=request', false), $message, 'error'); | ||
|
||
return false; | ||
} | ||
elseif ($return === false) | ||
{ | ||
// Confirm failed. | ||
// Go back to the confirm form. | ||
$message = JText::sprintf('COM_PRIVACY_ERROR_CREATING_REQUEST_FAILED', $model->getError()); | ||
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=request', false), $message, 'notice'); | ||
|
||
return false; | ||
} | ||
else | ||
{ | ||
// Confirm succeeded. | ||
$this->setRedirect(JRoute::_(JUri::root()), JText::_('COM_PRIVACY_CREATE_REQUEST_SUCCEEDED'), 'info'); | ||
|
||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.