00001 <?php
00002
00016
00017
00018
00019 import("submission.form.comment.CommentForm");
00020
00021 class CopyeditCommentForm extends CommentForm {
00022
00027 function CopyeditCommentForm($article, $roleId) {
00028 parent::CommentForm($article, COMMENT_TYPE_COPYEDIT, $roleId, $article->getArticleId());
00029 }
00030
00034 function display() {
00035 $article = $this->article;
00036
00037 $templateMgr = &TemplateManager::getManager();
00038 $templateMgr->assign('pageTitle', 'submission.comments.copyeditComments');
00039 $templateMgr->assign('commentAction', 'postCopyeditComment');
00040 $templateMgr->assign('commentType', 'copyedit');
00041 $templateMgr->assign('hiddenFormParams',
00042 array(
00043 'articleId' => $article->getArticleId()
00044 )
00045 );
00046
00047 parent::display();
00048 }
00049
00053 function readInputData() {
00054 parent::readInputData();
00055 }
00056
00060 function execute() {
00061 parent::execute();
00062 }
00063
00067 function email() {
00068 $article = $this->article;
00069 $roleDao = &DAORegistry::getDAO('RoleDAO');
00070 $userDao = &DAORegistry::getDAO('UserDAO');
00071 $journal = &Request::getJournal();
00072
00073
00074 $recipients = array();
00075
00076
00077
00078
00079
00080 $editAssignmentDao = &DAORegistry::getDAO('EditAssignmentDAO');
00081 $editAssignments = &$editAssignmentDao->getEditAssignmentsByArticleId($article->getArticleId());
00082 $editAssignments =& $editAssignments->toArray();
00083 $editorAddresses = array();
00084 foreach ($editAssignments as $editAssignment) {
00085 if ($editAssignment->getCanEdit()) $editorAddresses[$editAssignment->getEditorEmail()] = $editAssignment->getEditorFullName();
00086 }
00087
00088
00089
00090 if (empty($editorAddresses)) {
00091 $editors = &$roleDao->getUsersByRoleId(ROLE_ID_EDITOR, $journal->getJournalId());
00092 while (!$editors->eof()) {
00093 $editor = &$editors->next();
00094 $editorAddresses[$editor->getEmail()] = $editor->getFullName();
00095 }
00096 }
00097
00098
00099 $copyAssignmentDao = &DAORegistry::getDAO('CopyAssignmentDAO');
00100 $copyAssignment = &$copyAssignmentDao->getCopyAssignmentByArticleId($article->getArticleId());
00101 if ($copyAssignment != null && $copyAssignment->getCopyeditorId() > 0) {
00102 $copyeditor = &$userDao->getUser($copyAssignment->getCopyeditorId());
00103 } else {
00104 $copyeditor = null;
00105 }
00106
00107
00108 $author = &$userDao->getUser($article->getUserId());
00109
00110
00111 if ($this->roleId == ROLE_ID_EDITOR || $this->roleId == ROLE_ID_SECTION_EDITOR) {
00112
00113 if ($copyeditor != null) {
00114 $recipients = array_merge($recipients, array($copyeditor->getEmail() => $copyeditor->getFullName()));
00115 }
00116
00117 $recipients = array_merge($recipients, array($author->getEmail() => $author->getFullName()));
00118
00119 } else if ($this->roleId == ROLE_ID_COPYEDITOR) {
00120
00121 $recipients = array_merge($recipients, $editorAddresses);
00122
00123 if (isset($author)) $recipients = array_merge($recipients, array($author->getEmail() => $author->getFullName()));
00124
00125 } else {
00126
00127 $recipients = array_merge($recipients, $editorAddresses);
00128
00129 if ($copyeditor != null) {
00130 $recipients = array_merge($recipients, array($copyeditor->getEmail() => $copyeditor->getFullName()));
00131 }
00132 }
00133
00134 parent::email($recipients);
00135 }
00136 }
00137
00138 ?>