本文整理汇总了PHP中NotificationManager::createNotification方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager::createNotification方法的具体用法?PHP NotificationManager::createNotification怎么用?PHP NotificationManager::createNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationManager
的用法示例。
在下文中一共展示了NotificationManager::createNotification方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setVerified
public function setVerified($bool)
{
NotificationManager::createNotification($this, "Your account was verified.", array());
$database = new DatabaseManager();
$database->query("UPDATE `users` SET `verified`='" . $database->sanitize($bool) . "' WHERE `email`='" . $database->sanitize($this->getEmail()) . "'");
apc_store('userObject_' . $this->blid, $this, 600);
}
示例2: 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()));
}
示例3: 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));
}
示例4: 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));
}
示例5: updateContext
/**
* Update an existing journal.
* @param $args array
* @param $request PKPRequest
* @return string Serialized JSON object
*/
function updateContext($args, $request)
{
// Identify the context Id.
$contextId = $request->getUserVar('contextId');
// Form handling.
$settingsForm = new JournalSiteSettingsForm($contextId);
$settingsForm->readInputData();
if (!$settingsForm->validate()) {
$json = new JSONMessage(false);
return $json->getString();
}
PluginRegistry::loadCategory('blocks');
// The context settings form will return a context path in two cases:
// 1 - if a new context was created;
// 2 - if a press path of an existing context was edited.
$newContextPath = $settingsForm->execute($request);
// Create the notification.
$notificationMgr = new NotificationManager();
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId());
// Check for the two cases above.
if ($newContextPath) {
$context = $request->getContext();
if (is_null($contextId)) {
// CASE 1: new press created.
// Create notification related to payment method configuration.
$contextDao = Application::getContextDAO();
$newContext = $contextDao->getByPath($newContextPath);
$notificationMgr->createNotification($request, null, NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD, $newContext->getId(), ASSOC_TYPE_JOURNAL, $newContext->getId(), NOTIFICATION_LEVEL_NORMAL);
// redirect and set the parameter to open the press
// setting wizard modal after redirection.
return $this->_getRedirectEvent($request, $newContextPath, true);
} else {
// CASE 2: check if user is in the context of
// the press being edited.
if ($context && $context->getId() == $contextId) {
return $this->_getRedirectEvent($request, $newContextPath, false);
}
}
}
return DAO::getDataChangedEvent($contextId);
}
示例6: execute
/**
* @copydoc ContextSettingsForm::execute()
*/
function execute($request)
{
$context = $request->getContext();
// Get the selected payment plugin
$paymentPluginName = $this->getData('paymentPluginName');
if (isset($this->paymentPlugins[$paymentPluginName])) {
$plugin = $this->paymentPlugins[$paymentPluginName];
// Save the plugin-specific settings
foreach ($plugin->getSettingsFormFieldNames() as $settingName) {
$plugin->updateSetting($context->getId(), $settingName, $this->getData($settingName));
}
// Remove notification.
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationDao->deleteByAssoc($context->getAssocType(), $context->getId(), null, NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD, $context->getId());
} else {
// Create notification.
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification($request, null, NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD, $context->getId(), $context->getAssocType(), $context->getId(), NOTIFICATION_LEVEL_NORMAL);
}
return parent::execute($request);
}
示例7: saveReviewFormResponse
/**
* Save review form response.
* @param $reviewId int
* @param $reviewFormId int
*/
function saveReviewFormResponse($reviewId, $reviewFormId)
{
if (!HookRegistry::call('ReviewerAction::saveReviewFormResponse', array($reviewId, $reviewFormId))) {
import('classes.submission.form.ReviewFormResponseForm');
$reviewForm = new ReviewFormResponseForm($reviewId, $reviewFormId);
$reviewForm->readInputData();
if ($reviewForm->validate()) {
$reviewForm->execute();
// Send a notification to associated users
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$reviewAssignment = $reviewAssignmentDao->getById($reviewId);
$sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId());
$articleId = $sectionDecision->getArticleId();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$notificationUsers = $article->getAssociatedUserIds();
foreach ($notificationUsers as $userRole) {
$url = Request::url(null, $userRole['role'], 'submission', array($article->getId(), 'submissionReview'), null, 'peerReview');
$notificationManager->createNotification($userRole['id'], 'notification.type.reviewerFormComment', $article->getScientificTitle, $url, 1, NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT);
}
} else {
$reviewForm->display();
return false;
}
return true;
}
}
示例8: saveSuppFile
/**
* Save a supplementary file.
* @param $args array ($suppFileId)
*/
function saveSuppFile($args, $request)
{
$articleId = $request->getUserVar('articleId');
$submissionLayoutHandler = new SubmissionLayoutHandler();
$submissionLayoutHandler->validate($articleId);
$submission =& $submissionLayoutHandler->submission;
$this->setupTemplate(true, $articleId, 'editing');
$suppFileId = (int) array_shift($args);
$journal =& $request->getJournal();
import('classes.submission.form.SuppFileForm');
$submitForm = new SuppFileForm($submission, $journal, $suppFileId);
$submitForm->readInputData();
if ($submitForm->validate()) {
$submitForm->execute();
// Send a notification to associated users
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$notificationUsers = $article->getAssociatedUserIds(true, false);
foreach ($notificationUsers as $userRole) {
$url = $request->url(null, $userRole['role'], 'submissionEditing', $article->getId(), null, 'layout');
$notificationManager->createNotification($userRole['id'], 'notification.type.suppFileModified', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_MODIFIED);
}
$request->redirect(null, null, 'submission', $articleId);
} else {
$submitForm->display();
}
}
示例9: NotificationManager
/**
* Initiate a new review round and add selected files
* to it. Also saves the new round to the submission.
* @param $submission Submission
* @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants.
* @param $request Request
* @param $status integer One of the REVIEW_ROUND_STATUS_* constants.
* @return $newRound integer The round number of the new review round.
*/
function _initiateReviewRound($submission, $stageId, $request, $status = null)
{
// If we already have review round for this stage,
// we create a new round after the last one.
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
/* @var $reviewRoundDao ReviewRoundDAO */
$lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId);
if ($lastReviewRound) {
$newRound = $lastReviewRound->getRound() + 1;
} else {
// If we don't have any review round, we create the first one.
$newRound = 1;
}
// Create a new review round.
$reviewRound = $reviewRoundDao->build($submission->getId(), $stageId, $newRound, $status);
// Check for a notification already in place for the current review round.
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationFactory = $notificationDao->getByAssoc(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId(), null, NOTIFICATION_TYPE_REVIEW_ROUND_STATUS, $submission->getContextId());
// Create round status notification if there is no notification already.
if ($notificationFactory->wasEmpty()) {
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification($request, null, NOTIFICATION_TYPE_REVIEW_ROUND_STATUS, $submission->getContextId(), ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId(), NOTIFICATION_LEVEL_NORMAL);
}
// Add the selected files to the new round.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/* @var $submissionFileDao SubmissionFileDAO */
// Bring in the SUBMISSION_FILE_* constants.
import('lib.pkp.classes.submission.SubmissionFile');
// Bring in the Manager (we need it).
import('lib.pkp.classes.file.SubmissionFileManager');
$submissionFileManager = new SubmissionFileManager($submission->getContextId(), $submission->getId());
foreach (array('selectedFiles', 'selectedAttachments') as $userVar) {
$selectedFiles = $this->getData($userVar);
if (is_array($selectedFiles)) {
foreach ($selectedFiles as $fileId) {
// Retrieve the file last revision number.
$revisionNumber = $submissionFileDao->getLatestRevisionNumber($fileId);
list($newFileId, $newRevision) = $submissionFileManager->copyFileToFileStage($fileId, $revisionNumber, SUBMISSION_FILE_REVIEW_FILE, null, true);
$submissionFileDao->assignRevisionToReviewRound($newFileId, $newRevision, $reviewRound);
}
}
}
return $newRound;
}
示例10: saveComment
/**
* Save comment.
* @param $commentId int
*/
function saveComment($article, &$comment, $emailComment)
{
if (!HookRegistry::call('Action::saveComment', array(&$article, &$comment, &$emailComment))) {
import('classes.submission.form.comment.EditCommentForm');
$commentForm = new EditCommentForm($article, $comment);
$commentForm->readInputData();
if ($commentForm->validate()) {
$commentForm->execute();
// Send a notification to associated users
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = $article->getAssociatedUserIds(true, false);
foreach ($notificationUsers as $userRole) {
$url = Request::url(null, $userRole['role'], 'submissionReview', $article->getId(), null, 'editorDecision');
$notificationManager->createNotification($userRole['id'], 'notification.type.submissionComment', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_SUBMISSION_COMMENT);
}
if ($emailComment) {
$commentForm->email($commentForm->emailHelper());
}
} else {
$commentForm->display();
}
}
}
示例11: 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());
}
示例12: NotificationManager
/**
* Create a notification if none exists.
* @param $request PKPRequest
* @param $submissionId int
* @param $userId int
* @param $notificationType int NOTIFICATION_TYPE_
* @param $contextId int
*/
function _createNotification($request, $submissionId, $userId, $notificationType, $contextId)
{
$notificationDao = DAORegistry::getDAO('NotificationDAO');
/* @var $notificationDao NotificationDAO */
$notificationFactory = $notificationDao->getByAssoc(ASSOC_TYPE_SUBMISSION, $submissionId, $userId, $notificationType, $contextId);
if ($notificationFactory->wasEmpty()) {
$notificationMgr = new NotificationManager();
$notificationMgr->createNotification($request, $userId, $notificationType, $contextId, ASSOC_TYPE_SUBMISSION, $submissionId, NOTIFICATION_LEVEL_NORMAL, null, true);
}
}
示例13: postCopyeditComment
/**
* Post copyedit comment.
* @param $article object
*/
function postCopyeditComment($article, $emailComment, $request)
{
if (!HookRegistry::call('CopyeditorAction::postCopyeditComment', array(&$article, &$emailComment))) {
import('classes.submission.form.comment.CopyeditCommentForm');
$commentForm = new CopyeditCommentForm($article, ROLE_ID_COPYEDITOR);
$commentForm->readInputData();
if ($commentForm->validate()) {
$commentForm->execute();
// Send a notification to associated users
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = $article->getAssociatedUserIds(true, false);
foreach ($notificationUsers as $userRole) {
$url = $request->url(null, $userRole['role'], 'submissionEditing', $article->getId(), null, 'coypedit');
$notificationManager->createNotification($userRole['id'], 'notification.type.copyeditComment', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_COPYEDIT_COMMENT);
}
if ($emailComment) {
$commentForm->email($request);
}
} else {
$commentForm->display();
return false;
}
return true;
}
}
示例14: saveGalley
/**
* Save changes to a galley.
* @param $args array ($articleId, $galleyId)
*/
function saveGalley($args)
{
$articleId = isset($args[0]) ? (int) $args[0] : 0;
$galleyId = isset($args[1]) ? (int) $args[1] : 0;
$this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
$this->setupTemplate(true, $articleId, 'editing');
$submission =& $this->submission;
import('classes.submission.form.ArticleGalleyForm');
$submitForm = new ArticleGalleyForm($articleId, $galleyId);
$submitForm->readInputData();
if ($submitForm->validate()) {
$submitForm->execute();
// Send a notification to associated users
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$notificationUsers = $article->getAssociatedUserIds(true, false);
foreach ($notificationUsers as $userRole) {
$url = Request::url(null, $userRole['role'], 'submissionEditing', $article->getId(), null, 'layout');
$notificationManager->createNotification($userRole['id'], 'notification.type.galleyModified', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_GALLEY_MODIFIED);
}
if (Request::getUserVar('uploadImage')) {
$submitForm->uploadImage();
Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
} else {
if (($deleteImage = Request::getUserVar('deleteImage')) && count($deleteImage) == 1) {
list($imageId) = array_keys($deleteImage);
$submitForm->deleteImage($imageId);
Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
}
}
Request::redirect(null, null, 'submissionEditing', $articleId);
} else {
$submitForm->display();
}
}
示例15: saveReviewFormResponse
/**
* Save review form response.
* @param $reviewId int
* @param $reviewFormId int
*/
function saveReviewFormResponse($reviewId, $reviewFormId)
{
if (!HookRegistry::call('ReviewerAction::saveReviewFormResponse', array($reviewId, $reviewFormId))) {
import('submission.form.ReviewFormResponseForm');
$reviewForm = new ReviewFormResponseForm($reviewId, $reviewFormId);
$reviewForm->readInputData();
if ($reviewForm->validate()) {
$reviewForm->execute();
// Send a notification to associated users
import('notification.NotificationManager');
$notificationManager = new NotificationManager();
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment = $reviewAssignmentDao->getReviewAssignmentById($reviewId);
$paperId = $reviewAssignment->getPaperId();
$paperDao =& DAORegistry::getDAO('PaperDAO');
$paper =& $paperDao->getPaper($paperId);
$notificationUsers = $paper->getAssociatedUserIds();
foreach ($notificationUsers as $userRole) {
$url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'peerReview');
$notificationManager->createNotification($userRole['id'], 'notification.type.reviewerFormComment', $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT);
}
} else {
$reviewForm->display();
return false;
}
return true;
}
}