本文整理汇总了PHP中ArticleMailTemplate::addPrivateParam方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleMailTemplate::addPrivateParam方法的具体用法?PHP ArticleMailTemplate::addPrivateParam怎么用?PHP ArticleMailTemplate::addPrivateParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleMailTemplate
的用法示例。
在下文中一共展示了ArticleMailTemplate::addPrivateParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remindReviewer
/**
* Reminds a reviewer about a review assignment.
* @param $sectionEditorSubmission object
* @param $reviewId int
* @param $send boolean
* @param $request object
* @return boolean true iff no error was encountered
*/
function remindReviewer($sectionEditorSubmission, $reviewId, $send, $request)
{
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& $request->getJournal();
$user =& $request->getUser();
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
$reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
// If we're using access keys, disable the address fields
// for this message. (Prevents security issue: section editor
// could CC or BCC someone else, or change the reviewer address,
// in order to get the access key.)
$preventAddressChanges = $reviewerAccessKeysEnabled;
import('classes.mail.ArticleMailTemplate');
$email = new ArticleMailTemplate($sectionEditorSubmission, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_ONECLICK' : 'REVIEW_REMIND');
if ($preventAddressChanges) {
$email->setAddressFieldsEnabled(false);
}
if ($send && !$email->hasErrors()) {
HookRegistry::call('SectionEditorAction::remindReviewer', array(&$sectionEditorSubmission, &$reviewAssignment, &$email));
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if ($reviewerAccessKeysEnabled) {
import('lib.pkp.classes.security.AccessKeyManager');
import('pages.reviewer.ReviewerHandler');
$accessKeyManager = new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
$email->addPrivateParam('ACCESS_KEY', $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime));
}
if ($preventAddressChanges) {
// Ensure that this messages goes to the reviewer, and the reviewer ONLY.
$email->clearAllRecipients();
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
}
$email->send($request);
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(0);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
return true;
} elseif ($reviewAssignment->getSubmissionId() == $sectionEditorSubmission->getId()) {
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!$request->getUserVar('continued')) {
if (!isset($reviewer)) {
return true;
}
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$submissionUrl = $request->url(null, 'reviewer', 'submission', $reviewId, $reviewerAccessKeysEnabled ? array('key' => 'ACCESS_KEY') : array());
// Format the review due date
$reviewDueDate = strtotime($reviewAssignment->getDateDue());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($reviewDueDate === -1 || $reviewDueDate === false) {
// Default to something human-readable if no date specified
$reviewDueDate = '_____';
} else {
$reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
}
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'passwordResetUrl' => $request->url(null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $submissionUrl);
$email->assignParams($paramArray);
}
$email->displayEditForm($request->url(null, null, 'remindReviewer', 'send'), array('reviewerId' => $reviewer->getId(), 'articleId' => $sectionEditorSubmission->getId(), 'reviewId' => $reviewId));
return false;
}
return true;
}