本文整理汇总了PHP中OJSPaymentManager类的典型用法代码示例。如果您正苦于以下问题:PHP OJSPaymentManager类的具体用法?PHP OJSPaymentManager怎么用?PHP OJSPaymentManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OJSPaymentManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: payPurchaseGiftSubscription
/**
* Process payment form for buying a gift subscription
* @param $args array
* @param $request PKPRequest
*/
function payPurchaseGiftSubscription($args, $request)
{
$journal = $request->getJournal();
if (!$journal) {
$request->redirect(null, 'index');
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$acceptSubscriptionPayments = $paymentManager->acceptGiftSubscriptionPayments();
if (!$acceptSubscriptionPayments) {
$request->redirect(null, 'index');
}
$this->setupTemplate();
$user = $request->getUser();
// If buyer is logged in, save buyer user id as part of gift details
if ($user) {
$buyerUserId = $user->getId();
} else {
$buyerUserId = null;
}
import('classes.subscription.form.GiftIndividualSubscriptionForm');
$giftSubscriptionForm = new GiftIndividualSubscriptionForm($buyerUserId);
$giftSubscriptionForm->readInputData();
if ($giftSubscriptionForm->validate()) {
$giftSubscriptionForm->execute();
} else {
$giftSubscriptionForm->display();
}
}
示例2: getContents
/**
* @see BlockPlugin::getContents
*/
function getContents(&$templateMgr, $request)
{
$journal =& $request->getJournal();
if (!$journal) {
return '';
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$templateMgr->assign('donationEnabled', $paymentManager->donationEnabled());
return parent::getContents($templateMgr, $request);
}
示例3: index
/**
* Display the donations page.
* @param $args array
* @param $request PKPRequest
*/
function index($args, $request)
{
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$journal = $request->getJournal();
if (!Validation::isLoggedIn()) {
Validation::redirectLogin('payment.loginRequired.forDonation');
}
$user = $request->getUser();
$queuedPayment = $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_DONATION, $user->getId(), 0, 0);
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
}
示例4: validate
/**
* Validate the form
*/
function validate()
{
import('payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
if ($paymentManager->submissionEnabled()) {
if (!$this->isValid()) {
return false;
}
$journal =& Request::getJournal();
$journalId = $journal->getJournalId();
$articleId = $this->articleId;
$user =& Request::getUser();
$completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
if ($completedPaymentDAO->hasPaidSubmission($journalId, $articleId)) {
return parent::validate();
} elseif (Request::getUserVar('qualifyForWaiver') && Request::getUserVar('commentsToEditor') != '') {
return parent::validate();
} elseif (Request::getUserVar('paymentSent')) {
return parent::validate();
} else {
$queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_SUBMISSION, $user->getUserId(), $articleId, $journal->getSetting('submissionFee'));
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
exit;
}
} else {
return parent::validate();
}
}
示例5: display
/**
* Display the form.
*/
function display()
{
$journal =& Request::getJournal();
$user =& Request::getUser();
$templateMgr =& TemplateManager::getManager();
// Get sections for this journal
$sectionDao =& DAORegistry::getDAO('SectionDAO');
// If this user is a section editor or an editor, they are allowed
// to submit to sections flagged as "editor-only" for submissions.
// Otherwise, display only sections they are allowed to submit to.
$roleDao =& DAORegistry::getDAO('RoleDAO');
$isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR);
// Set up required Payment Related Information
import('payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
$templateMgr->assign('authorFees', true);
$completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
$articleId = $this->articleId;
if ($paymentManager->submissionEnabled()) {
$templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getId(), $articleId));
}
if ($paymentManager->fastTrackEnabled()) {
$templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getId(), $articleId));
}
}
$templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor));
parent::display();
}
示例6: execute
/**
* Queue payment and save gift details.
*/
function execute()
{
$journal = $this->request->getJournal();
$journalId = $journal->getId();
// Create new gift and save details
import('classes.gift.Gift');
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($this->request);
$paymentPlugin =& $paymentManager->getPaymentPlugin();
$gift = new Gift();
if ($paymentPlugin->getName() == 'ManualPayment') {
$gift->setStatus(GIFT_STATUS_AWAITING_MANUAL_PAYMENT);
} else {
$gift->setStatus(GIFT_STATUS_AWAITING_ONLINE_PAYMENT);
}
$gift->setAssocType(ASSOC_TYPE_JOURNAL);
$gift->setAssocId($journalId);
$gift->setGiftType(GIFT_TYPE_SUBSCRIPTION);
$gift->setGiftAssocId($this->getData('typeId'));
$gift->setBuyerFirstName($this->getData('buyerFirstName'));
$gift->setBuyerMiddleName($this->getData('buyerMiddleName'));
$gift->setBuyerLastName($this->getData('buyerLastName'));
$gift->setBuyerEmail($this->getData('buyerEmail'));
$gift->setBuyerUserId($this->buyerUserId ? $this->buyerUserId : null);
$gift->setRecipientFirstName($this->getData('recipientFirstName'));
$gift->setRecipientMiddleName($this->getData('recipientMiddleName'));
$gift->setRecipientLastName($this->getData('recipientLastName'));
$gift->setRecipientEmail($this->getData('recipientEmail'));
$gift->setRecipientUserId(null);
$gift->setLocale($this->getData('giftLocale'));
$gift->setGiftNoteTitle($this->getData('giftNoteTitle'));
$gift->setGiftNote($this->getData('giftNote'));
$giftDao = DAORegistry::getDAO('GiftDAO');
$giftId = $giftDao->insertObject($gift);
// Create new queued payment
$subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
$subscriptionType =& $subscriptionTypeDao->getSubscriptionType($this->getData('typeId'));
$queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_GIFT, null, $giftId, $subscriptionType->getCost(), $subscriptionType->getCurrencyCodeAlpha());
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
}
示例7: getContents
/**
* Get the HTML contents for this block.
* @param $templateMgr object
* @param $request PKPRequest
* @return $string
*/
function getContents(&$templateMgr, $request)
{
$journal =& $request->getJournal();
$journalId = $journal ? $journal->getId() : null;
if (!$journal) {
return '';
}
if ($journal->getSetting('publishingMode') != PUBLISHING_MODE_SUBSCRIPTION) {
return '';
}
$user =& $request->getUser();
$userId = $user ? $user->getId() : null;
$templateMgr->assign('userLoggedIn', isset($userId) ? true : false);
if (isset($userId)) {
$subscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
$individualSubscription =& $subscriptionDao->getSubscriptionByUserForJournal($userId, $journalId);
$templateMgr->assign_by_ref('individualSubscription', $individualSubscription);
}
// If no individual subscription or if not valid, check for institutional subscription
if (!isset($individualSubscription) || !$individualSubscription->isValid()) {
$ip = $request->getRemoteAddr();
$domain = Request::getRemoteDomain();
$subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
$subscriptionId = $subscriptionDao->isValidInstitutionalSubscription($domain, $ip, $journalId);
if ($subscriptionId) {
$institutionalSubscription =& $subscriptionDao->getSubscription($subscriptionId);
$templateMgr->assign_by_ref('institutionalSubscription', $institutionalSubscription);
$templateMgr->assign('userIP', $ip);
}
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
if (isset($individualSubscription) || isset($institutionalSubscription)) {
$acceptSubscriptionPayments = $paymentManager->acceptSubscriptionPayments();
$templateMgr->assign('acceptSubscriptionPayments', $acceptSubscriptionPayments);
}
$acceptGiftSubscriptionPayments = $paymentManager->acceptGiftSubscriptionPayments();
$templateMgr->assign('acceptGiftSubscriptionPayments', $acceptGiftSubscriptionPayments);
return parent::getContents($templateMgr, $request);
}
示例8: index
function index($args)
{
import('payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
$journal =& Request::getJournal();
if (!Validation::isLoggedIn()) {
Validation::redirectLogin("payment.loginRequired.forDonation");
}
$user =& Request::getUser();
$queuedPayment =& $paymentManager->createQueuedPayment($journal->getJournalId(), PAYMENT_TYPE_DONATION, $user->getUserId(), 0, 0);
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
}
示例9: index
/**
* Display journal author index page.
*/
function index($args)
{
list($journal) = AuthorHandler::validate();
AuthorHandler::setupTemplate();
$user =& Request::getUser();
$rangeInfo =& Handler::getRangeInfo('submissions');
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$page = isset($args[0]) ? $args[0] : '';
switch ($page) {
case 'completed':
$active = false;
break;
default:
$page = 'active';
$active = true;
}
$submissions = $authorSubmissionDao->getAuthorSubmissions($user->getUserId(), $journal->getJournalId(), $active, $rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('pageToDisplay', $page);
if (!$active) {
// Make view counts available if enabled.
$templateMgr->assign('statViews', $journal->getSetting('statViews'));
}
$templateMgr->assign_by_ref('submissions', $submissions);
// assign payment
import('payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
if ($paymentManager->isConfigured()) {
$templateMgr->assign('submissionEnabled', $paymentManager->submissionEnabled());
$templateMgr->assign('fastTrackEnabled', $paymentManager->fastTrackEnabled());
$templateMgr->assign('publicationEnabled', $paymentManager->publicationEnabled());
$completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
$templateMgr->assign_by_ref('completedPaymentDAO', $completedPaymentDAO);
}
/** Opatan Inc. **/
$journalPath = $journal->getPath();
$templateMgr->assign('journalTitle', $journalPath);
import('issue.IssueAction');
$issueAction =& new IssueAction();
$templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
$templateMgr->assign('helpTopicId', 'editorial.authorsRole.submissions');
$templateMgr->display('author/index.tpl');
}
示例10: display
/**
* Display the form.
*/
function display()
{
$journal =& Request::getJournal();
$user =& Request::getUser();
$templateMgr =& TemplateManager::getManager();
// Get sections for this journal
$sectionDao =& DAORegistry::getDAO('SectionDAO');
// If this user is a section editor or an editor, they are
// allowed to submit to sections flagged as "editor-only" for
// submissions. Otherwise, display only sections they are
// allowed to submit to.
$roleDao =& DAORegistry::getDAO('RoleDAO');
$isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR);
$templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor));
// Set up required Payment Related Information
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
$templateMgr->assign('authorFees', true);
$completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
$articleId = $this->articleId;
if ($paymentManager->submissionEnabled()) {
$templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getId(), $articleId));
}
if ($paymentManager->fastTrackEnabled()) {
$templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getId(), $articleId));
}
}
// Provide available submission languages. (Convert the array
// of locale symbolic names xx_XX into an associative array
// of symbolic names => readable names.)
$supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales');
if (empty($supportedSubmissionLocales)) {
$supportedSubmissionLocales = array($journal->getPrimaryLocale());
}
$templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
parent::display();
}
示例11: execute
/**
* Save the metadata and store the catalog data for this published
* monograph.
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$context = $request->getContext();
$waivePublicationFee = $request->getUserVar('waivePublicationFee') ? true : false;
if ($waivePublicationFee) {
$markAsPaid = $request->getUserVar('markAsPaid');
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$user = $request->getUser();
// Get a list of author user IDs
$authorUserIds = array();
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR);
$submitterAssignment = $submitterAssignments->next();
assert($submitterAssignment);
// At least one author should be assigned
$queuedPayment =& $paymentManager->createQueuedPayment($context->getId(), PAYMENT_TYPE_PUBLICATION, $markAsPaid ? $submitterAssignment->getUserId() : $user->getId(), $submission->getId(), $markAsPaid ? $context->getSetting('publicationFee') : 0, $markAsPaid ? $context->getSetting('currency') : '');
$paymentManager->queuePayment($queuedPayment);
// Since this is a waiver, fulfill the payment immediately
$paymentManager->fulfillQueuedPayment($request, $queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver');
} else {
// Get the issue for publication.
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueId = $this->getData('issueId');
$issue = $issueDao->getById($issueId, $context->getId());
$sectionDao = DAORegistry::getDAO('SectionDAO');
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false);
/* @var $publishedArticle PublishedArticle */
if ($publishedArticle) {
if (!$issue || !$issue->getPublished()) {
$fromIssue = $issueDao->getById($publishedArticle->getIssueId(), $context->getId());
if ($fromIssue->getPublished()) {
// Insert article tombstone
import('classes.article.ArticleTombstoneManager');
$articleTombstoneManager = new ArticleTombstoneManager();
$articleTombstoneManager->insertArticleTombstone($submission, $context);
}
}
}
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
// define the access status for the article if none is set.
$accessStatus = $this->getData('accessStatus') != '' ? $this->getData('accessStatus') : ARTICLE_ACCESS_ISSUE_DEFAULT;
$articleDao = DAORegistry::getDAO('ArticleDAO');
if (!is_null($this->getData('pages'))) {
$submission->setPages($this->getData('pages'));
}
if ($issue) {
// Schedule against an issue.
if ($publishedArticle) {
$publishedArticle->setIssueId($issueId);
$publishedArticle->setSequence(REALLY_BIG_NUMBER);
$publishedArticle->setDatePublished($this->getData('datePublished'));
$publishedArticle->setAccessStatus($accessStatus);
$publishedArticleDao->updatePublishedArticle($publishedArticle);
// Re-index the published article metadata.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
} else {
$publishedArticle = $publishedArticleDao->newDataObject();
$publishedArticle->setId($submission->getId());
$publishedArticle->setIssueId($issueId);
$publishedArticle->setDatePublished(Core::getCurrentDate());
$publishedArticle->setSequence(REALLY_BIG_NUMBER);
$publishedArticle->setAccessStatus($accessStatus);
$publishedArticleDao->insertObject($publishedArticle);
// If we're using custom section ordering, and if this is the first
// article published in a section, make sure we enter a custom ordering
// for it. (Default at the end of the list.)
if ($sectionDao->customSectionOrderingExists($issueId)) {
if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
$sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
$sectionDao->resequenceCustomSectionOrders($issueId);
}
}
// Index the published article metadata and files for the first time.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
$articleSearchIndex->submissionFilesChanged($publishedArticle);
}
} else {
if ($publishedArticle) {
// This was published elsewhere; make sure we don't
// mess up sequencing information.
$issueId = $publishedArticle->getIssueId();
$publishedArticleDao->deletePublishedArticleByArticleId($submission->getId());
// Delete the article from the search index.
$articleSearchIndex->submissionFileDeleted($submission->getId());
}
}
if ($this->getData('attachPermissions')) {
$submission->setCopyrightYear($this->getData('copyrightYear'));
$submission->setCopyrightHolder($this->getData('copyrightHolder'), null);
// Localized
$submission->setLicenseURL($this->getData('licenseURL'));
//.........这里部分代码省略.........
示例12: userCanViewGalley
/**
* Determines whether a user can view this article galley or not.
* @param $request Request
* @param $articleId string
* @param $galleyId int or string
*/
function userCanViewGalley($request, $articleId, $galleyId = null)
{
import('classes.issue.IssueAction');
$issueAction = new IssueAction();
$journal = $request->getJournal();
$publishedArticle = $this->article;
$issue = $this->issue;
$journalId = $journal->getId();
$user = $request->getUser();
$userId = $user ? $user->getId() : 0;
// If this is an editorial user who can view unpublished/unscheduled
// articles, bypass further validation. Likewise for its author.
if ($publishedArticle && $issueAction->allowedPrePublicationAccess($journal, $publishedArticle)) {
return true;
}
// Make sure the reader has rights to view the article/issue.
if ($issue && $issue->getPublished() && $publishedArticle->getStatus() == STATUS_PUBLISHED) {
$subscriptionRequired = $issueAction->subscriptionRequired($issue);
$isSubscribedDomain = $issueAction->subscribedDomain($journal, $issue->getId(), $publishedArticle->getId());
// Check if login is required for viewing.
if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess') && isset($galleyId) && $galleyId) {
Validation::redirectLogin();
}
// bypass all validation if subscription based on domain or ip is valid
// or if the user is just requesting the abstract
if (!$isSubscribedDomain && $subscriptionRequired && (isset($galleyId) && $galleyId)) {
// Subscription Access
$subscribedUser = $issueAction->subscribedUser($journal, $issue->getId(), $publishedArticle->getId());
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$purchasedIssue = false;
if (!$subscribedUser && $paymentManager->purchaseIssueEnabled()) {
$completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO');
$purchasedIssue = $completedPaymentDao->hasPaidPurchaseIssue($userId, $issue->getId());
}
if (!(!$subscriptionRequired || $publishedArticle->getAccessStatus() == ARTICLE_ACCESS_OPEN || $subscribedUser || $purchasedIssue)) {
if ($paymentManager->purchaseArticleEnabled() || $paymentManager->membershipEnabled()) {
/* if only pdf files are being restricted, then approve all non-pdf galleys
* and continue checking if it is a pdf galley */
if ($paymentManager->onlyPdfEnabled()) {
if ($this->galley && !$this->galley->isPdfGalley()) {
$this->issue = $issue;
$this->article = $publishedArticle;
return true;
}
}
if (!Validation::isLoggedIn()) {
Validation::redirectLogin("payment.loginRequired.forArticle");
}
/* if the article has been paid for then forget about everything else
* and just let them access the article */
$completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO');
$dateEndMembership = $user->getSetting('dateEndMembership', 0);
if ($completedPaymentDao->hasPaidPurchaseArticle($userId, $publishedArticle->getId()) || !is_null($dateEndMembership) && $dateEndMembership > time()) {
$this->issue = $issue;
$this->article = $publishedArticle;
return true;
} else {
$queuedPayment = $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ARTICLE, $user->getId(), $publishedArticle->getId(), $journal->getSetting('purchaseArticleFee'));
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
exit;
}
}
if (!isset($galleyId) || $galleyId) {
if (!Validation::isLoggedIn()) {
Validation::redirectLogin('reader.subscriptionRequiredLoginText');
}
$request->redirect(null, 'about', 'subscriptions');
}
}
}
} else {
$request->redirect(null, 'search');
}
return true;
}
示例13: memberships
/**
* Display subscriptions page.
*/
function memberships()
{
$this->addCheck(new HandlerValidatorJournal($this));
$this->validate();
$this->setupTemplate(true);
$journal =& Request::getJournal();
$journalId = $journal->getId();
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
$membershipEnabled = $paymentManager->membershipEnabled();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('membershipEnabled', $membershipEnabled);
if ($membershipEnabled) {
$membershipFee = $journal->getSetting('membershipFee');
$membershipFeeName =& $journal->getLocalizedSetting('membershipFeeName');
$membershipFeeDescription =& $journal->getLocalizedSetting('membershipFeeDescription');
$currency = $journal->getSetting('currency');
$templateMgr->assign('membershipFee', $membershipFee);
$templateMgr->assign('currency', $currency);
$templateMgr->assign('membershipFeeName', $membershipFeeName);
$templateMgr->assign('membershipFeeDescription', $membershipFeeDescription);
$templateMgr->display('about/memberships.tpl');
return;
}
Request::redirect(null, 'about');
}
示例14: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
*/
function TemplateManager($request = null)
{
parent::PKPTemplateManager($request);
// Retrieve the router
$router =& $this->request->getRouter();
assert(is_a($router, 'PKPRouter'));
// Are we using implicit authentication?
$this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
if (!defined('SESSION_DISABLE_INIT')) {
/**
* Kludge to make sure no code that tries to connect to
* the database is executed (e.g., when loading
* installer pages).
*/
$journal =& $router->getContext($this->request);
$site =& $this->request->getSite();
$publicFileManager = new PublicFileManager();
$siteFilesDir = $this->request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
// May be overridden by journal
$siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet($this->request->getBaseUrl() . '/' . $siteStyleFilename);
}
$this->assign('homeContext', array());
$this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
if (isset($journal)) {
$this->assign_by_ref('currentJournal', $journal);
$journalTitle = $journal->getLocalizedTitle();
$this->assign('siteTitle', $journalTitle);
$this->assign('publicFilesDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
$this->assign('primaryLocale', $journal->getPrimaryLocale());
$this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
// Assign additional navigation bar items
$navMenuItems =& $journal->getLocalizedSetting('navItems');
$this->assign_by_ref('navMenuItems', $navMenuItems);
// Assign journal page header
$this->assign('displayPageHeaderTitle', $journal->getLocalizedPageHeaderTitle());
$this->assign('displayPageHeaderLogo', $journal->getLocalizedPageHeaderLogo());
$this->assign('displayPageHeaderTitleAltText', $journal->getLocalizedSetting('pageHeaderTitleImageAltText'));
$this->assign('displayPageHeaderLogoAltText', $journal->getLocalizedSetting('pageHeaderLogoImageAltText'));
$this->assign('displayFavicon', $journal->getLocalizedFavicon());
$this->assign('faviconDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
$this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
$this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
$this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
$this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
$this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
$this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
$this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
$this->assign('hideRegisterLink', !$journal->getSetting('allowRegReviewer') && !$journal->getSetting('allowRegReader') && !$journal->getSetting('allowRegAuthor'));
// Load and apply theme plugin, if chosen
$themePluginPath = $journal->getSetting('journalTheme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
// Assign stylesheets and footer
$journalStyleSheet = $journal->getSetting('journalStyleSheet');
if ($journalStyleSheet) {
$this->addStyleSheet($this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $journalStyleSheet['uploadName']);
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($this->request);
$this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
$this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
} else {
// Add the site-wide logo, if set for this locale or the primary locale
$displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
$this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
if (isset($displayPageHeaderTitle['altText'])) {
$this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
// Load and apply theme plugin, if chosen
$themePluginPath = $site->getSetting('siteTheme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
}
if (!$site->getRedirect()) {
$this->assign('hasOtherJournals', true);
}
// Add java script for notifications
$user =& $this->request->getUser();
if ($user) {
$this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
//.........这里部分代码省略.........
示例15: handle
/**
* Handle incoming requests/notifications
* @param $args array
* @param $request PKPRequest
*/
function handle($args, $request)
{
$journal = $request->getJournal();
$templateMgr = TemplateManager::getManager($request);
$user = $request->getUser();
$op = isset($args[0]) ? $args[0] : null;
$queuedPaymentId = isset($args[1]) ? (int) $args[1] : 0;
import('classes.payment.ojs.OJSPaymentManager');
$ojsPaymentManager = new OJSPaymentManager($request);
$queuedPayment =& $ojsPaymentManager->getQueuedPayment($queuedPaymentId);
// if the queued payment doesn't exist, redirect away from payments
if (!$queuedPayment) {
$request->redirect(null, 'index');
}
switch ($op) {
case 'notify':
import('lib.pkp.classes.mail.MailTemplate');
AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
$contactName = $journal->getSetting('contactName');
$contactEmail = $journal->getSetting('contactEmail');
$mail = new MailTemplate('MANUAL_PAYMENT_NOTIFICATION');
$mail->setReplyTo(null);
$mail->addRecipient($contactEmail, $contactName);
$mail->assignParams(array('journalName' => $journal->getLocalizedName(), 'userFullName' => $user ? $user->getFullName() : '(' . __('common.none') . ')', 'userName' => $user ? $user->getUsername() : '(' . __('common.none') . ')', 'itemName' => $queuedPayment->getName(), 'itemCost' => $queuedPayment->getAmount(), 'itemCurrencyCode' => $queuedPayment->getCurrencyCode()));
$mail->send();
$templateMgr->assign(array('currentUrl' => $request->url(null, null, 'payment', 'plugin', array('notify', $queuedPaymentId)), 'pageTitle' => 'plugins.paymethod.manual.paymentNotification', 'message' => 'plugins.paymethod.manual.notificationSent', 'backLink' => $queuedPayment->getRequestUrl(), 'backLinkLabel' => 'common.continue'));
$templateMgr->display('common/message.tpl');
exit;
}
parent::handle($args, $request);
// Don't know what to do with it
}