blob: a62da0e373dbb9b8c3f8a9cc58f6f4d56f56a18a (
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
40
41
42
43
44
45
46
47
48
49
50
|
<?php
namespace Kanboard\Controller;
/**
* Web notification controller
*
* @package controller
* @author Frederic Guillot
*/
class WebNotification extends BaseController
{
/**
* Mark all notifications as read
*
* @access public
*/
public function flush()
{
$user_id = $this->getUserId();
$this->userUnreadNotification->markAllAsRead($user_id);
$this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id)));
}
/**
* Mark a notification as read
*
* @access public
*/
public function remove()
{
$user_id = $this->getUserId();
$notification_id = $this->request->getIntegerParam('notification_id');
$this->userUnreadNotification->markAsRead($user_id, $notification_id);
$this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id)));
}
private function getUserId()
{
$user_id = $this->request->getIntegerParam('user_id');
if (! $this->userSession->isAdmin() && $user_id != $this->userSession->getId()) {
$user_id = $this->userSession->getId();
}
return $user_id;
}
}
|