classes/submission/form/comment/PeerReviewCommentForm.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import("submission.form.comment.CommentForm");
00018 
00019 class PeerReviewCommentForm extends CommentForm {
00020 
00022    var $reviewId;
00023 
00025    var $insertedComments;
00026 
00031    function PeerReviewCommentForm($paper, $reviewId, $roleId) {
00032       parent::CommentForm($paper, COMMENT_TYPE_PEER_REVIEW, $roleId, $reviewId);
00033       $this->reviewId = $reviewId;
00034    }
00035 
00039    function display() {
00040       $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
00041       $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($this->reviewId);
00042       $reviewLetters =& $reviewAssignmentDao->getReviewIndexesForStage($this->paper->getPaperId(), $this->paper->getCurrentStage());
00043 
00044       $templateMgr =& TemplateManager::getManager();
00045       $templateMgr->assign('commentType', 'peerReview');
00046       $templateMgr->assign('pageTitle', 'submission.comments.review');
00047       $templateMgr->assign('commentAction', 'postPeerReviewComment');
00048       $templateMgr->assign('commentTitle', strip_tags($this->paper->getLocalizedTitle()));
00049       $templateMgr->assign('isLocked', isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null);
00050       $templateMgr->assign('canEmail', false); // Previously, directors could always email.
00051       $templateMgr->assign('showReviewLetters', $this->roleId == ROLE_ID_DIRECTOR ? true : false);
00052       $templateMgr->assign('reviewLetters', $reviewLetters);
00053       $templateMgr->assign('reviewer', ROLE_ID_REVIEWER);
00054       $templateMgr->assign('hiddenFormParams', 
00055          array(
00056             'paperId' => $this->paper->getPaperId(),
00057             'reviewId' => $this->reviewId
00058          )
00059       );
00060 
00061       parent::display();
00062    }
00063 
00067    function readInputData() {
00068       $this->readUserVars(
00069          array(
00070             'commentTitle',
00071             'authorComments',
00072             'comments'
00073          )
00074       );
00075    }
00076 
00080    function execute() {
00081       // Personalized execute() method since now there are possibly two comments contained within each form submission.
00082 
00083       $commentDao =& DAORegistry::getDAO('PaperCommentDAO');
00084       $this->insertedComments = array();
00085 
00086       // Assign all common information 
00087       $comment = new PaperComment();
00088       $comment->setCommentType($this->commentType);
00089       $comment->setRoleId($this->roleId);
00090       $comment->setPaperId($this->paper->getPaperId());
00091       $comment->setAssocId($this->assocId);
00092       $comment->setAuthorId($this->user->getId());
00093       $comment->setCommentTitle($this->getData('commentTitle'));
00094       $comment->setDatePosted(Core::getCurrentDate());
00095 
00096       // If comments "For authors and director" submitted
00097       if ($this->getData('authorComments') != null) {
00098          $comment->setComments($this->getData('authorComments'));
00099          $comment->setViewable(1);
00100          array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
00101       }     
00102 
00103       // If comments "For director" submitted
00104       if ($this->getData('comments') != null) {
00105          $comment->setComments($this->getData('comments'));
00106          $comment->setViewable(null);
00107          array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
00108       }
00109    }
00110 }
00111 
00112 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7