コード例 #1
0
 /**
  * Add the comment.
  */
 function execute()
 {
     // Personalized execute() method since now there are possibly two comments contained within each form submission.
     $commentDao = DAORegistry::getDAO('PaperCommentDAO');
     $this->insertedComments = array();
     // Assign all common information
     $comment = new PaperComment();
     $comment->setCommentType($this->commentType);
     $comment->setRoleId($this->roleId);
     $comment->setPaperId($this->paper->getPaperId());
     $comment->setAssocId($this->assocId);
     $comment->setAuthorId($this->user->getId());
     $comment->setCommentTitle($this->getData('commentTitle'));
     $comment->setDatePosted(Core::getCurrentDate());
     // If comments "For authors and director" submitted
     if ($this->getData('authorComments') != null) {
         $comment->setComments($this->getData('authorComments'));
         $comment->setViewable(1);
         array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
     }
     // If comments "For director" submitted
     if ($this->getData('comments') != null) {
         $comment->setComments($this->getData('comments'));
         $comment->setViewable(null);
         array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
     }
 }
コード例 #2
0
ファイル: PaperCommentDAO.inc.php プロジェクト: jmacgreg/ocs
 /**
  * Creates and returns a paper comment object from a row
  * @param $row array
  * @return PaperComment object
  */
 function &_returnPaperCommentFromRow($row)
 {
     $paperComment = new PaperComment();
     $paperComment->setId($row['comment_id']);
     $paperComment->setCommentType($row['comment_type']);
     $paperComment->setRoleId($row['role_id']);
     $paperComment->setPaperId($row['paper_id']);
     $paperComment->setAssocId($row['assoc_id']);
     $paperComment->setAuthorId($row['author_id']);
     $paperComment->setCommentTitle($row['comment_title']);
     $paperComment->setComments($row['comments']);
     $paperComment->setDatePosted($this->datetimeFromDB($row['date_posted']));
     $paperComment->setDateModified($this->datetimeFromDB($row['date_modified']));
     $paperComment->setViewable($row['viewable']);
     HookRegistry::call('PaperCommentDAO::_returnPaperCommentFromRow', array(&$paperComment, &$row));
     return $paperComment;
 }
コード例 #3
0
ファイル: ImportOCS1.inc.php プロジェクト: ramonsodoma/ocs
 /**
  * Import reviews.
  */
 function importReviews()
 {
     if ($this->hasOption('verbose')) {
         printf("Importing reviews\n");
     }
     $userDao =& DAORegistry::getDAO('UserDAO');
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
     $unassignedTrackId = null;
     $result =& $this->importDao->retrieve('SELECT * FROM reviews ORDER by timestamp');
     while (!$result->EOF) {
         $row =& $result->fields;
         $schedConf =& $this->schedConfMap[$row['cf']];
         $paper =& $this->paperMap[$row['paper']];
         $reviewer =& $this->reviewerMap[$row['reviewer']];
         if (!$schedConf || !$paper || !$reviewer) {
             // Database inconsistency! Skip this entry.
             if (!$schedConf) {
                 $errors[] = "Unknown conference referenced in reviews: {$row['cf']}";
             } else {
                 unset($schedConf);
             }
             if (!$paper) {
                 $errors[] = "Unknown paper referenced in reviews: {$row['paper']}";
             } else {
                 unset($paper);
             }
             if (!$reviewer) {
                 $errors[] = "Unknown reviewer referenced in reviews: {$row['reviewer']}";
             } else {
                 unset($reviewer);
             }
             $result->MoveNext();
             continue;
         }
         $schedConfId = $schedConf->getId();
         $paperId = $paper->getId();
         $reviewerId = $reviewer->getId();
         $reviewAssignment = new ReviewAssignment();
         $reviewAssignment->setReviewerId($reviewerId);
         $reviewAssignment->setSubmissionId($paperId);
         $reviewAssignment->setRound(REVIEW_ROUND_ABSTRACT);
         // Won't always be accurate
         $reviewAssignment->setDateAssigned($row['timestamp']);
         $reviewAssignment->setDateNotified($row['timestamp']);
         $reviewAssignment->setDateConfirmed($row['timestamp']);
         $reviewAssignment->setDeclined(0);
         switch (trim(strtolower(array_shift(split("[\n\\.:]", $row['recommendation']))))) {
             case 'accept':
                 $reviewAssignment->setRecommendation(SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT);
                 $reviewAssignment->setDateCompleted($row['timestamp']);
                 break;
             case 'revise':
             case 'pending revisions':
             case 'accept with revisions':
                 $reviewAssignment->setRecommendation(SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS);
                 $reviewAssignment->setDateCompleted($row['timestamp']);
                 break;
             case 'decline':
             case 'reject':
                 $reviewAssignment->setRecommendation(SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE);
                 $reviewAssignment->setDateCompleted($row['timestamp']);
                 break;
             default:
                 // WARNING: We're not setting a recommendation here at all!
                 break;
         }
         $reviewId = $reviewAssignmentDao->insertReviewAssignment($reviewAssignment);
         $paperComment = new PaperComment();
         $paperComment->setCommentType(COMMENT_TYPE_PEER_REVIEW);
         $paperComment->setRoleId(ROLE_ID_REVIEWER);
         $paperComment->setPaperId($paperId);
         $paperComment->setAssocId($reviewId);
         $paperComment->setAuthorId($reviewerId);
         $paperComment->setCommentTitle('');
         $paperComment->setComments(Core::cleanVar($row['comments'] . "\n" . $row['recommendation']));
         $paperComment->setDatePosted($row['timestamp']);
         $paperComment->setViewable(0);
         $paperCommentDao->insertPaperComment($paperComment);
         unset($schedConf);
         unset($paper);
         unset($reviewer);
         unset($reviewAssignment);
         unset($paperComment);
         $result->MoveNext();
     }
     $result->Close();
 }
