add e?mail notifcation for approved Quests (resolves issue #298)
This commit is contained in:
parent
66ce3caee3
commit
26ccbc61e0
6 changed files with 78 additions and 6 deletions
|
|
@ -106,6 +106,30 @@
|
|||
$this->set('character', $character);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: charactersubmissionapproved.
|
||||
*
|
||||
* Generate a mail message to notify a Character that its
|
||||
* submission has been approved.
|
||||
*
|
||||
* @param array $receiver User that the message will be send to
|
||||
* @param array $seminary Seminary which the Quest belongs to
|
||||
* @param array $questgroup Questgroup of Quest
|
||||
* @param array $quest Quest the answer has been submitted for
|
||||
*/
|
||||
public function charactersubmissionapproved($receiver, $seminary, $questgroup, $quest)
|
||||
{
|
||||
// Set subject
|
||||
$this->response->setSubject(_('Character submission approved'));
|
||||
|
||||
|
||||
// Pass data to view
|
||||
$this->set('seminary', $seminary);
|
||||
$this->set('questgroup', $questgroup);
|
||||
$this->set('quest', $quest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -746,6 +746,9 @@
|
|||
// Save additional data for Character answers
|
||||
$questtypeAgent->controller->saveDataForCharacterAnswers($seminary, $questgroup, $quest, $character, $this->request->getPostParam('characterdata'));
|
||||
|
||||
// Send notification
|
||||
$this->sendSubmissionApprovedMail($character, $seminary, $questgroup, $quest);
|
||||
|
||||
// Redirect
|
||||
$this->redirect($this->linker->link(array('submissions', $seminary['url'], $questgroup['url'], $quest['url']), 1));
|
||||
}
|
||||
|
|
@ -890,6 +893,40 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send mail for approval of a Character submission.
|
||||
*
|
||||
* @param array $character Character of submission that has been approved
|
||||
* @param array $seminary Seminary which the Quest belongs to
|
||||
* @param array $questgroup Questgroup of Quest
|
||||
* @param array $quest Quest the submission has been approved for
|
||||
*/
|
||||
private function sendSubmissionApprovedMail($character, $seminary, $questgroup, $quest)
|
||||
{
|
||||
// Get user
|
||||
$user = $this->Users->getUserById($character['user_id']);
|
||||
|
||||
// Send notification mail
|
||||
try {
|
||||
\hhu\z\Utils::sendMail(
|
||||
$user['email'],
|
||||
'charactersubmissionapproved',
|
||||
true,
|
||||
array(
|
||||
$user,
|
||||
$seminary,
|
||||
$questgroup,
|
||||
$quest
|
||||
),
|
||||
$this->linker
|
||||
);
|
||||
}
|
||||
catch(\hhu\z\exceptions\MailingException $e) {
|
||||
$this->log($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: The Legend of Z\n"
|
||||
"POT-Creation-Date: 2014-05-27 10:48+0100\n"
|
||||
"PO-Revision-Date: 2014-05-27 10:52+0100\n"
|
||||
"POT-Creation-Date: 2014-05-27 11:27+0100\n"
|
||||
"PO-Revision-Date: 2014-05-27 11:28+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: de_DE\n"
|
||||
|
|
@ -59,6 +59,10 @@ msgstr "Neue Charakterregistrierung"
|
|||
msgid "New Character submission"
|
||||
msgstr "Neuer Lösungsvorschlag"
|
||||
|
||||
#: controllers/MailController.inc:124
|
||||
msgid "Character submission approved"
|
||||
msgstr "Lösungsvorschlag bewertet"
|
||||
|
||||
#: controllers/QuestsController.inc:735
|
||||
#: questtypes/submit/html/submission.tpl:30 views/html/quests/quest.tpl:45
|
||||
#: views/html/quests/submissions.tpl:30
|
||||
|
|
@ -1344,6 +1348,13 @@ msgstr ""
|
|||
"Der Charakter „%s“ hat einen neuen Lösungsvorschlag für die Quest „%s“ des "
|
||||
"Seminars „%s“ eingereicht"
|
||||
|
||||
#: views/htmlmail/mail/charactersubmissionapproved.tpl:1
|
||||
#: views/textmail/mail/charactersubmissionapproved.tpl:1
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your submission for the Quest “%s” of the Seminary “%s” has been approved"
|
||||
msgstr "Deine Lösung für die Quest „%s“ des Seminars „%s“ wurde bewertet"
|
||||
|
||||
#: views/htmlmail/mail/userregistration.tpl:1
|
||||
#: views/textmail/mail/userregistration.tpl:1
|
||||
msgid "A new user has been registered"
|
||||
|
|
@ -1355,10 +1366,6 @@ msgstr "Ein neuer Benutzer wurde registriert"
|
|||
msgid "Hello %s"
|
||||
msgstr "Hallo %s"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Character submission solved"
|
||||
#~ msgstr "gelöst"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Dear %s"
|
||||
#~ msgstr "erstellt von %s am %s um %s Uhr"
|
||||
|
|
|
|||
2
views/htmlmail/mail/charactersubmissionapproved.tpl
Normal file
2
views/htmlmail/mail/charactersubmissionapproved.tpl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<?=sprintf(_('Your submission for the Quest “%s” of the Seminary “%s” has been approved'), $quest['title'], $seminary['title'])?>:
|
||||
<?php if(!is_null($linker)) : ?><a href="<?=$linker->link(array('quests','quest',$seminary['url'],$questgroup['url'],$quest['url']),0,true,null,false,null,true)?>"><?=$seminary['title']?>/<?=$questgroup['title']?>/<?=$quest['title']?></a><?php else : ?><?=$seminary['title']?>/<?=$questgroup['title']?>/<?=$quest['title']?><?php endif ?>
|
||||
2
views/textmail/mail/charactersubmissionapproved.tpl
Normal file
2
views/textmail/mail/charactersubmissionapproved.tpl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<?=sprintf(_('Your submission for the Quest “%s” of the Seminary “%s” has been approved'), $quest['title'], $seminary['title'])?>.
|
||||
<?php if(!is_null($linker)) : ?><?=$linker->link(array('quests','quest',$seminary['url'],$questgroup['url'],$quest['url']),0,true,null,false,null,true)?><?php endif ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue