00001 <?php
00002
00015
00016
00017
00018 import("submission.form.comment.CommentForm");
00019
00020 class PeerReviewCommentForm extends CommentForm {
00021
00023 var $reviewId;
00024
00026 var $insertedComments;
00027
00032 function PeerReviewCommentForm($article, $reviewId, $roleId) {
00033 parent::CommentForm($article, COMMENT_TYPE_PEER_REVIEW, $roleId, $reviewId);
00034 $this->reviewId = $reviewId;
00035 }
00036
00040 function display() {
00041 $reviewAssignmentDao = &DAORegistry::getDAO('ReviewAssignmentDAO');
00042 $reviewAssignment = &$reviewAssignmentDao->getReviewAssignmentById($this->reviewId);
00043 $reviewLetters = &$reviewAssignmentDao->getReviewIndexesForRound($this->article->getArticleId(), $this->article->getCurrentRound());
00044
00045 $templateMgr = &TemplateManager::getManager();
00046 $templateMgr->assign('commentType', 'peerReview');
00047 $templateMgr->assign('pageTitle', 'submission.comments.review');
00048 $templateMgr->assign('commentAction', 'postPeerReviewComment');
00049 $templateMgr->assign('commentTitle', strip_tags($this->article->getArticleTitle()));
00050 $templateMgr->assign('isLocked', isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null);
00051 $templateMgr->assign('canEmail', false);
00052 $templateMgr->assign('showReviewLetters', ($this->roleId == ROLE_ID_EDITOR || $this->roleId == ROLE_ID_SECTION_EDITOR) ? true : false);
00053 $templateMgr->assign('reviewLetters', $reviewLetters);
00054 $templateMgr->assign('reviewer', ROLE_ID_REVIEWER);
00055 $templateMgr->assign('hiddenFormParams',
00056 array(
00057 'articleId' => $this->article->getArticleId(),
00058 'reviewId' => $this->reviewId
00059 )
00060 );
00061
00062 parent::display();
00063 }
00064
00068 function readInputData() {
00069 $this->readUserVars(
00070 array(
00071 'commentTitle',
00072 'authorComments',
00073 'comments'
00074 )
00075 );
00076 }
00077
00081 function execute() {
00082
00083
00084 $commentDao = &DAORegistry::getDAO('ArticleCommentDAO');
00085 $this->insertedComments = array();
00086
00087
00088 $comment = &new ArticleComment();
00089 $comment->setCommentType($this->commentType);
00090 $comment->setRoleId($this->roleId);
00091 $comment->setArticleId($this->article->getArticleId());
00092 $comment->setAssocId($this->assocId);
00093 $comment->setAuthorId($this->user->getUserId());
00094 $comment->setCommentTitle($this->getData('commentTitle'));
00095 $comment->setDatePosted(Core::getCurrentDate());
00096
00097
00098 if ($this->getData('authorComments') != null) {
00099 $comment->setComments($this->getData('authorComments'));
00100 $comment->setViewable(1);
00101 array_push($this->insertedComments, $commentDao->insertArticleComment($comment));
00102 }
00103
00104
00105 if ($this->getData('comments') != null) {
00106 $comment->setComments($this->getData('comments'));
00107 $comment->setViewable(null);
00108 array_push($this->insertedComments, $commentDao->insertArticleComment($comment));
00109 }
00110 }
00111 }
00112
00113 ?>