Exemple #1
0
 function confirmSubmission(&$paper, &$user, &$schedConf, &$conference, $mailTemplate = 'SUBMISSION_ACK')
 {
     // Update search index
     import('classes.search.PaperSearchIndex');
     PaperSearchIndex::indexPaperMetadata($paper);
     PaperSearchIndex::indexPaperFiles($paper);
     // Send author notification email
     import('classes.mail.PaperMailTemplate');
     $mail = new PaperMailTemplate($paper, $mailTemplate, null, null, null, null, false, true);
     $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
     if ($mail->isEnabled()) {
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         // If necessary, BCC the acknowledgement to someone.
         if ($schedConf->getSetting('copySubmissionAckPrimaryContact')) {
             $mail->addBcc($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
         }
         if ($schedConf->getSetting('copySubmissionAckSpecified')) {
             $copyAddress = $schedConf->getSetting('copySubmissionAckAddress');
             if (!empty($copyAddress)) {
                 $mail->addBcc($copyAddress);
             }
         }
         $editAssignmentDao = DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paper->getId());
         while ($editAssignment =& $editAssignments->next()) {
             $mail->addBcc($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName());
             unset($editAssignment);
         }
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $schedConf->getSetting('contactName') . "\n" . $conference->getLocalizedName(), 'submissionUrl' => Request::url(null, null, 'author', 'submission', $paper->getId())));
         $mail->send();
     }
 }
Exemple #2
0
 function sendReminder($reviewAssignment, $paper, $conference, $schedConf)
 {
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     $reviewId = $reviewAssignment->getId();
     $reviewer =& $userDao->getById($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return false;
     }
     import('classes.mail.PaperMailTemplate');
     $reviewerAccessKeysEnabled = $schedConf->getSetting('reviewerAccessKeysEnabled');
     $email = new PaperMailTemplate($paper, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', $conference->getPrimaryLocale(), false, $conference, $schedConf);
     $email->setConference($conference);
     $email->setSchedConf($schedConf);
     $contactEmail = $schedConf->getSetting('contactEmail') ? $schedConf->getSetting('contactEmail') : $conference->getSetting('contactEmail');
     $contactName = $schedConf->getSetting('contactName') ? $schedConf->getSetting('contactName') : $conference->getSetting('contactName');
     $email->setFrom($contactEmail, $contactName);
     $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
     $email->setAssoc(PAPER_EMAIL_REVIEW_REMIND, PAPER_EMAIL_TYPE_REVIEW, $reviewId);
     $email->setSubject($email->getSubject($conference->getPrimaryLocale()));
     $email->setBody($email->getBody($conference->getPrimaryLocale()));
     $urlParams = array();
     if ($reviewerAccessKeysEnabled) {
         import('lib.pkp.classes.security.AccessKeyManager');
         $accessKeyManager = new AccessKeyManager();
         // Key lifetime is the typical review period plus four weeks
         if ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_ABSOLUTE) {
             // Get number of days from now until review deadline date
             $reviewDeadlineDate = $schedConf->getSetting('numWeeksPerReviewAbsolute');
             $daysDiff = ($reviewDeadlineDate - strtotime(date("Y-m-d"))) / (60 * 60 * 24);
             $keyLifetime = (round($daysDiff / 7) + 4) * 7;
         } elseif ($schedConf->getSetting('reviewDeadlineType') == REVIEW_DEADLINE_TYPE_RELATIVE) {
             $keyLifetime = ((int) $schedConf->getSetting('numWeeksPerReviewRelative') + 4) * 7;
         }
         $urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
     }
     $submissionReviewUrl = Request::url($conference->getPath(), $schedConf->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
     // Format the review due date
     $reviewDueDate = strtotime($reviewAssignment->getDateDue());
     $dateFormatShort = Config::getVar('general', 'date_format_short');
     if ($reviewDueDate === -1 || $reviewDueDate === false) {
         // Use something human-readable if unspecified.
         $reviewDueDate = '_____';
     } else {
         $reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
     }
     $paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'conferenceUrl' => Request::url($conference->getPath()), 'schedConfUrl' => Request::url($conference->getPath(), $schedConf->getPath()), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'weekLaterDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week')), 'editorialContactSignature' => $contactName . "\n" . $schedConf->getLocalizedName(), 'passwordResetUrl' => Request::url($conference->getPath(), $schedConf->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionReviewUrl);
     $email->assignParams($paramArray);
     $email->send();
     $reviewAssignment->setDateReminded(Core::getCurrentDate());
     $reviewAssignment->setReminderWasAutomatic(1);
     $reviewAssignmentDao->updateObject($reviewAssignment);
 }
 function confirmSubmissionBBC(&$paper, $user, &$schedConf, &$conference, $mailTemplate = 'SUBMISSION_ACK_BCC')
 {
     // Update search index
     import('search.PaperSearchIndex');
     PaperSearchIndex::indexPaperMetadata($paper);
     PaperSearchIndex::indexPaperFiles($paper);
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $directors =& $roleDao->getUsersArrayByRoleId(ROLE_ID_DIRECTOR, $conference->getId(), $schedConf->getId());
     //print_r($users->toArray());
     //echo count($users);
     // 嘗試找看看有沒有這位使用者
     //$userDao =& DAORegistry::getDAO('UserDAO');
     //$contactUser = $userDao->getUserByEmail($schedConf->getSetting('contactEmail'));
     //                if (isset($contactUser)) {
     //                    $submissionUrl = $submissionUrl . "?u=" . $contactUser->getUserId();
     //                }
     //                $contactName = $schedConf->getSetting('contactName');
     //                $contactEmail = $schedConf->getSetting('contactEmail');
     //                if (isset($contactUser)) {
     //                    $contactName = $contactUser->getFullName();
     //                    $contactEmail = $contactUser->getEmail();
     //                }
     // Send author notification email
     import('mail.PaperMailTemplate');
     $mail = new PaperMailTemplate($paper, $mailTemplate, null, false, $conference, $schedConf, true, true);
     $mail->setBccSender(false);
     $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
     if ($mail->isEnabled() && count($directors > 0)) {
         $contactName = "";
         foreach ($directors as $director) {
             $mail->addRecipient($director->getEmail(), $director->getFullName());
             if ($contactName !== "") {
                 $contactName .= ", ";
             }
             $contactName .= $director->getFullName();
         }
         //			$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         //			$editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paper->getId());
         //			while ($editAssignment =& $editAssignments->next()) {
         //				$mail->addBcc($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName());
         //				unset($editAssignment);
         //			}
         $submissionUrl = Request::url(null, null, 'director', 'submissionReview', $paper->getId());
         $mail->assignParams(array('contactName' => $contactName, 'authorName' => trim($user->getFullName()), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $schedConf->getSetting('contactName') . "\n" . $conference->getConferenceTitle(), 'submissionUrl' => $submissionUrl));
         $mail->send();
     }
 }