コード例 #4
0
ファイル: AuthorAction.inc.php プロジェクト: sedici/ocs
 /**
  * Email director decision comment.
  * @param $authorSubmission object
  * @param $send boolean
  */
 function emailDirectorDecisionComment($authorSubmission, $send)
 {
     $userDao =& DAORegistry::getDAO('UserDAO');
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     import('mail.PaperMailTemplate');
     $email = new PaperMailTemplate($authorSubmission);
     $editAssignments = $authorSubmission->getEditAssignments();
     $directors = array();
     foreach ($editAssignments as $editAssignment) {
         array_push($directors, $userDao->getUser($editAssignment->getDirectorId()));
     }
     if ($send && !$email->hasErrors()) {
         HookRegistry::call('AuthorAction::emailDirectorDecisionComment', array(&$authorSubmission, &$email));
         $email->send();
         $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
         $paperComment = new PaperComment();
         $paperComment->setCommentType(COMMENT_TYPE_DIRECTOR_DECISION);
         $paperComment->setRoleId(ROLE_ID_AUTHOR);
         $paperComment->setPaperId($authorSubmission->getPaperId());
         $paperComment->setAuthorId($authorSubmission->getUserId());
         $paperComment->setCommentTitle($email->getSubject());
         $paperComment->setComments($email->getBody());
         $paperComment->setDatePosted(Core::getCurrentDate());
         $paperComment->setViewable(true);
         $paperComment->setAssocId($authorSubmission->getPaperId());
         $paperCommentDao->insertPaperComment($paperComment);
         return true;
     } else {
         if (!Request::getUserVar('continued')) {
             $email->setSubject($authorSubmission->getLocalizedTitle());
             if (!empty($directors)) {
                 foreach ($directors as $director) {
                     $email->addRecipient($director->getEmail(), $director->getFullName());
                 }
             } else {
                 $email->addRecipient($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
             }
         }
         $email->displayEditForm(Request::url(null, null, null, 'emailDirectorDecisionComment', 'send'), array('paperId' => $authorSubmission->getPaperId()), 'submission/comment/directorDecisionEmail.tpl');
         return false;
     }
 }
コード例 #5
0
 /**
  * Email director decision comment.
  * @param $trackDirectorSubmission object
  * @param $send boolean
  */
 function emailDirectorDecisionComment($trackDirectorSubmission, $send)
 {
     $userDao =& DAORegistry::getDAO('UserDAO');
     $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $templateName = null;
     $reviewMode = $trackDirectorSubmission->getReviewMode();
     $stages = $trackDirectorSubmission->getDecisions();
     if (is_array($stages)) {
         $isAbstract = array_pop(array_keys($stages)) == REVIEW_STAGE_ABSTRACT;
     }
     if (isset($stages) && is_array($stages)) {
         $decisions = array_pop($stages);
         // If this round has no decision, revert to prior round
         if (empty($decisions)) {
             $decisions = array_pop($stages);
         }
     }
     if (isset($decisions) && is_array($decisions)) {
         $lastDecision = array_pop($decisions);
     }
     if (isset($lastDecision) && is_array($lastDecision)) {
         switch ($lastDecision['decision']) {
             case SUBMISSION_DIRECTOR_DECISION_INVITE:
                 $templateName = $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_PAPER_INVITE' : 'SUBMISSION_ABSTRACT_ACCEPT';
                 break;
             case SUBMISSION_DIRECTOR_DECISION_ACCEPT:
                 $templateName = 'SUBMISSION_PAPER_ACCEPT';
                 break;
             case SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS:
                 $templateName = $isAbstract ? 'SUBMISSION_ABSTRACT_REVISE' : 'SUBMISSION_PAPER_REVISE';
                 break;
             case SUBMISSION_DIRECTOR_DECISION_DECLINE:
                 $templateName = $isAbstract ? 'SUBMISSION_ABSTRACT_DECLINE' : 'SUBMISSION_PAPER_DECLINE';
                 break;
         }
     }
     $user =& Request::getUser();
     import('mail.PaperMailTemplate');
     $email = new PaperMailTemplate($trackDirectorSubmission, $templateName);
     if ($send && !$email->hasErrors()) {
         HookRegistry::call('TrackDirectorAction::emailDirectorDecisionComment', array(&$trackDirectorSubmission, &$send));
         $email->send();
         $paperComment = new PaperComment();
         $paperComment->setCommentType(COMMENT_TYPE_DIRECTOR_DECISION);
         $paperComment->setRoleId(Validation::isDirector() ? ROLE_ID_DIRECTOR : ROLE_ID_TRACK_DIRECTOR);
         $paperComment->setPaperId($trackDirectorSubmission->getPaperId());
         $paperComment->setAuthorId($trackDirectorSubmission->getUserId());
         $paperComment->setCommentTitle($email->getSubject());
         $paperComment->setComments($email->getBody());
         $paperComment->setDatePosted(Core::getCurrentDate());
         $paperComment->setViewable(true);
         $paperComment->setAssocId($trackDirectorSubmission->getPaperId());
         $paperCommentDao->insertPaperComment($paperComment);
         return true;
     } else {
         if (!Request::getUserVar('continued')) {
             $authorUser =& $userDao->getUser($trackDirectorSubmission->getUserId());
             $authorEmail = $authorUser->getEmail();
             $email->addRecipient($authorEmail, $authorUser->getFullName());
             if ($schedConf->getSetting('notifyAllAuthorsOnDecision')) {
                 foreach ($trackDirectorSubmission->getAuthors() as $author) {
                     if ($author->getEmail() != $authorEmail) {
                         $email->addCc($author->getEmail(), $author->getFullName());
                     }
                 }
             }
             $email->assignParams(array('conferenceDate' => strftime(Config::getVar('general', 'date_format_short'), $schedConf->getSetting('startDate')), 'authorName' => $authorUser->getFullName(), 'conferenceTitle' => $conference->getConferenceTitle(), 'editorialContactSignature' => $user->getContactSignature(), 'locationCity' => $schedConf->getSetting('locationCity'), 'paperTitle' => $trackDirectorSubmission->getLocalizedTitle()));
         } elseif (Request::getUserVar('importPeerReviews')) {
             $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
             $hasBody = false;
             for ($stage = $trackDirectorSubmission->getCurrentStage(); $stage == REVIEW_STAGE_ABSTRACT || $stage == REVIEW_STAGE_PRESENTATION; $stage--) {
                 $reviewAssignments =& $reviewAssignmentDao->getReviewAssignmentsByPaperId($trackDirectorSubmission->getPaperId(), $stage);
                 $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForStage($trackDirectorSubmission->getPaperId(), $stage);
                 $body = '';
                 foreach ($reviewAssignments as $reviewAssignment) {
                     // If the reviewer has completed the assignment, then import the review.
                     if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) {
                         // Get the comments associated with this review assignment
                         $paperComments =& $paperCommentDao->getPaperComments($trackDirectorSubmission->getPaperId(), COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId());
                         if ($paperComments) {
                             $body .= "------------------------------------------------------\n";
                             $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => chr(ord('A') + $reviewIndexes[$reviewAssignment->getId()]))) . "\n";
                             if (is_array($paperComments)) {
                                 foreach ($paperComments as $comment) {
                                     // If the comment is viewable by the author, then add the comment.
                                     if ($comment->getViewable()) {
                                         $body .= String::html2utf(strip_tags(str_replace(array('<p>', '<br>', '<br/>'), array("\n", "\n", "\n"), $comment->getComments()))) . "\n\n";
                                         $hasBody = true;
                                     }
                                 }
                             }
                             $body .= "------------------------------------------------------\n\n";
                         }
                         if ($reviewFormId = $reviewAssignment->getReviewFormId()) {
                             $reviewId = $reviewAssignment->getId();
                             $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
                             $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
                             $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
                             if (!$paperComments) {
                                 $body .= "------------------------------------------------------\n";
                                 $body .= Locale::translate('submission.comments.importPeerReviews.reviewerLetter', array('reviewerLetter' => chr(ord('A') + $reviewIndexes[$reviewAssignment->getId()]))) . "\n\n";
                             }
                             foreach ($reviewFormElements as $reviewFormElement) {
                                 if ($reviewFormElement->getIncluded()) {
                                     $body .= strip_tags($reviewFormElement->getLocalizedQuestion()) . ": \n";
                                     $reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId());
                                     if ($reviewFormResponse) {
                                         $possibleResponses = $reviewFormElement->getLocalizedPossibleResponses();
                                         if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) {
                                             if ($reviewFormElement->getElementType() == REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) {
                                                 foreach ($reviewFormResponse->getValue() as $value) {
                                                     $body .= "\t" . String::html2utf(strip_tags($possibleResponses[$value - 1]['content'])) . "\n";
                                                 }
                                             } else {
                                                 $body .= "\t" . String::html2utf(strip_tags($possibleResponses[$reviewFormResponse->getValue() - 1]['content'])) . "\n";
                                             }
                                             $body .= "\n";
                                         } else {
                                             $body .= "\t" . String::html2utf(strip_tags($reviewFormResponse->getValue())) . "\n\n";
                                         }
                                     }
                                 }
                             }
                             $body .= "------------------------------------------------------\n\n";
                             $hasBody = true;
                         }
                     }
                     // if
                 }
                 // foreach
                 if ($hasBody) {
                     $oldBody = $email->getBody();
                     if (!empty($oldBody)) {
                         $oldBody .= "\n";
                     }
                     $email->setBody($oldBody . $body);
                     break;
                 }
             }
             // foreach
         }
         $email->displayEditForm(Request::url(null, null, null, 'emailDirectorDecisionComment', 'send'), array('paperId' => $trackDirectorSubmission->getPaperId()), 'submission/comment/directorDecisionEmail.tpl', array('isADirector' => true));
         return false;
     }
 }
