pages/trackDirector/SubmissionCommentsHandler.inc.php

00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.trackDirector.SubmissionEditHandler');
00018 
00019 class SubmissionCommentsHandler extends TrackDirectorHandler {
00021    var $comment;
00022    
00026    function SubmissionCommentsHandler() {
00027       parent::TrackDirectorHandler();
00028    }
00029 
00033    function viewPeerReviewComments($args) {
00034       parent::validate();
00035       $this->setupTemplate(true);
00036 
00037       $paperId = $args[0];
00038       $reviewId = $args[1];
00039 
00040       $submissionEditHandler = new SubmissionEditHandler();
00041       $submissionEditHandler->validate($paperId);
00042       $paperDao =& DAORegistry::getDAO('PaperDAO');
00043       $submission =& $paperDao->getPaper($paperId);
00044       
00045       TrackDirectorAction::viewPeerReviewComments($submission, $reviewId);
00046    }
00047 
00051    function postPeerReviewComment() {
00052       parent::validate();
00053       $this->setupTemplate(true);
00054 
00055       $paperId = Request::getUserVar('paperId');
00056       $reviewId = Request::getUserVar('reviewId');
00057 
00058       // If the user pressed the "Save and email" button, then email the comment.
00059       $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00060 
00061       $submissionEditHandler = new SubmissionEditHandler();
00062       $submissionEditHandler->validate($paperId);
00063       $paperDao =& DAORegistry::getDAO('PaperDAO');
00064       $submission =& $paperDao->getPaper($paperId);
00065 
00066       if (TrackDirectorAction::postPeerReviewComment($submission, $reviewId, $emailComment)) {
00067          TrackDirectorAction::viewPeerReviewComments($submission, $reviewId);
00068       }
00069    }
00070 
00074    function viewDirectorDecisionComments($args) {
00075       parent::validate();
00076       $this->setupTemplate(true);
00077 
00078       $paperId = $args[0];
00079 
00080       $submissionEditHandler = new SubmissionEditHandler();
00081       $submissionEditHandler->validate($paperId);
00082       $paperDao =& DAORegistry::getDAO('PaperDAO');
00083       $submission =& $paperDao->getPaper($paperId);
00084       
00085       TrackDirectorAction::viewDirectorDecisionComments($submission);
00086    }
00087 
00091    function postDirectorDecisionComment() {
00092       parent::validate();
00093       $this->setupTemplate(true);
00094 
00095       $paperId = Request::getUserVar('paperId');
00096 
00097       // If the user pressed the "Save and email" button, then email the comment.
00098       $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00099 
00100       $submissionEditHandler = new SubmissionEditHandler();
00101       $submissionEditHandler->validate($paperId);
00102       $paperDao =& DAORegistry::getDAO('PaperDAO');
00103       $submission =& $paperDao->getPaper($paperId);
00104       
00105       if (TrackDirectorAction::postDirectorDecisionComment($submission, $emailComment)) {
00106          TrackDirectorAction::viewDirectorDecisionComments($submission);
00107       }
00108    }
00109 
00113    function blindCcReviewsToReviewers($args = array()) {
00114       $paperId = Request::getUserVar('paperId');
00115       $submissionEditHandler = new SubmissionEditHandler();
00116       $submissionEditHandler->validate($paperId);
00117       $paperDao =& DAORegistry::getDAO('PaperDAO');
00118       $submission =& $paperDao->getPaper($paperId);
00119 
00120       $send = Request::getUserVar('send')?true:false;
00121       $inhibitExistingEmail = Request::getUserVar('blindCcReviewers')?true:false;
00122 
00123       if (!$send) parent::setupTemplate(true, $paperId, 'review');
00124       if (TrackDirectorAction::blindCcReviewsToReviewers($submission, $send, $inhibitExistingEmail)) {
00125          Request::redirect(null, null, null, 'submissionReview', $paperId);
00126       }
00127    }
00128 
00132    function emailDirectorDecisionComment() {
00133       $paperId = (int) Request::getUserVar('paperId');
00134       $submissionEditHandler = new SubmissionEditHandler();
00135       $submissionEditHandler->validate($paperId);
00136       $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
00137       $submission =& $trackDirectorSubmissionDao->getTrackDirectorSubmission($paperId);
00138 
00139       parent::setupTemplate(true);     
00140       if (TrackDirectorAction::emailDirectorDecisionComment($submission, Request::getUserVar('send'))) {
00141          if (Request::getUserVar('blindCcReviewers')) {
00142             $this->blindCcReviewsToReviewers();
00143          } else {
00144             Request::redirect(null, null, null, 'submissionReview', array($paperId));
00145          }
00146       }
00147    }
00148 
00152    function editComment($args) {
00153       $paperId = $args[0];
00154       $commentId = $args[1];
00155 
00156       $submissionEditHandler = new SubmissionEditHandler();
00157       $submissionEditHandler->validate($paperId);
00158       $paperDao =& DAORegistry::getDAO('PaperDAO');
00159       $submission =& $paperDao->getPaper($paperId);
00160 
00161       $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
00162       $this->validate();
00163       $comment =& $this->comment;
00164       
00165       $this->setupTemplate(true);
00166 
00167       if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
00168          // Cannot edit a director decision comment.
00169          Request::redirect(null, null, Request::getRequestedPage());
00170       }
00171 
00172       TrackDirectorAction::editComment($submission, $comment);
00173 
00174    }
00175 
00179    function saveComment() {
00180       $paperId = Request::getUserVar('paperId');
00181       $commentId = Request::getUserVar('commentId');
00182 
00183       // If the user pressed the "Save and email" button, then email the comment.
00184       $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00185 
00186       $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
00187       $this->validate();
00188       $comment =& $this->comment;
00189 
00190       $this->setupTemplate(true);
00191       
00192       $submissionEditHandler = new SubmissionEditHandler();
00193       $submissionEditHandler->validate($paperId);
00194       $paperDao =& DAORegistry::getDAO('PaperDAO');
00195       $submission =& $paperDao->getPaper($paperId);
00196       
00197       if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
00198          // Cannot edit a director decision comment.
00199          Request::redirect(null, null, Request::getRequestedPage());
00200       }
00201 
00202       // Save the comment.
00203       TrackDirectorAction::saveComment($submission, $comment, $emailComment);
00204 
00205       // refresh the comment
00206       $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
00207       $comment =& $paperCommentDao->getPaperCommentById($commentId);
00208 
00209       // Redirect back to initial comments page
00210       if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) {
00211          Request::redirect(null, null, null, 'viewPeerReviewComments', array($paperId, $comment->getAssocId()));
00212       } else if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
00213          Request::redirect(null, null, null, 'viewDirectorDecisionComments', $paperId);
00214       }
00215    }
00216 
00220    function deleteComment($args) {
00221       $paperId = $args[0];
00222       $commentId = $args[1];
00223       
00224       $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
00225       $this->validate();
00226       $comment =& $this->comment;
00227 
00228       $submissionEditHandler = new SubmissionEditHandler();
00229       $submissionEditHandler->validate($paperId);
00230       $paperDao =& DAORegistry::getDAO('PaperDAO');
00231       $submission =& $paperDao->getPaper($paperId);
00232       
00233       TrackDirectorAction::deleteComment($commentId);
00234 
00235       // Redirect back to initial comments page
00236       if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) {
00237          Request::redirect(null, null, null, 'viewPeerReviewComments', array($paperId, $comment->getAssocId()));
00238       } else if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
00239          Request::redirect(null, null, null, 'viewDirectorDecisionComments', $paperId);
00240       }
00241 
00242    }
00243 }
00244 ?>

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