Exemplo n.º 1
0
 /**
  * Hook registry function to provide notification messages for SWORD notifications
  * @param $hookName string
  * @param $args array
  */
 function callbackNotificationContents($hookName, $args)
 {
     $notification =& $args[0];
     $message =& $args[1];
     $type = $notification->getType();
     assert(isset($type));
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     switch ($type) {
         case NOTIFICATION_TYPE_SWORD_DEPOSIT_COMPLETE:
             $notificationSettingsDao = DAORegistry::getDAO('NotificationSettingsDAO');
             $params = $notificationSettingsDao->getNotificationSettings($notification->getId());
             $message = __('plugins.generic.sword.depositComplete', $notificationManager->getParamsForCurrentLocale($params));
             break;
         case NOTIFICATION_TYPE_SWORD_AUTO_DEPOSIT_COMPLETE:
             $notificationSettingsDao = DAORegistry::getDAO('NotificationSettingsDAO');
             $params = $notificationSettingsDao->getNotificationSettings($notification->getId());
             $message = __('plugins.generic.sword.automaticDepositComplete', $notificationManager->getParamsForCurrentLocale($params));
             break;
         case NOTIFICATION_TYPE_SWORD_ENABLED:
             $message = __('plugins.generic.sword.enabled');
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Hook callback: add content to custom notifications
  * @see NotificationManager::getNotificationContents()
  */
 function getNotificationContents($hookName, $args)
 {
     $notification =& $args[0];
     $message =& $args[1];
     $type = $notification->getType();
     assert(isset($type));
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     switch ($type) {
         case NOTIFICATION_TYPE_ERROR:
             $message = __('plugins.generic.dataverse.notification.error');
             break;
         case NOTIFICATION_TYPE_DATAVERSE_FILE_ADDED:
             $message = __('plugins.generic.dataverse.notification.fileAdded');
             break;
         case NOTIFICATION_TYPE_DATAVERSE_FILE_DELETED:
             $message = __('plugins.generic.dataverse.notification.fileDeleted');
             break;
         case NOTIFICATION_TYPE_DATAVERSE_STUDY_CREATED:
             $message = __('plugins.generic.dataverse.notification.studyCreated');
             break;
         case NOTIFICATION_TYPE_DATAVERSE_STUDY_UPDATED:
             $message = __('plugins.generic.dataverse.notification.studyUpdated');
             break;
         case NOTIFICATION_TYPE_DATAVERSE_STUDY_DELETED:
             $message = __('plugins.generic.dataverse.notification.studyDeleted');
             break;
         case NOTIFICATION_TYPE_DATAVERSE_STUDY_RELEASED:
             $notificationSettingsDao =& DAORegistry::getDAO('NotificationSettingsDAO');
             $params = $notificationSettingsDao->getNotificationSettings($notification->getId());
             $message = __('plugins.generic.dataverse.notification.studyReleased', $notificationManager->getParamsForCurrentLocale($params));
             break;
         case NOTIFICATION_TYPE_DATAVERSE_UNRELEASED:
             $notificationSettingsDao =& DAORegistry::getDAO('NotificationSettingsDAO');
             $params = $notificationSettingsDao->getNotificationSettings($notification->getId());
             $message = __('plugins.generic.dataverse.notification.releaseDataverse', $notificationManager->getParamsForCurrentLocale($params));
             break;
     }
 }