コード例 #6
0
ファイル: CommentForm.inc.php プロジェクト: ramonsodoma/ocs
 /**
  * Add the comment.
  */
 function execute()
 {
     $commentDao =& DAORegistry::getDAO('PaperCommentDAO');
     $paper = $this->paper;
     // Insert new comment
     $comment = new PaperComment();
     $comment->setCommentType($this->commentType);
     $comment->setRoleId($this->roleId);
     $comment->setPaperId($paper->getId());
     $comment->setAssocId($this->assocId);
     $comment->setAuthorId($this->user->getId());
     $comment->setCommentTitle($this->getData('commentTitle'));
     $comment->setComments($this->getData('comments'));
     $comment->setDatePosted(Core::getCurrentDate());
     $comment->setViewable($this->getData('viewable'));
     $this->commentId = $commentDao->insertPaperComment($comment);
 }
コード例 #7
0
ファイル: AuthorAction.inc.php プロジェクト: pulipulichen/ocs
 /**
  * Email director decision comment.
  * @param $authorSubmission object
  * @param $send boolean
  */
 function emailDirector($authorSubmission, $send, $director)
 {
     $userDao =& DAORegistry::getDAO('UserDAO');
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     import('mail.PaperMailTemplate');
     $templateName = 'AUTHOR_EMAIL_DIRECTOR';
     $email = new PaperMailTemplate($authorSubmission, $templateName);
     $editAssignments = $authorSubmission->getEditAssignments();
     $directors = array($director);
     if ($send && !$email->hasErrors()) {
         HookRegistry::call('AuthorAction::emailDirector', array(&$authorSubmission, &$email));
         $email->send();
         $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
         $paperComment = new PaperComment();
         $paperComment->setCommentType(COMMENT_TYPE_DIRECTOR_DECISION);
         $paperComment->setRoleId(ROLE_ID_AUTHOR);
         $paperComment->setPaperId($authorSubmission->getPaperId());
         $paperComment->setAuthorId($authorSubmission->getUserId());
         $paperComment->setCommentTitle($email->getSubject());
         $paperComment->setComments($email->getBody());
         $paperComment->setDatePosted(Core::getCurrentDate());
         $paperComment->setViewable(true);
         $paperComment->setAssocId($authorSubmission->getPaperId());
         $paperCommentDao->insertPaperComment($paperComment);
         return true;
     } else {
         if (!Request::getUserVar('continued')) {
             //$subject = $authorSubmission->getLocalizedTitle();
             $subject = $email->getSubject();
             //$subject = "[" . $schedConf->getLocalizedAcronym() . "] " . $subject;
             $email->setSubject($subject);
             if (!empty($directors)) {
                 foreach ($directors as $director) {
                     $email->addRecipient($director->getEmail(), $director->getFullName());
                 }
             } else {
                 $email->addRecipient($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
             }
             //--------------------------
             $authorUser =& $userDao->getUser($authorSubmission->getUserId());
             //$submissionUrl = $submissionUrl . '?u=' . $authorUser->getUserId();
             $authorEmail = $authorUser->getEmail();
             $email->addRecipient($authorEmail, $authorUser->getFullName());
             if ($schedConf->getSetting('notifyAllAuthorsOnDecision')) {
                 foreach ($authorSubmission->getAuthors() as $author) {
                     if ($author->getEmail() != $authorEmail) {
                         $email->addCc($author->getEmail(), $author->getFullName());
                     }
                 }
             }
             $submissionUrl = Request::url(null, null, 'director', 'submissionReview', $authorSubmission->getPaperId());
             $email->assignParams(array('contactName' => $director->getFullName(), 'conferenceDate' => strftime(Config::getVar('general', 'date_format_short'), $schedConf->getSetting('startDate')), 'authorName' => $authorUser->getFullName(), 'conferenceTitle' => $conference->getConferenceTitle(), 'editorialContactSignature' => $user->getContactSignature(), 'locationCity' => $schedConf->getSetting('locationCity'), 'paperTitle' => $authorSubmission->getLocalizedTitle(), 'submissionUrl' => $submissionUrl));
             // ---------------------------
         }
         $email->displayEditForm(Request::url(null, null, null, 'emailDirectorDecisionComment', 'send'), array('paperId' => $authorSubmission->getPaperId()), 'submission/comment/directorDecisionEmail.tpl', array('isADirector' => false, 'templateName' => $templateName));
         return false;
     }
 }