/**
  * Post copyedit comment.
  * @param $article object
  * @param $emailComment boolean
  * @param $request object
  */
 function postCopyeditComment($article, $emailComment, $request)
 {
     if (HookRegistry::call('SectionEditorAction::postCopyeditComment', array(&$article, &$emailComment))) {
         return;
     }
     import('classes.submission.form.comment.CopyeditCommentForm');
     $commentForm = new CopyeditCommentForm($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_COPYEDIT_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId());
         }
         if ($emailComment) {
             $commentForm->email($request);
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * 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;
     }
 }