Construct the contents for the notification based on its type and associated object
public getNotificationMessage ( $request, $notification ) : string | ||
$request | PKPRequest | |
$notification | Notification | |
return | string |
/** * Get cell actions associated with this row/column combination * @param $row GridRow * @param $column GridColumn * @return array an array of LinkAction instances */ function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) { assert($column->getId() == 'task'); $notification = $row->getData(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($notification->getContextId()); $notificationMgr = new NotificationManager(); $router = $request->getRouter(); return array(new LinkAction('details', new AjaxAction($router->url($request, null, null, 'markRead', null, array('redirect' => 1, 'selectedElements' => array($notification->getId())))), ($notification->getDateRead() ? '' : '<strong>') . __('common.tasks.titleAndTask', array('acronym' => $context->getLocalizedAcronym(), 'title' => $this->_getTitle($notification), 'task' => $notificationMgr->getNotificationMessage($request, $notification))) . ($notification->getDateRead() ? '' : '</strong>'))); }
/** * Get cell actions associated with this row/column combination * @param $row GridRow * @param $column GridColumn * @return array an array of LinkAction instances */ function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) { assert($column->getId() == 'task'); $templateMgr = TemplateManager::getManager($request); $notification = $row->getData(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($notification->getContextId()); $notificationMgr = new NotificationManager(); $router = $request->getRouter(); $templateMgr->assign(array('notificationMgr' => $notificationMgr, 'notification' => $notification, 'context' => $context, 'notificationObjectTitle' => $this->_getTitle($notification), 'message' => PKPString::stripUnsafeHtml($notificationMgr->getNotificationMessage($request, $notification)))); // See if we're working in a multi-context environment $user = $request->getUser(); $contextDao = Application::getContextDAO(); $contexts = $contextDao->getAvailable($user ? $user->getId() : null)->toArray(); $templateMgr->assign('isMultiContext', count($contexts) > 1); return array(new LinkAction('details', new AjaxAction($router->url($request, null, null, 'markRead', null, array('redirect' => 1, 'selectedElements' => array($notification->getId())))), $templateMgr->fetch('controllers/grid/tasks/task.tpl'))); }