/** * Post layout comment. * @param $article object * @param $emailComment boolean * @param $request Request */ function postLayoutComment($article, $emailComment, $request) { if (HookRegistry::call('SectionEditorAction::postLayoutComment', array(&$article, &$emailComment))) { return; } import('classes.submission.form.comment.LayoutCommentForm'); $commentForm = new LayoutCommentForm($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_LAYOUT_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()); } if ($emailComment) { $commentForm->email($request); } } else { $commentForm->display(); return false; } return true; }
/** * Post layout comment. * @param $article object * @param $emailComment boolean * @param $request object */ function postLayoutComment($article, $emailComment, $request) { if (!HookRegistry::call('CopyeditorAction::postLayoutComment', array(&$article, &$emailComment))) { import('classes.submission.form.comment.LayoutCommentForm'); $commentForm = new LayoutCommentForm($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, 'layout'); $notificationManager->createNotification($userRole['id'], 'notification.type.layoutComment', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_LAYOUT_COMMENT); } if ($emailComment) { $commentForm->email($request); } } else { $commentForm->display(); return false; } return true; } }