16 import(
'lib.pkp.classes.controllers.modals.editorDecision.form.EditorDecisionForm');
39 $this->_saveFormOperation = $saveFormOperation;
49 function initData($actionLabels = array()) {
51 $context = $request->getContext();
52 $router = $request->getRouter();
53 $dispatcher = $router->getDispatcher();
56 $user = $request->getUser();
58 import(
'lib.pkp.classes.mail.SubmissionMailTemplate');
60 SUBMISSION_EDITOR_DECISION_ACCEPT =>
'EDITOR_DECISION_ACCEPT',
61 SUBMISSION_EDITOR_DECISION_DECLINE =>
'EDITOR_DECISION_DECLINE',
62 SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE =>
'EDITOR_DECISION_INITIAL_DECLINE',
63 SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW =>
'EDITOR_DECISION_SEND_TO_EXTERNAL',
64 SUBMISSION_EDITOR_DECISION_RESUBMIT =>
'EDITOR_DECISION_RESUBMIT',
65 SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS =>
'EDITOR_DECISION_REVISIONS',
66 SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION =>
'EDITOR_DECISION_SEND_TO_PRODUCTION',
71 $submissionUrl = $dispatcher->url($request, ROUTE_PAGE,
null,
'authorDashboard',
'submission', $submission->getId());
72 $email->assignParams(array(
73 'authorName' => $submission->getAuthorString(),
74 'submissionUrl' => $submissionUrl,
76 $email->replaceParams();
80 if (is_a($reviewRound,
'ReviewRound')) {
81 $this->
setData(
'reviewRoundId', $reviewRound->getId());
85 'submissionId' => $submission->getId(),
86 'decision' => $this->getDecision(),
87 'authorName' => $submission->getAuthorString(),
88 'personalMessage' => $email->getBody(),
89 'actionLabel' => $actionLabels[$this->getDecision()]
91 foreach($data as $key => $value) {
95 return parent::initData();
102 $this->
readUserVars(array(
'personalMessage',
'selectedAttachments',
'skipEmail',
'selectedLibraryFiles'));
103 parent::readInputData();
109 function fetch($request, $template =
null, $display =
false) {
115 if ($stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW || $stageId == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
116 $reviewsAvailable =
false;
120 $reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId());
121 foreach ($reviewAssignments as $reviewAssignment) {
122 if ($reviewAssignment->getDateCompleted() !=
null) {
123 $reviewsAvailable =
true;
128 $templateMgr->assign(
'reviewsAvailable', $reviewsAvailable);
131 if ($reviewsAvailable) {
132 $router = $request->getRouter();
136 $request,
null,
null,
137 'importPeerReviews',
null,
139 'submissionId' => $submission->getId(),
140 'stageId' => $stageId,
141 'reviewRoundId' => $reviewRound->getId()
160 return parent::fetch($request, $template, $display);
180 $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId());
186 if (is_a($reviewRound,
'ReviewRound')) {
187 $reviewRoundDao->updateStatus($reviewRound, $status);
201 import(
'lib.pkp.classes.mail.SubmissionMailTemplate');
203 $email->setBody($this->
getData(
'personalMessage'));
207 $authors = $submission->getAuthors(
true);
208 foreach($authors as $author) {
209 $email->addRecipient($author->getEmail(), $author->getFullName());
213 $email->setEventType(SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR);
218 if(is_a($reviewRound,
'ReviewRound')) {
221 $reviewIndexes = $reviewAssignmentDao->getReviewIndexesForRound($submission->getId(), $reviewRound->getId());
222 assert(is_array($reviewIndexes));
226 $lastIndex = end($reviewIndexes);
227 $reviewIndexes[-1] = $lastIndex + 1;
231 $selectedAttachments = $this->
getData(
'selectedAttachments');
232 if(is_array($selectedAttachments)) {
233 foreach ($selectedAttachments as $fileId) {
236 $submissionFile = $submissionFileDao->getLatestRevision($fileId);
237 assert(is_a($submissionFile,
'SubmissionFile'));
240 if($submissionFile->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT) {
242 $reviewAssignmentId = $submissionFile->getAssocId();
243 assert(is_numeric($reviewAssignmentId));
246 $reviewAssignmentId = -1;
250 assert(isset($reviewIndexes[$reviewAssignmentId]));
251 $reviewIndex = $reviewIndexes[$reviewAssignmentId];
252 assert(!is_null($reviewIndex));
255 $email->addAttachment(
256 $submissionFile->getFilePath(),
262 $submissionFile->setViewable(
true);
263 $submissionFileDao->updateObject($submissionFile);
269 import(
'classes.file.LibraryFileManager');
271 $selectedLibraryFilesAttachments = $this->
getData(
'selectedLibraryFiles');
272 if(is_array($selectedLibraryFilesAttachments)) {
273 foreach ($selectedLibraryFilesAttachments as $fileId) {
275 $libraryFile = $libraryFileDao->getById($fileId);
276 assert(is_a($libraryFile,
'LibraryFile'));
281 $email->addAttachment($libraryFile->getFilePath(), $libraryFile->getOriginalFileName());
286 if (!$this->
getData(
'skipEmail')) {
287 $router = $request->getRouter();
288 $dispatcher = $router->getDispatcher();
289 $context = $request->getContext();
290 $user = $request->getUser();
291 $email->assignParams(array(
292 'submissionUrl' => $dispatcher->url($request, ROUTE_PAGE,
null,
'authorDashboard',
'submission', $submission->getId()),
293 'contextName' => $context->getLocalizedName(),
294 'authorName' => $submission->getAuthorString(),
295 'editorialContactSignature' => $user->getContactSignature(),
297 if (!$email->send($request)) {
298 import(
'classes.notification.NotificationManager');
300 $notificationMgr->createTrivialNotification($request->getUser()->getId(), NOTIFICATION_TYPE_ERROR, array(
'contents' => __(
'email.compose.error')));
311 $router = $request->getRouter();
312 $dispatcher = $router->getDispatcher();
314 $user = $request->getUser();
316 'submissionUrl' => __(
'common.url'),
317 'contextName' => $request->getContext()->getLocalizedName(),
318 'editorialContactSignature' => strip_tags($user->getContactSignature(),
"<br>"),
319 'submissionTitle' => strip_tags($submission->getLocalizedTitle()),
320 'authorName' => strip_tags($submission->getAuthorString()),
331 'contextName' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT,
332 'editorialContactSignature' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT,
333 'submissionTitle' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT,
334 'authorName' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT,