4 * @file classes/submission/formform/comment/EditorDecisionCommentForm.inc.php
6 * Copyright (c) 2003-2008 John Willinsky
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 * @class EditorDecisionCommentForm
10 * @ingroup submission_form
12 * @brief EditorDecisionComment form.
15 // $Id: EditorDecisionCommentForm.inc.php,v 1.4 2009/05/13 22:06:38 tylerl Exp $
18 import('submission.form.comment.CommentForm');
20 class EditorDecisionCommentForm
extends CommentForm
{
24 * @param $monograph object
26 function EditorDecisionCommentForm($monograph, $roleId) {
27 parent
::CommentForm($monograph, COMMENT_TYPE_EDITOR_DECISION
, $roleId, $monograph->getMonographId());
34 $templateMgr =& TemplateManager
::getManager();
35 $templateMgr->assign('pageTitle', 'submission.comments.editorAuthorCorrespondence');
36 $templateMgr->assign('monographId', $this->monograph
->getMonographId());
37 $templateMgr->assign('commentAction', 'postEditorDecisionComment');
38 $templateMgr->assign('hiddenFormParams',
40 'monographId' => $this->monograph
->getMonographId()
44 $isEditor = $this->roleId
== ROLE_ID_EDITOR ||
$this->roleId
== ROLE_ID_ACQUISITIONS_EDITOR ?
true : false;
45 $templateMgr->assign('isEditor', $isEditor);
51 * Assign form data to user-submitted data.
53 function readInputData() {
73 $roleDao =& DAORegistry
::getDAO('RoleDAO');
74 $userDao =& DAORegistry
::getDAO('UserDAO');
75 $press =& Request
::getPress();
77 // Create list of recipients:
79 // Editor Decision comments are to be sent to the editor or author,
80 // the opposite of whomever wrote the comment.
81 $recipients = array();
83 if ($this->roleId
== ROLE_ID_EDITOR ||
$this->roleId
== ROLE_ID_ACQUISITIONS_EDITOR
) {
85 $user =& $userDao->getUser($this->monograph
->getUserId());
87 if ($user) $recipients = array_merge($recipients, array($user->getEmail() => $user->getFullName()));
90 $editAssignmentDao =& DAORegistry
::getDAO('EditAssignmentDAO');
91 $editAssignments =& $editAssignmentDao->getByIdsByMonographId($this->monograph
->getMonographId());
92 $editorAddresses = array();
93 while (!$editAssignments->eof()) {
94 $editAssignment =& $editAssignments->next();
95 $editorAddresses[$editAssignment->getEditorEmail()] = $editAssignment->getEditorFullName();
98 // If no editors are currently assigned to this monograph,
99 // send the email to all editors for the press
100 if (empty($editorAddresses)) {
101 $editors =& $roleDao->getUsersByRoleId(ROLE_ID_EDITOR
, $press->getPressId());
102 while (!$editors->eof()) {
103 $editor =& $editors->next();
104 $editorAddresses[$editor->getEmail()] = $editor->getFullName();
107 $recipients = array_merge($recipients, $editorAddresses);
110 parent
::email($recipients);