Ejemplo n.º 1
0
 /**
  * Post proofread comment.
  * @param $article object
  * @param $emailComment boolean
  * @param $request Request
  */
 function postProofreadComment($article, $emailComment, $request)
 {
     if (HookRegistry::call('SectionEditorAction::postProofreadComment', array(&$article, &$emailComment))) {
         return;
     }
     import('classes.submission.form.comment.ProofreadCommentForm');
     $commentForm = new ProofreadCommentForm($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_PROOFREAD_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId());
         }
         if ($emailComment) {
             $commentForm->email($request);
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }
 /**
  * Post proofread comment.
  * @param $article object
  * @param $emailComment boolean
  */
 function postProofreadComment($article, $emailComment)
 {
     if (HookRegistry::call('SectionEditorAction::postProofreadComment', array(&$article, &$emailComment))) {
         return;
     }
     import('classes.submission.form.comment.ProofreadCommentForm');
     $commentForm = new ProofreadCommentForm($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'], 'submissionEditing', $article->getId(), null, 'proofread');
             $notificationManager->createNotification($userRole['id'], 'notification.type.proofreadComment', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_PROOFREAD_COMMENT);
         }
         if ($emailComment) {
             $commentForm->email();
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }