/** * Save comment. * @param $commentId int */ function saveComment($article, &$comment, $emailComment, $request) { 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('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationUsers = $article->getAssociatedUserIds(true, false); foreach ($notificationUsers as $userRole) { $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_SUBMISSION_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()); } if ($emailComment) { $commentForm->email($commentForm->emailHelper(), $request); } } else { $commentForm->display(); } } }
/** * 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(); } } }