00001 <?php
00002
00015
00016
00017
00018 import("submission.form.comment.CommentForm");
00019
00020 class LayoutCommentForm extends CommentForm {
00021
00026 function LayoutCommentForm($article, $roleId) {
00027 parent::CommentForm($article, COMMENT_TYPE_LAYOUT, $roleId, $article->getArticleId());
00028 }
00029
00033 function display() {
00034 $templateMgr = &TemplateManager::getManager();
00035 $templateMgr->assign('pageTitle', 'submission.comments.comments');
00036 $templateMgr->assign('commentAction', 'postLayoutComment');
00037 $templateMgr->assign('commentType', 'layout');
00038 $templateMgr->assign('hiddenFormParams',
00039 array(
00040 'articleId' => $this->article->getArticleId()
00041 )
00042 );
00043
00044 parent::display();
00045 }
00046
00050 function readInputData() {
00051 parent::readInputData();
00052 }
00053
00057 function execute() {
00058 parent::execute();
00059 }
00060
00064 function email() {
00065 $roleDao = &DAORegistry::getDAO('RoleDAO');
00066 $userDao = &DAORegistry::getDAO('UserDAO');
00067 $journal = &Request::getJournal();
00068
00069
00070
00071
00072
00073 $recipients = array();
00074
00075 if ($this->roleId == ROLE_ID_EDITOR || $this->roleId == ROLE_ID_SECTION_EDITOR) {
00076
00077 $layoutAssignmentDao = &DAORegistry::getDAO('LayoutAssignmentDAO');
00078 $layoutAssignment = &$layoutAssignmentDao->getLayoutAssignmentByArticleId($this->article->getArticleId());
00079
00080
00081 if ($layoutAssignment != null && $layoutAssignment->getEditorId() > 0) {
00082 $user = &$userDao->getUser($layoutAssignment->getEditorId());
00083
00084 if ($user) $recipients = array_merge($recipients, array($user->getEmail() => $user->getFullName()));
00085 }
00086 } else {
00087
00088 $editAssignmentDao = &DAORegistry::getDAO('EditAssignmentDAO');
00089 $editAssignments = &$editAssignmentDao->getEditAssignmentsByArticleId($this->article->getArticleId());
00090 $editorAddresses = array();
00091 while (!$editAssignments->eof()) {
00092 $editAssignment =& $editAssignments->next();
00093 if ($editAssignment->getCanEdit()) $editorAddresses[$editAssignment->getEditorEmail()] = $editAssignment->getEditorFullName();
00094 unset($editAssignment);
00095 }
00096
00097
00098
00099 if (empty($editorAddresses)) {
00100 $editors = &$roleDao->getUsersByRoleId(ROLE_ID_EDITOR, $journal->getJournalId());
00101 while (!$editors->eof()) {
00102 $editor = &$editors->next();
00103 $editorAddresses[$editor->getEmail()] = $editor->getFullName();
00104 }
00105 }
00106 $recipients = array_merge($recipients, $editorAddresses);
00107 }
00108
00109 parent::email($recipients);
00110 }
00111 }
00112
00113 ?>