/** * Post editor decision comment. * @param $article int * @param $emailComment boolean */ function postEditorDecisionComment($article, $emailComment) { if (HookRegistry::call('SectionEditorAction::postEditorDecisionComment', array(&$article, &$emailComment))) { return; } import('classes.submission.form.comment.EditorDecisionCommentForm'); $commentForm = new EditorDecisionCommentForm($article, Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR); $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.editorDecisionComment', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT); } if ($emailComment) { $commentForm->email(); } } else { $commentForm->display(); return false; } return true; }
/** * Post editor decision comment. * @param $article int * @param $emailComment boolean * @param $request Request */ function postEditorDecisionComment($article, $emailComment, $request) { if (HookRegistry::call('SectionEditorAction::postEditorDecisionComment', array(&$article, &$emailComment))) { return; } import('classes.submission.form.comment.EditorDecisionCommentForm'); $commentForm = new EditorDecisionCommentForm($article, Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR); $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_EDITOR_DECISION_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()); } if ($emailComment) { $commentForm->email($request); } } else { $commentForm->display(); return false; } return true; }
/** * Post editor decision comment. * @param $article int * @param $emailComment boolean */ function postEditorDecisionComment($article, $emailComment) { if (HookRegistry::call('AuthorAction::postEditorDecisionComment', array(&$article, &$emailComment))) { return; } $user =& Request::getUser(); import('classes.submission.form.comment.EditorDecisionCommentForm'); $commentForm = new EditorDecisionCommentForm($article, ROLE_ID_AUTHOR); $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(false, false); $param = $article->getProposalId() . ': <br/>' . $user->getFullName() . ', <i>' . $user->getErcFunction($article->getSectionId()) . '</i>,'; foreach ($notificationUsers as $userRole) { $url = Request::url(null, $userRole['role'], 'submissionReview', $article->getId(), null, 'editorDecision'); $notificationManager->createNotification($userRole['id'], 'notification.type.editorDecisionComment', $param, $url, 1, NOTIFICATION_TYPE_SECTION_DECISION_COMMENT); } if ($emailComment) { $commentForm->email(); } } else { $commentForm->display(); return false; } return true; }