implement MailAgent and use it for user and Character registration
This commit is contained in:
parent
082f38ef49
commit
7c10592f6b
8 changed files with 183 additions and 31 deletions
85
controllers/MailController.inc
Normal file
85
controllers/MailController.inc
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Controller of the MailAgent to generate a mail message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailController extends \nre\core\Controller
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter.
|
||||
*
|
||||
* @param Request $request Current request
|
||||
* @param Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
|
||||
// Set linker
|
||||
$this->set('linker', ($request instanceof \hhu\z\requests\MailRequest && !is_null($request->getLinker())) ? $request->getLinker() : null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: userregistration.
|
||||
*
|
||||
* Generate a mail message to notify of a new user registration.
|
||||
*
|
||||
* @param array $receiver User that the message will be send to
|
||||
* @param array $neUser Newly registered user
|
||||
*/
|
||||
public function userregistration($receiver, $newUser)
|
||||
{
|
||||
// Set subject
|
||||
$this->response->setSubject(_('New user registration'));
|
||||
|
||||
|
||||
// Pass data to view
|
||||
$this->set('user', $newUser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: characterregistration.
|
||||
*
|
||||
* Generate a mail message to notify of a new Character
|
||||
* registration.
|
||||
*
|
||||
* @param array $receiver User that the message will be send to
|
||||
* @param array $seminary Seminary which the Character was created for
|
||||
* @param array $newCharacter Newly registered user
|
||||
*/
|
||||
public function characterregistration($receiver, $seminary, $user, $newCharacter)
|
||||
{
|
||||
// Set subject
|
||||
$this->response->setSubject(_('New Character registration'));
|
||||
|
||||
|
||||
// Pass data to view
|
||||
$this->set('seminary', $seminary);
|
||||
$this->set('user', $user);
|
||||
$this->set('character', $newCharacter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue