/** * Post reviewer comments. * @param $user object Current user * @param $article object * @param $reviewId int * @param $emailComment boolean */ function postPeerReviewComment(&$user, &$article, $reviewId, $emailComment) { if (!HookRegistry::call('ReviewerAction::postPeerReviewComment', array(&$user, &$article, &$reviewId, &$emailComment))) { import('classes.submission.form.comment.PeerReviewCommentForm'); $commentForm = new PeerReviewCommentForm($article, $reviewId, ROLE_ID_REVIEWER); $commentForm->setUser($user); $commentForm->readInputData(); if ($commentForm->validate()) { $commentForm->execute(); // Send a notification to secretary(ies) import('lib.pkp.classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationUsers = $article->getAssociatedUserIds(false, false, false, true); $url = Request::url(null, 'sectionEditor', 'submission', array($article->getId(), 'submissionReview'), null, 'peerReview'); $param = $article->getProposalId() . ':<br/>' . $user->getUsername() . ' commented his review'; foreach ($notificationUsers as $userRole) { $notificationManager->createNotification($userRole['id'], 'notification.type.reviewerComment', $param, $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT); } if ($emailComment) { $commentForm->email(); } } else { $commentForm->display(); return false; } return true; } }
/** * Post reviewer comments. * @param $user object Current user * @param $paper object * @param $reviewId int * @param $emailComment boolean */ function postPeerReviewComment(&$user, &$paper, $reviewId, $emailComment) { if (!HookRegistry::call('ReviewerAction::postPeerReviewComment', array(&$user, &$paper, &$reviewId, &$emailComment))) { import("submission.form.comment.PeerReviewCommentForm"); $commentForm = new PeerReviewCommentForm($paper, $reviewId, ROLE_ID_REVIEWER); $commentForm->setUser($user); $commentForm->readInputData(); if ($commentForm->validate()) { $commentForm->execute(); // Send a notification to associated users import('notification.Notification'); $notificationUsers = $paper->getAssociatedUserIds(); foreach ($notificationUsers as $userRole) { $url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'peerReview'); Notification::createNotification($userRole['id'], "notification.type.reviewerComment", $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT); } if ($emailComment) { $commentForm->email(); } } else { $commentForm->display(); return false; } return true; } }
/** * Post reviewer comments. * @param $user object Current user * @param $article object * @param $reviewId int * @param $emailComment boolean * @param $request Request */ function postPeerReviewComment(&$user, &$article, $reviewId, $emailComment, $request) { if (!HookRegistry::call('ReviewerAction::postPeerReviewComment', array(&$user, &$article, &$reviewId, &$emailComment))) { import('classes.submission.form.comment.PeerReviewCommentForm'); $commentForm = new PeerReviewCommentForm($article, $reviewId, ROLE_ID_REVIEWER); $commentForm->setUser($user); $commentForm->readInputData(); if ($commentForm->validate()) { $commentForm->execute(); // Send a notification to associated users import('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationUsers = $article->getAssociatedUserIds(false, false); foreach ($notificationUsers as $userRole) { $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_REVIEWER_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()); } if ($emailComment) { $commentForm->email($request); } } else { $commentForm->display(); return false; } return true; } }