本文整理汇总了PHP中NotificationManager::sendToMailingList方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager::sendToMailingList方法的具体用法?PHP NotificationManager::sendToMailingList怎么用?PHP NotificationManager::sendToMailingList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationManager
的用法示例。
在下文中一共展示了NotificationManager::sendToMailingList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* 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()));
}
示例2: execute
/**
* 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));
}
示例3: execute
/**
* 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));
}
示例4: publishIssue
/**
* Publish issue
* @param $args array
* @param $request Request
*/
function publishIssue($args, $request)
{
$issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
$issueId = $issue->getId();
$journal = $request->getJournal();
$journalId = $journal->getId();
$articleSearchIndex = null;
if (!$issue->getPublished()) {
// Set the status of any attendant queued articles to STATUS_PUBLISHED.
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$articleDao = DAORegistry::getDAO('ArticleDAO');
$publishedArticles = $publishedArticleDao->getPublishedArticles($issueId);
foreach ($publishedArticles as $publishedArticle) {
$article = $articleDao->getById($publishedArticle->getId());
if ($article && $article->getStatus() == STATUS_QUEUED) {
$article->setStatus(STATUS_PUBLISHED);
$article->stampStatusModified();
$articleDao->updateObject($article);
if (!$articleSearchIndex) {
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
}
$articleSearchIndex->articleMetadataChanged($publishedArticle);
}
// delete article tombstone
$tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
$tombstoneDao->deleteByDataObjectId($article->getId());
}
}
$issue->setCurrent(1);
$issue->setPublished(1);
$issue->setDatePublished(Core::getCurrentDate());
// If subscriptions with delayed open access are enabled then
// update open access date according to open access delay policy
if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
$delayDuration = $journal->getSetting('delayedOpenAccessDuration');
$delayYears = (int) floor($delayDuration / 12);
$delayMonths = (int) fmod($delayDuration, 12);
$curYear = date('Y');
$curMonth = date('n');
$curDay = date('j');
$delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
$delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
$issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
$issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
}
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueDao->updateCurrent($journalId, $issue);
if ($articleSearchIndex) {
$articleSearchIndex->articleChangesFinished();
}
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = array();
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$allUsers = $userGroupDao->getUsersByContextId($journalId);
while ($user = $allUsers->next()) {
$notificationUsers[] = array('id' => $user->getId());
}
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
$dispatcher = $request->getDispatcher();
// FIXME: Find a better way to reload the containing tabs.
// Without this, issues don't move between tabs properly.
return $request->redirectUrlJson($dispatcher->url($request, ROUTE_PAGE, null, 'manageIssues'));
}
示例5: publishIssue
/**
* Publish issue
* @param $args array
* @param $request Request
*/
function publishIssue($args, $request)
{
$issueId = (int) array_shift($args);
$this->validate($issueId);
$issue =& $this->issue;
$journal =& $request->getJournal();
$journalId = $journal->getId();
if (!$issue->getPublished()) {
// Set the status of any attendant queued articles to STATUS_PUBLISHED.
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$publishedArticles =& $publishedArticleDao->getPublishedArticles($issueId);
foreach ($publishedArticles as $publishedArticle) {
$article =& $articleDao->getArticle($publishedArticle->getId());
if ($article && $article->getStatus() == STATUS_QUEUED) {
$article->setStatus(STATUS_PUBLISHED);
$article->stampStatusModified();
$articleDao->updateArticle($article);
}
// delete article tombstone
$tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
$tombstoneDao->deleteByDataObjectId($article->getId());
unset($article);
}
}
$issue->setCurrent(1);
$issue->setPublished(1);
$issue->setDatePublished(Core::getCurrentDate());
// If subscriptions with delayed open access are enabled then
// update open access date according to open access delay policy
if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
$delayDuration = $journal->getSetting('delayedOpenAccessDuration');
$delayYears = (int) floor($delayDuration / 12);
$delayMonths = (int) fmod($delayDuration, 12);
$curYear = date('Y');
$curMonth = date('n');
$curDay = date('j');
$delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
$delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
$issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
$issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
}
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issueDao->updateCurrentIssue($journalId, $issue);
// 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_PUBLISHED_ISSUE, $journalId);
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
$request->redirect(null, null, 'issueToc', $issue->getId());
}
示例6: publishIssue
/**
* Publish issue
* @param $args array
* @param $request Request
*/
function publishIssue($args, $request)
{
$issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
$issueId = $issue->getId();
$journal = $request->getJournal();
$journalId = $journal->getId();
$articleSearchIndex = null;
if (!$issue->getPublished()) {
$confirmationText = __('editor.issues.confirmPublish');
import('controllers.grid.pubIds.form.AssignPublicIdentifiersForm');
$formTemplate = $this->getAssignPublicIdentifiersFormTemplate();
$assignPublicIdentifiersForm = new AssignPublicIdentifiersForm($formTemplate, $issue, true, $confirmationText);
if (!$request->getUserVar('confirmed')) {
// Display assign pub ids modal
$assignPublicIdentifiersForm->initData($args, $request);
return new JSONMessage(true, $assignPublicIdentifiersForm->fetch($request));
}
// Asign pub ids
$assignPublicIdentifiersForm->readInputData();
$assignPublicIdentifiersForm->execute($request);
// Set the status of any attendant queued articles to STATUS_PUBLISHED.
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$articleDao = DAORegistry::getDAO('ArticleDAO');
$publishedArticles = $publishedArticleDao->getPublishedArticles($issueId);
foreach ($publishedArticles as $publishedArticle) {
$article = $articleDao->getById($publishedArticle->getId());
if ($article && $article->getStatus() == STATUS_QUEUED) {
$article->setStatus(STATUS_PUBLISHED);
$article->stampStatusModified();
$articleDao->updateObject($article);
if (!$articleSearchIndex) {
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
}
$articleSearchIndex->articleMetadataChanged($publishedArticle);
}
// delete article tombstone
$tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
$tombstoneDao->deleteByDataObjectId($article->getId());
}
}
$issue->setCurrent(1);
$issue->setPublished(1);
$issue->setDatePublished(Core::getCurrentDate());
// If subscriptions with delayed open access are enabled then
// update open access date according to open access delay policy
if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
$delayDuration = $journal->getSetting('delayedOpenAccessDuration');
$delayYears = (int) floor($delayDuration / 12);
$delayMonths = (int) fmod($delayDuration, 12);
$curYear = date('Y');
$curMonth = date('n');
$curDay = date('j');
$delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
$delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
$issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
$issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
}
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueDao->updateCurrent($journalId, $issue);
if ($articleSearchIndex) {
$articleSearchIndex->articleChangesFinished();
}
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = array();
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$allUsers = $userGroupDao->getUsersByContextId($journalId);
while ($user = $allUsers->next()) {
$notificationUsers[] = array('id' => $user->getId());
}
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
return DAO::getDataChangedEvent();
}
示例7: execute
/**
* Save announcement.
* @param $request PKPRequest
*/
function execute($request)
{
$announcementDao = DAORegistry::getDAO('AnnouncementDAO');
$announcement = $announcementDao->getById($this->announcementId);
if (!$announcement) {
$announcement = $announcementDao->newDataObject();
}
$announcement->setAssocType(Application::getContextAssocType());
$announcement->setAssocId($this->getContextId());
$announcement->setTitle($this->getData('title'), null);
// Localized
$announcement->setDescriptionShort($this->getData('descriptionShort'), null);
// Localized
$announcement->setDescription($this->getData('description'), null);
// Localized
if ($this->getData('typeId')) {
$announcement->setTypeId($this->getData('typeId'));
} else {
$announcement->setTypeId(null);
}
// Give the parent class a chance to set the dateExpire.
$dateExpireSetted = $this->setDateExpire($announcement);
if (!$dateExpireSetted) {
if ($this->getData('dateExpireYear') != null) {
$announcement->setDateExpire($this->getData('dateExpire'));
} else {
$announcement->setDateExpire(null);
}
}
// Update or insert announcement
if ($announcement->getId()) {
$announcementDao->updateObject($announcement);
} else {
$announcement->setDatetimePosted(Core::getCurrentDate());
$announcementDao->insertObject($announcement);
}
$contextId = $this->getContextId();
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$notificationUsers = array();
$allUsers = $userGroupDao->getUsersByContextId($contextId);
while ($user = $allUsers->next()) {
$notificationUsers[] = array('id' => $user->getId());
}
if (!$this->announcementId) {
// Only for new announcements
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $contextId, ASSOC_TYPE_ANNOUNCEMENT, $announcement->getId());
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $contextId, ASSOC_TYPE_ANNOUNCEMENT, $announcement->getId()));
}
return $announcement->getId();
}
示例8: execute
/**
* 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));
}