pages/reviewer/SubmissionCommentsHandler.inc.php

00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.reviewer.SubmissionReviewHandler');
00018 
00019 class SubmissionCommentsHandler extends ReviewerHandler {
00021    var $comment;
00022    
00026    function SubmissionCommentsHandler() {
00027       parent::ReviewerHandler();
00028    }
00029 
00033    function viewPeerReviewComments($args) {
00034       $paperId = $args[0];
00035       $reviewId = $args[1];
00036 
00037       $submissionReviewHandler = new SubmissionReviewHandler();
00038       $submissionReviewHandler->validate($reviewId);
00039       $paperDao =& DAORegistry::getDAO('PaperDAO');
00040       $submission =& $paperDao->getPaper($paperId);
00041       
00042       $user =& Request::getUser();
00043 
00044       $this->setupTemplate(true);
00045       ReviewerAction::viewPeerReviewComments($user, $submission, $reviewId);
00046 
00047    }
00048 
00052    function postPeerReviewComment() {
00053       $paperId = Request::getUserVar('paperId');
00054       $reviewId = Request::getUserVar('reviewId');
00055 
00056       // If the user pressed the "Save and email" button, then email the comment.
00057       $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00058 
00059       $submissionReviewHandler = new SubmissionReviewHandler();
00060       $submissionReviewHandler->validate($reviewId);
00061       $paperDao =& DAORegistry::getDAO('PaperDAO');
00062       $submission =& $paperDao->getPaper($paperId);
00063       $user =& $submissionReviewHandler->user;
00064 
00065       $this->setupTemplate(true);
00066       if (ReviewerAction::postPeerReviewComment($user, $submission, $reviewId, $emailComment)) {
00067          ReviewerAction::viewPeerReviewComments($user, $submission, $reviewId);
00068       }
00069    }
00070 
00074    function editComment($args) {
00075       $paperId = $args[0];
00076       $commentId = $args[1];
00077       $reviewId = Request::getUserVar('reviewId');
00078 
00079       $paperDao =& DAORegistry::getDAO('PaperDAO');
00080       $submission = $paperDao->getPaper($paperId);
00081 
00082       $submissionReviewHandler = new SubmissionReviewHandler();
00083       $submissionReviewHandler->validate($reviewId);
00084       $user =& $submissionReviewHandler->user;
00085 
00086       $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId, $user));
00087       $this->validate();
00088       $comment =& $this->comment;
00089       
00090       $this->setupTemplate(true);
00091 
00092       ReviewerAction::editComment($submission, $comment, $reviewId);
00093    }
00094 
00098    function saveComment() {
00099       $paperId = Request::getUserVar('paperId');
00100       $commentId = Request::getUserVar('commentId');
00101       $reviewId = Request::getUserVar('reviewId');
00102 
00103       $paperDao =& DAORegistry::getDAO('PaperDAO');
00104       $submission = $paperDao->getPaper($paperId);
00105 
00106       $submissionReviewHandler = new SubmissionReviewHandler();
00107       $submissionReviewHandler->validate($reviewId);
00108       $user =& $submissionReviewHandler->user;
00109 
00110       $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId, $user));
00111       $this->validate();
00112       $comment =& $this->comment;
00113       
00114       // If the user pressed the "Save and email" button, then email the comment.
00115       $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00116 
00117       $this->setupTemplate(true);
00118 
00119       ReviewerAction::saveComment($submission, $comment, $emailComment);
00120 
00121       // Refresh the comment
00122       $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
00123       $comment =& $paperCommentDao->getPaperCommentById($commentId);
00124 
00125       // Redirect back to initial comments page
00126       if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) {
00127          Request::redirect(null, null, null, 'viewPeerReviewComments', array($paperId, $comment->getAssocId()));
00128       }
00129    }
00130 
00134    function deleteComment($args) {
00135       $paperId = $args[0];
00136       $commentId = $args[1];
00137       $reviewId = Request::getUserVar('reviewId');
00138       
00139       $this->setupTemplate(true);
00140       
00141       $submissionReviewHandler = new SubmissionReviewHandler();
00142       $submissionReviewHandler->validate($reviewId);
00143       $user =& $submissionReviewHandler->user;
00144 
00145       $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId, $user));
00146       $this->validate();
00147       $comment =& $this->comment;
00148       ReviewerAction::deleteComment($commentId, $user);
00149 
00150       // Redirect back to initial comments page
00151       if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) {
00152          Request::redirect(null, null, null, 'viewPeerReviewComments', array($paperId, $comment->getAssocId()));
00153       }
00154    }
00155 }
00156 ?>

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