17 import(
'lib.pkp.classes.controllers.grid.GridHandler');
20 import(
'lib.pkp.controllers.grid.notifications.NotificationsGridCellProvider');
31 parent::initialize($request, $args);
34 $this->_selectedNotificationIds = (array) $request->getUserVar(
'selectedNotificationIds');
44 array(
'anyhtml' =>
true,
45 'alignment' => COLUMN_ALIGNMENT_LEFT)
52 import(
'lib.pkp.classes.linkAction.request.NullAction');
57 __(
'grid.action.markNew'),
60 GRID_ACTION_POSITION_BELOW
66 __(
'grid.action.markRead'),
69 GRID_ACTION_POSITION_BELOW
72 $router = $request->getRouter();
77 __(
'grid.action.delete'),
80 GRID_ACTION_POSITION_BELOW
92 return '$.pkp.controllers.grid.notifications.NotificationsGridHandler';
98 function setUrls($request, $extraUrls = array()) {
99 $router = $request->getRouter();
105 'markNewUrl' => $router->url($request,
null,
null,
'markNew',
null, $this->getRequestArgs()),
106 'markReadUrl' => $router->url($request,
null,
null,
'markRead',
null, $this->getRequestArgs()),
107 'deleteUrl' => $router->url($request,
null,
null,
'deleteNotifications',
null, $this->getRequestArgs()),
119 return array(
'updateUnreadNotificationsCount');
126 import(
'lib.pkp.classes.controllers.grid.feature.selectableItems.SelectableItemsFeature');
127 import(
'lib.pkp.classes.controllers.grid.feature.PagingFeature');
135 return 'selectedNotifications';
142 return in_array($gridDataElement->getId(), $this->_selectedNotificationIds);
154 return 'common.tasks';
167 function markNew($args, $request) {
169 $user = $request->getUser();
171 $selectedElements = (array) $request->getUserVar(
'selectedElements');
172 foreach ($selectedElements as $notificationId) {
173 if ($notificationDao->getById($notificationId, $user->getId())) {
174 $notificationDao->setDateRead($notificationId,
null);
189 function markRead($args, $request) {
191 $user = $request->getUser();
193 $selectedElements = (array) $request->getUserVar(
'selectedElements');
194 foreach ($selectedElements as $notificationId) {
195 if ($notification = $notificationDao->getById($notificationId, $user->getId())) {
199 if ($request->getUserVar(
'redirect')) {
203 return $request->redirectUrlJson($notificationMgr->getNotificationUrl($request, $notification));
221 $user = $request->getUser();
223 $selectedElements = (array) $request->getUserVar(
'selectedElements');
224 foreach ($selectedElements as $notificationId) {
225 if ($notification = $notificationDao->getById($notificationId, $user->getId())) {
226 $notificationDao->deleteObject($notification);
242 return (
int) $notificationDao->getNotificationCount(
false, $user->getId(),
null, NOTIFICATION_LEVEL_TASK);