当前位置: 首页>>代码示例>>PHP>>正文


PHP ArticleMailTemplate::setContext方法代码示例

本文整理汇总了PHP中ArticleMailTemplate::setContext方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleMailTemplate::setContext方法的具体用法?PHP ArticleMailTemplate::setContext怎么用?PHP ArticleMailTemplate::setContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArticleMailTemplate的用法示例。


在下文中一共展示了ArticleMailTemplate::setContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendReminder

 function sendReminder($reviewAssignment, $submission, $context)
 {
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     $reviewId = $reviewAssignment->getId();
     $reviewer = $userDao->getById($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return false;
     }
     import('classes.mail.ArticleMailTemplate');
     $reviewerAccessKeysEnabled = $context->getSetting('reviewerAccessKeysEnabled');
     $email = new ArticleMailTemplate($submission, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', $context->getPrimaryLocale(), $context, false);
     $email->setContext($context);
     $email->setReplyTo(null);
     $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
     $email->setSubject($email->getSubject($context->getPrimaryLocale()));
     $email->setBody($email->getBody($context->getPrimaryLocale()));
     $urlParams = array();
     if ($reviewerAccessKeysEnabled) {
         import('lib.pkp.classes.security.AccessKeyManager');
         $accessKeyManager = new AccessKeyManager();
         // Key lifetime is the typical review period plus four weeks
         $keyLifetime = ($context->getSetting('numWeeksPerReview') + 4) * 7;
         $urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getId(), $reviewId, $keyLifetime);
     }
     $submissionReviewUrl = Request::url($context->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) {
         // Default to something human-readable if no date specified
         $reviewDueDate = '_____';
     } else {
         $reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
     }
     $paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'contextUrl' => Request::url($context->getPath()), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => $reviewDueDate, 'weekLaterDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime('+1 week')), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'passwordResetUrl' => Request::url($context->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);
 }
开发者ID:mosvits,项目名称:ojs,代码行数:42,代码来源:ReviewReminder.inc.php


注:本文中的ArticleMailTemplate::setContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。