Exemple #4
0
 /**
  * Records the reviewer's submission recommendation.
  * @param $reviewId int
  * @param $recommendation int
  * @param $send boolean
  */
 function recordRecommendation(&$reviewerSubmission, $recommendation, $send)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     // Check validity of selected recommendation
     $reviewerRecommendationOptions =& ReviewAssignment::getReviewerRecommendationOptions();
     if (!isset($reviewerRecommendationOptions[$recommendation])) {
         return true;
     }
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewerSubmission->getReviewId());
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return true;
     }
     // Only record the reviewers recommendation if
     // no recommendation has previously been submitted.
     if ($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation === '') {
         import('mail.PaperMailTemplate');
         $email = new PaperMailTemplate($reviewerSubmission, 'REVIEW_COMPLETE');
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setFrom($reviewer->getEmail(), $reviewer->getFullName());
         if (!$email->isEnabled() || $send && !$email->hasErrors()) {
             HookRegistry::call('ReviewerAction::recordRecommendation', array(&$reviewerSubmission, &$email, $recommendation));
             if ($email->isEnabled()) {
                 $email->setAssoc(PAPER_EMAIL_REVIEW_COMPLETE, PAPER_EMAIL_TYPE_REVIEW, $reviewerSubmission->getReviewId());
                 $email->send();
             }
             $reviewAssignment->setRecommendation($recommendation);
             $reviewAssignment->setDateCompleted(Core::getCurrentDate());
             $reviewAssignment->stampModified();
             $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
             // Add log
             import('paper.log.PaperLog');
             import('paper.log.PaperEventLogEntry');
             $entry = new PaperEventLogEntry();
             $entry->setPaperId($reviewAssignment->getPaperId());
             $entry->setUserId($reviewer->getId());
             $entry->setDateLogged(Core::getCurrentDate());
             $entry->setEventType(PAPER_LOG_REVIEW_RECOMMENDATION);
             $entry->setLogMessage('log.review.reviewRecommendationSet', array('reviewerName' => $reviewer->getFullName(), 'paperId' => $reviewAssignment->getPaperId(), 'stage' => $reviewAssignment->getStage()));
             $entry->setAssocType(LOG_TYPE_REVIEW);
             $entry->setAssocId($reviewAssignment->getId());
             PaperLog::logEventEntry($reviewAssignment->getPaperId(), $entry);
         } else {
             if (!Request::getUserVar('continued')) {
                 $assignedDirectors = $email->toAssignedDirectors($reviewerSubmission->getPaperId());
                 $reviewingTrackDirectors = $email->toAssignedTrackDirectors($reviewerSubmission->getPaperId());
                 if (empty($assignedDirectors) && empty($reviewingTrackDirectors)) {
                     $schedConf =& Request::getSchedConf();
                     $email->addRecipient($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                     $editorialContactName = $schedConf->getSetting('contactName');
                 } else {
                     if (!empty($reviewingTrackDirectors)) {
                         $editorialContact = array_shift($reviewingTrackDirectors);
                     } else {
                         $editorialContact = array_shift($assignedDirectors);
                     }
                     $editorialContactName = $editorialContact->getDirectorFullName();
                 }
                 $reviewerRecommendationOptions =& ReviewAssignment::getReviewerRecommendationOptions();
                 $email->assignParams(array('editorialContactName' => $editorialContactName, 'reviewerName' => $reviewer->getFullName(), 'paperTitle' => strip_tags($reviewerSubmission->getLocalizedTitle()), 'recommendation' => Locale::translate($reviewerRecommendationOptions[$recommendation])));
             }
             $email->displayEditForm(Request::url(null, null, 'reviewer', 'recordRecommendation'), array('reviewId' => $reviewerSubmission->getReviewId(), 'recommendation' => $recommendation));
             return false;
         }
     }
     return true;
 }
 /**
  * Records the reviewer's submission recommendation.
  * @param $reviewId int
  * @param $recommendation int
  * @param $send boolean
  */
 function emailDirector($reviewerSubmission, $paperId, $send)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     // Check validity of selected recommendation
     //$reviewerRecommendationOptions =& ReviewAssignment::getReviewerRecommendationOptions();
     //$reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewerSubmission->getReviewId());
     //$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     $reviewer = Request::getUser();
     if (!isset($reviewer)) {
         return true;
     }
     // Only record the reviewers recommendation if
     // no recommendation has previously been submitted.
     if (true) {
         import('mail.PaperMailTemplate');
         $email = new PaperMailTemplate($reviewerSubmission, 'REVIEW_EMAIL_DIRECTOR');
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setFrom($reviewer->getEmail(), $reviewer->getFullName());
         if (!$email->isEnabled() || $send && !$email->hasErrors()) {
             if ($email->isEnabled()) {
                 $email->setAssoc(PAPER_EMAIL_REVIEW_COMPLETE, PAPER_EMAIL_TYPE_REVIEW, $reviewerSubmission->getReviewId());
                 $email->send();
             }
         } else {
             if (!Request::getUserVar('continued')) {
                 $assignedDirectors = $email->toAssignedDirectors($paperId);
                 $reviewingTrackDirectors = $email->toAssignedTrackDirectors($paperId);
                 if (empty($assignedDirectors) && empty($reviewingTrackDirectors)) {
                     $schedConf =& Request::getSchedConf();
                     $email->addRecipient($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                     $editorialContactName = $schedConf->getSetting('contactName');
                 } else {
                     if (!empty($reviewingTrackDirectors)) {
                         $editorialContact = array_shift($reviewingTrackDirectors);
                     } else {
                         $editorialContact = array_shift($assignedDirectors);
                     }
                     $editorialContactName = $editorialContact->getDirectorFullName();
                 }
                 $submissionUrl = Request::url(null, null, 'director', 'submissionAssignReviewer', $paperId, array(), "peerReview");
                 $email->assignParams(array('editorialContactName' => $editorialContactName, 'reviewerName' => $reviewer->getFullName(), 'paperTitle' => strip_tags($reviewerSubmission->getLocalizedTitle()), 'submissionUrl' => $submissionUrl));
             }
             $email->displayEditForm(Request::url(null, null, 'reviewer', 'submission', $reviewerSubmission->getPaperId()));
             return false;
         }
     }
     return true;
 }
Exemple #6
0
 /**
  * Email the comment.
  * @param $recipients array of recipients (email address => name)
  */
 function email($recipients)
 {
     $paper = $this->paper;
     $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
     $schedConf =& Request::getSchedConf();
     import('classes.mail.PaperMailTemplate');
     $email = new PaperMailTemplate($paper, 'SUBMISSION_COMMENT');
     $email->setFrom($this->user->getEmail(), $this->user->getFullName());
     $commentText = $this->getData('comments');
     // Individually send an email to each of the recipients.
     foreach ($recipients as $emailAddress => $name) {
         $email->addRecipient($emailAddress, $name);
         $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => $commentText);
         $email->sendWithParams($paramArray);
         $email->clearRecipients();
     }
 }