public getNotificationMessage ( $request, $notification ) : string | ||
$request | PKPRequest | |
$notification | Notification | |
Результат | string |
function getNotificationMessage($request, $notification)
{
// Allow hooks to override default behavior
$message = null;
HookRegistry::call('NotificationManager::getNotificationMessage', array(&$notification, &$message));
if ($message) {
return $message;
}
switch ($notification->getType()) {
case NOTIFICATION_TYPE_PUBLISHED_ISSUE:
return __('notification.type.issuePublished');
case NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_SUCCESS:
return __('gifts.giftRedeemed');
case NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_NO_GIFT_TO_REDEEM:
return __('gifts.noGiftToRedeem');
case NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_GIFT_ALREADY_REDEEMED:
return __('gifts.giftAlreadyRedeemed');
case NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_GIFT_INVALID:
return __('gifts.giftNotValid');
case NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_SUBSCRIPTION_TYPE_INVALID:
return __('gifts.subscriptionTypeNotValid');
case NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_SUBSCRIPTION_NON_EXPIRING:
return __('gifts.subscriptionNonExpiring');
case NOTIFICATION_TYPE_BOOK_REQUESTED:
return __('plugins.generic.booksForReview.notification.bookRequested');
case NOTIFICATION_TYPE_BOOK_CREATED:
return __('plugins.generic.booksForReview.notification.bookCreated');
case NOTIFICATION_TYPE_BOOK_UPDATED:
return __('plugins.generic.booksForReview.notification.bookUpdated');
case NOTIFICATION_TYPE_BOOK_DELETED:
return __('plugins.generic.booksForReview.notification.bookDeleted');
case NOTIFICATION_TYPE_BOOK_MAILED:
return __('plugins.generic.booksForReview.notification.bookMailed');
case NOTIFICATION_TYPE_BOOK_SETTINGS_SAVED:
return __('plugins.generic.booksForReview.notification.settingsSaved');
case NOTIFICATION_TYPE_BOOK_SUBMISSION_ASSIGNED:
return __('plugins.generic.booksForReview.notification.submissionAssigned');
case NOTIFICATION_TYPE_BOOK_AUTHOR_ASSIGNED:
return __('plugins.generic.booksForReview.notification.authorAssigned');
case NOTIFICATION_TYPE_BOOK_AUTHOR_DENIED:
return __('plugins.generic.booksForReview.notification.authorDenied');
case NOTIFICATION_TYPE_BOOK_AUTHOR_REMOVED:
return __('plugins.generic.booksForReview.notification.authorRemoved');
default:
return parent::getNotificationMessage($request, $notification);
}
}
/** * 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>'))); }