Ejemplo n.º 1
0
 /**
  * Save announcement.
  * @param $request Request
  */
 function execute(&$request)
 {
     $announcement = parent::execute();
     $journalId = $this->getContextId();
     // Send a notification to associated users
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $notificationUsers = array();
     $allUsers = $roleDao->getUsersByJournalId($journalId);
     while (!$allUsers->eof()) {
         $user =& $allUsers->next();
         $notificationUsers[] = array('id' => $user->getId());
         unset($user);
     }
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $journalId, ASSOC_TYPE_ANNOUNCEMENT, $announcement->getId());
     }
     $notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $journalId, ASSOC_TYPE_ANNOUNCEMENT, $announcement->getId()));
 }
Ejemplo n.º 2
0
 /**
  * Save announcement.
  */
 function execute()
 {
     $announcement = parent::execute();
     $press =& Request::getPress();
     $pressId = $press->getId();
     // Send a notification to associated users
     import('lib.pkp.classes.notification.NotificationManager');
     $userGroupDao =& DAORegistry::getDAO('RoleAssignmentDAO');
     $notificationUsers = array();
     $allUsers = $userGroupDao->getUsersByContextId($pressId);
     while (!$allUsers->eof()) {
         $user =& $allUsers->next();
         $notificationUsers[] = array('id' => $user->getId());
         unset($user);
     }
     $url = Request::url(null, 'announcement', 'view', array($announcement->getId()));
     $notificationManager = new NotificationManager();
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($userRole['id'], 'notification.type.newAnnouncement', null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT);
     }
     $notificationManager->sendToMailingList($notificationManager->createNotification(0, 'notification.type.newAnnouncement', null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT));
 }
Ejemplo n.º 3
0
 /**
  * Save announcement.
  */
 function execute()
 {
     parent::execute();
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     // Send a notification to associated users
     import('notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $notificationUsers = array();
     $allUsers = $roleDao->getUsersByJournalId($journalId);
     while (!$allUsers->eof()) {
         $user =& $allUsers->next();
         $notificationUsers[] = array('id' => $user->getId());
         unset($user);
     }
     $url = Request::url(null, 'announcement', 'view', array(1));
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($userRole['id'], 'notification.type.newAnnouncement', null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT);
     }
     $notificationManager->sendToMailingList($notificationManager->createNotification(0, 'notification.type.newAnnouncement', null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT));
 }
Ejemplo n.º 4
0
 /**
  * Save announcement. 
  */
 function execute()
 {
     parent::execute();
     $conference =& Request::getConference();
     $conferenceId = $conference->getId();
     // Send a notification to associated users
     import('notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $notificationUsers = array();
     $allUsers = $roleDao->getUsersByConferenceId($conferenceId);
     while (!$allUsers->eof()) {
         $user =& $allUsers->next();
         $notificationUsers[] = array('id' => $user->getId());
         unset($user);
     }
     $schedConfId = $this->getData('schedConfId');
     if ($schedConfId == 0) {
         // Associated with the conference as a whole.
         $url = Request::url(null, 'index', 'announcement', 'view', array(1));
     } else {
         // Associated with a sched conf -- determine its path.
         $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
         $schedConf =& $schedConfDao->getSchedConf($schedConfId);
         $url = Request::url(null, $schedConf->getPath(), 'announcement', 'view', array(1));
     }
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($userRole['id'], 'notification.type.newAnnouncement', null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT);
     }
     $notificationManager->sendToMailingList($notificationManager->createNotification(0, 'notification.type.newAnnouncement', null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT));
 }