use NotificationComponent to notify of new Achievements and Level-ups and show them in HTML-layout view (Issue #128)
This commit is contained in:
parent
87fe1f9754
commit
fc35d5fdc2
4 changed files with 61 additions and 4 deletions
|
|
@ -19,6 +19,12 @@
|
|||
*/
|
||||
class HtmlController extends \hhu\z\Controller
|
||||
{
|
||||
/**
|
||||
* Required components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('notification');
|
||||
|
||||
|
||||
|
||||
|
|
@ -52,6 +58,9 @@
|
|||
$this->set('loggedUser', IntermediateController::$user);
|
||||
$this->set('loggedSeminary', SeminaryController::$seminary);
|
||||
$this->set('loggedCharacter', SeminaryController::$character);
|
||||
|
||||
// Set notifications
|
||||
$this->set('notifications', $this->Notification->getNotifications());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -600,6 +600,16 @@
|
|||
{
|
||||
// Mark Quest as solved
|
||||
$this->Quests->setQuestSolved($quest['id'], $character['id']);
|
||||
|
||||
// Notify of XP-level change
|
||||
$newXPLevel = $this->Characters->getXPLevelOfCharacters($character['id']);
|
||||
if($newXPLevel['level'] > $character['xplevel']) {
|
||||
$this->Notification->addNotification(
|
||||
\hhu\z\controllers\components\NotificationComponent::TYPE_LEVELUP,
|
||||
$newXPLevel['level'],
|
||||
$this->linker->link(array('characters', 'character', $seminary['url'], $character['url']))
|
||||
);
|
||||
}
|
||||
|
||||
// Redirect
|
||||
$this->redirect($this->linker->link(array(), 5, true, array('status'=>'solved'), false, 'task'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue