summaryrefslogtreecommitdiff
path: root/app/Controller/Webnotification.php
blob: a481e9b8ebd78ce9bdb1ee3657fcf190935513d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

namespace Controller;

/**
 * Web notification controller
 *
 * @package  controller
 * @author   Frederic Guillot
 */
class Webnotification extends Base
{
    /**
     * Mark all notifications as read
     *
     * @access public
     */
    public function flush()
    {
        $user_id = $this->userSession->getId();

        $this->webNotification->markAllAsRead($user_id);
        $this->response->redirect($this->helper->url->to('app', 'notifications', array('user_id' => $user_id)));
    }

    /**
     * Mark a notification as read
     *
     * @access public
     */
    public function remove()
    {
        $user_id = $this->userSession->getId();
        $notification_id = $this->request->getIntegerParam('notification_id');

        $this->webNotification->markAsRead($user_id, $notification_id);
        $this->response->redirect($this->helper->url->to('app', 'notifications', array('user_id' => $user_id)));
    }
}