/** * Post director decision comment. * @param $paper int * @param $emailComment boolean */ function postDirectorDecisionComment($paper, $emailComment) { if (HookRegistry::call('TrackDirectorAction::postDirectorDecisionComment', array(&$paper, &$emailComment))) { return; } import('submission.form.comment.DirectorDecisionCommentForm'); $commentForm = new DirectorDecisionCommentForm($paper, Validation::isDirector() ? ROLE_ID_DIRECTOR : ROLE_ID_TRACK_DIRECTOR); $commentForm->readInputData(); if ($commentForm->validate()) { $commentForm->execute(); // Send a notification to associated users import('notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationUsers = $paper->getAssociatedUserIds(true, false); foreach ($notificationUsers as $userRole) { $url = Request::url(null, null, $userRole['role'], 'submissionReview', $paper->getId(), null, 'directorDecision'); $notificationManager->createNotification($userRole['id'], 'notification.type.directorDecisionComment', $paper->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT); } if ($emailComment) { $commentForm->email(); } } else { $commentForm->display(); return false; } return true; }
/** * Post director decision comment. * @param $paper int * @param $emailComment boolean */ function postDirectorDecisionComment(&$request, $paper, $emailComment) { if (HookRegistry::call('TrackDirectorAction::postDirectorDecisionComment', array(&$paper, &$emailComment, &$request))) { return; } import('classes.submission.form.comment.DirectorDecisionCommentForm'); $commentForm = new DirectorDecisionCommentForm($paper, Validation::isDirector() ? ROLE_ID_DIRECTOR : ROLE_ID_TRACK_DIRECTOR); $commentForm->readInputData(); if ($commentForm->validate()) { $commentForm->execute(); // Send a notification to associated users import('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationUsers = $paper->getAssociatedUserIds(true, false); $conference = $request->getConference(); foreach ($notificationUsers as $userRole) { $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT, $conference->getId(), ASSOC_TYPE_PAPER, $paper->getId()); } if ($emailComment) { $commentForm->email(); } } else { $commentForm->display(); return false; } return true; }