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); }
/** * Assigns a track director to a submission. * @param $paperId int * @return boolean true iff ready for redirect */ function assignDirector($paperId, $trackDirectorId, $isDirector = false, $send = false) { $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO'); $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $user =& Request::getUser(); $conference =& Request::getConference(); $directorSubmission =& $directorSubmissionDao->getDirectorSubmission($paperId); $trackDirector =& $userDao->getUser($trackDirectorId); if (!isset($trackDirector)) { return true; } import('mail.PaperMailTemplate'); $email = new PaperMailTemplate($directorSubmission, 'DIRECTOR_ASSIGN'); if ($user->getId() === $trackDirectorId || !$email->isEnabled() || $send && !$email->hasErrors()) { HookRegistry::call('DirectorAction::assignDirector', array(&$directorSubmission, &$trackDirector, &$isDirector, &$email)); if ($email->isEnabled() && $user->getId() !== $trackDirectorId) { $email->setAssoc(PAPER_EMAIL_DIRECTOR_ASSIGN, PAPER_EMAIL_TYPE_DIRECTOR, $trackDirector->getId()); $email->send(); } $editAssignment = new EditAssignment(); $editAssignment->setPaperId($paperId); // Make the selected director the new director $editAssignment->setDirectorId($trackDirectorId); $editAssignment->setDateNotified(Core::getCurrentDate()); $editAssignment->setDateUnderway(null); $editAssignments =& $directorSubmission->getEditAssignments(); array_push($editAssignments, $editAssignment); $directorSubmission->setEditAssignments($editAssignments); $directorSubmissionDao->updateDirectorSubmission($directorSubmission); // Add log import('paper.log.PaperLog'); import('paper.log.PaperEventLogEntry'); PaperLog::logEvent($paperId, PAPER_LOG_DIRECTOR_ASSIGN, LOG_TYPE_DIRECTOR, $trackDirectorId, 'log.director.directorAssigned', array('directorName' => $trackDirector->getFullName(), 'paperId' => $paperId)); return true; } else { if (!Request::getUserVar('continued')) { $email->addRecipient($trackDirector->getEmail(), $trackDirector->getFullName()); $submissionUrl = Request::url(null, null, $isDirector ? 'director' : 'trackDirector', 'submissionReview', $paperId); $submissionUrl = $submissionUrl . "?u=" . $trackDirector->getUserId(); $paramArray = array('editorialContactName' => $trackDirector->getFullName(), 'directorUsername' => $trackDirector->getUsername(), 'directorPassword' => $trackDirector->getPassword(), 'editorialContactSignature' => $user->getContactSignature(), 'submissionUrl' => $submissionUrl); $email->assignParams($paramArray); } $email->displayEditForm(Request::url(null, null, null, 'assignDirector', 'send'), array('paperId' => $paperId, 'directorId' => $trackDirectorId)); return false; } }
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(); } }
/** * 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; }
/** * Email the comment. * @param $recipients array of recipients (email address => name) */ function email($recipients) { import('mail.PaperMailTemplate'); $email = new PaperMailTemplate($this->paper, 'SUBMISSION_COMMENT'); foreach ($recipients as $emailAddress => $name) { $email->addRecipient($emailAddress, $name); $email->setSubject(strip_tags($this->paper->getLocalizedTitle())); $paramArray = array('name' => $name, 'commentName' => $this->user->getFullName(), 'comments' => String::html2text($this->getData('comments'))); $email->assignParams($paramArray); $email->send(); $email->clearRecipients(); } }
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(); } }
/** * Blind CC the reviews to reviewers. * @param $paper object * @param $send boolean * @param $inhibitExistingEmail boolean * @return boolean true iff ready for redirect */ function blindCcReviewsToReviewers($paper, $send = false, $inhibitExistingEmail = false) { $commentDao =& DAORegistry::getDAO('PaperCommentDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $conference =& Request::getConference(); $comments =& $commentDao->getPaperComments($paper->getId(), COMMENT_TYPE_DIRECTOR_DECISION); $reviewAssignments =& $reviewAssignmentDao->getReviewAssignmentsByPaperId($paper->getId(), $paper->getCurrentStage()); $commentsText = ""; foreach ($comments as $comment) { $commentsText .= String::html2utf(strip_tags($comment->getComments())) . "\n\n"; } $user =& Request::getUser(); import('mail.PaperMailTemplate'); $email = new PaperMailTemplate($paper, 'SUBMISSION_DECISION_REVIEWERS'); if ($send && !$email->hasErrors() && !$inhibitExistingEmail) { HookRegistry::call('TrackDirectorAction::blindCcReviewsToReviewers', array(&$paper, &$reviewAssignments, &$email)); $email->send(); return true; } else { if ($inhibitExistingEmail || !Request::getUserVar('continued')) { $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm(Request::url(null, null, null, 'blindCcReviewsToReviewers'), array('paperId' => $paper->getId())); return false; } }
/** * 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; }
/** * 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; } }