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


PHP OJSPaymentManager::createQueuedPayment方法代码示例

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


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

示例1: 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);
 }
开发者ID:mosvits,项目名称:ojs,代码行数:18,代码来源:DonationsHandler.inc.php

示例2: execute

 /**
  * Create institutional subscription. 
  */
 function execute()
 {
     $journal = $this->request->getJournal();
     $journalId = $journal->getId();
     $typeId = $this->getData('typeId');
     $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
     $nonExpiring = $subscriptionTypeDao->getSubscriptionTypeNonExpiring($typeId);
     $today = date('Y-m-d');
     $insert = false;
     if (!isset($this->subscription)) {
         import('classes.subscription.InstitutionalSubscription');
         $subscription = new InstitutionalSubscription();
         $subscription->setJournalId($journalId);
         $subscription->setUserId($this->userId);
         $subscription->setReferenceNumber(null);
         $subscription->setNotes(null);
         $insert = true;
     } else {
         $subscription =& $this->subscription;
     }
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($this->request);
     $paymentPlugin =& $paymentManager->getPaymentPlugin();
     if ($paymentPlugin->getName() == 'ManualPayment') {
         $subscription->setStatus(SUBSCRIPTION_STATUS_AWAITING_MANUAL_PAYMENT);
     } else {
         $subscription->setStatus(SUBSCRIPTION_STATUS_AWAITING_ONLINE_PAYMENT);
     }
     $subscription->setTypeId($typeId);
     $subscription->setMembership($this->getData('membership') ? $this->getData('membership') : null);
     $subscription->setDateStart($nonExpiring ? null : $today);
     $subscription->setDateEnd($nonExpiring ? null : $today);
     $subscription->setInstitutionName($this->getData('institutionName'));
     $subscription->setInstitutionMailingAddress($this->getData('institutionMailingAddress'));
     $subscription->setDomain($this->getData('domain'));
     $subscription->setIPRanges($this->getData('ipRanges'));
     $institutionalSubscriptionDao = DAORegistry::getDAO('InstitutionalSubscriptionDAO');
     if ($insert) {
         $institutionalSubscriptionDao->insertSubscription($subscription);
     } else {
         $institutionalSubscriptionDao->updateSubscription($subscription);
     }
     $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
     $subscriptionType =& $subscriptionTypeDao->getSubscriptionType($this->getData('typeId'));
     $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_SUBSCRIPTION, $this->userId, $subscription->getId(), $subscriptionType->getCost(), $subscriptionType->getCurrencyCodeAlpha());
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
     $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
 }
开发者ID:bkroll,项目名称:ojs,代码行数:51,代码来源:UserInstitutionalSubscriptionForm.inc.php

示例3: payMembership

 /**
  * Pay for a membership.
  * @param $args array
  * @param $request PKPRequest
  */
 function payMembership($args, $request)
 {
     $this->validate();
     $this->setupTemplate($request);
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($request);
     $journal = $request->getJournal();
     $user = $request->getUser();
     $queuedPayment = $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_MEMBERSHIP, $user->getId(), null, $journal->getSetting('membershipFee'));
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
     $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
 }
开发者ID:pkp,项目名称:ojs,代码行数:17,代码来源:UserHandler.inc.php

示例4: validate

 /**
  * Validation
  * @see lib/pkp/classes/handler/PKPHandler#validate()
  * @param $request Request
  * @param $issueId int
  * @param $galleyId int
  */
 function validate($request, $issueId = null, $galleyId = null)
 {
     $returner = parent::validate(null, $request);
     // Validate requests that don't specify an issue or galley
     if (!$issueId && !$galleyId) {
         return $returner;
     }
     // Require an issue id to continue
     if (!$issueId) {
         $request->redirect(null, 'index');
     }
     import('classes.issue.IssueAction');
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $user =& $request->getUser();
     $userId = $user ? $user->getId() : 0;
     $issue = null;
     $galley = null;
     // Get the issue
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     if ($journal->getSetting('enablePublicIssueId')) {
         $issue =& $issueDao->getIssueByBestIssueId($issueId, $journalId);
     } else {
         $issue =& $issueDao->getIssueById((int) $issueId, null, true);
     }
     // Invalid issue id, redirect to current issue
     if (!$issue || !$this->_isVisibleIssue($issue, $journalId)) {
         $request->redirect(null, null, 'current');
     }
     $this->setIssue($issue);
     // If no issue galley id provided, then we're done
     if (!$galleyId) {
         return true;
     }
     // Get the issue galley
     $galleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $issue->getId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $issue->getId());
     }
     // Invalid galley id, redirect to issue page
     if (!$galley) {
         $request->redirect(null, null, 'view', $issueId);
     }
     $this->setGalley($galley);
     // If this is an editorial user who can view unpublished issue galleys,
     // bypass further validation
     if (IssueAction::allowedIssuePrePublicationAccess($journal)) {
         return true;
     }
     // Ensure reader has rights to view the issue galley
     if ($issue->getPublished()) {
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $isSubscribedDomain = IssueAction::subscribedDomain($journal, $issueId);
         // Check if login is required for viewing.
         if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess')) {
             Validation::redirectLogin();
         }
         // If no domain/ip subscription, check if user has a valid subscription
         // or if the user has previously purchased the issue
         if (!$isSubscribedDomain && $subscriptionRequired) {
             // Check if user has a valid subscription
             $subscribedUser = IssueAction::subscribedUser($journal, $issueId);
             if (!$subscribedUser) {
                 // Check if payments are enabled,
                 import('classes.payment.ojs.OJSPaymentManager');
                 $paymentManager = new OJSPaymentManager($request);
                 if ($paymentManager->purchaseIssueEnabled() || $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() && !$galley->isPdfGalley()) {
                         return true;
                     }
                     if (!Validation::isLoggedIn()) {
                         Validation::redirectLogin("payment.loginRequired.forIssue");
                     }
                     // If the issue galley has been purchased, then allow reader access
                     $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
                     $dateEndMembership = $user->getSetting('dateEndMembership', 0);
                     if ($completedPaymentDao->hasPaidPurchaseIssue($userId, $issueId) || !is_null($dateEndMembership) && $dateEndMembership > time()) {
                         return true;
                     } else {
                         // Otherwise queue an issue purchase payment and display payment form
                         $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ISSUE, $userId, $issueId, $journal->getSetting('purchaseIssueFee'));
                         $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
                         $templateMgr =& TemplateManager::getManager();
                         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
                         exit;
                     }
                 }
                 if (!Validation::isLoggedIn()) {
                     Validation::redirectLogin("reader.subscriptionRequiredLoginText");
//.........这里部分代码省略.........
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:101,代码来源:IssueHandler.inc.php

示例5: 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);
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:44,代码来源:GiftIndividualSubscriptionForm.inc.php

示例6: 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;
 }
开发者ID:selwyntcy,项目名称:ojs,代码行数:83,代码来源:ArticleHandler.inc.php

示例7: 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'));
//.........这里部分代码省略.........
开发者ID:jnugent,项目名称:ojs,代码行数:101,代码来源:IssueEntryPublicationMetadataForm.inc.php

示例8: validate

 /**
  * Validate the form
  */
 function validate()
 {
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($this->request);
     if ($paymentManager->submissionEnabled()) {
         if (!parent::validate()) {
             return false;
         }
         $journal =& $this->request->getJournal();
         $journalId = $journal->getId();
         $articleId = $this->articleId;
         $user =& $this->request->getUser();
         $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
         if ($completedPaymentDao->hasPaidSubmission($journalId, $articleId)) {
             return parent::validate();
         } elseif ($this->request->getUserVar('qualifyForWaiver') && $this->request->getUserVar('commentsToEditor') != '') {
             return parent::validate();
         } elseif ($this->request->getUserVar('paymentSent')) {
             return parent::validate();
         } else {
             $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_SUBMISSION, $user->getId(), $articleId, $journal->getSetting('submissionFee'));
             $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
             $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
             exit;
         }
     } else {
         return parent::validate();
     }
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:32,代码来源:AuthorSubmitStep5Form.inc.php

示例9: userCanViewGalley

 /**
  * Determines whether or not a user can view an issue galley.
  * @param $request Request
  */
 function userCanViewGalley($request)
 {
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $journal = $request->getJournal();
     $user = $request->getUser();
     $userId = $user ? $user->getId() : 0;
     $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     $galley = $this->getGalley();
     // If this is an editorial user who can view unpublished issue galleys,
     // bypass further validation
     if ($issueAction->allowedIssuePrePublicationAccess($journal)) {
         return true;
     }
     // Ensure reader has rights to view the issue galley
     if ($issue->getPublished()) {
         $subscriptionRequired = $issueAction->subscriptionRequired($issue);
         $isSubscribedDomain = $issueAction->subscribedDomain($journal, $issue->getId());
         // Check if login is required for viewing.
         if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess')) {
             Validation::redirectLogin();
         }
         // If no domain/ip subscription, check if user has a valid subscription
         // or if the user has previously purchased the issue
         if (!$isSubscribedDomain && $subscriptionRequired) {
             // Check if user has a valid subscription
             $subscribedUser = $issueAction->subscribedUser($journal, $issue->getId());
             if (!$subscribedUser) {
                 // Check if payments are enabled,
                 import('classes.payment.ojs.OJSPaymentManager');
                 $paymentManager = new OJSPaymentManager($request);
                 if ($paymentManager->purchaseIssueEnabled() || $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() && !$galley->isPdfGalley()) {
                         return true;
                     }
                     if (!Validation::isLoggedIn()) {
                         Validation::redirectLogin("payment.loginRequired.forIssue");
                     }
                     // If the issue galley has been purchased, then allow reader access
                     $completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO');
                     $dateEndMembership = $user->getSetting('dateEndMembership', 0);
                     if ($completedPaymentDao->hasPaidPurchaseIssue($userId, $issue->getId()) || !is_null($dateEndMembership) && $dateEndMembership > time()) {
                         return true;
                     } else {
                         // Otherwise queue an issue purchase payment and display payment form
                         $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_PURCHASE_ISSUE, $userId, $issue->getId(), $journal->getSetting('purchaseIssueFee'));
                         $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
                         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
                         exit;
                     }
                 }
                 if (!Validation::isLoggedIn()) {
                     Validation::redirectLogin("reader.subscriptionRequiredLoginText");
                 }
                 $request->redirect(null, 'about', 'subscriptions');
             }
         }
     } else {
         $request->redirect(null, 'index');
     }
     return true;
 }
开发者ID:mosvits,项目名称:ojs,代码行数:68,代码来源:IssueHandler.inc.php

示例10: waivePublicationFee

 /**
  * Waive the publication fee.
  * @param $args array
  * @param $request PKPRequest
  */
 function waivePublicationFee($args, $request)
 {
     $articleId = (int) array_shift($args);
     $markAsPaid = $request->getUserVar('markAsPaid');
     $sendToScheduling = $request->getUserVar('sendToScheduling') ? true : false;
     $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
     $journal =& Request::getJournal();
     $submission =& $this->submission;
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($request);
     $user =& $request->getUser();
     $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_PUBLICATION, $markAsPaid ? $submission->getUserId() : $user->getId(), $articleId, $markAsPaid ? $journal->getSetting('publicationFee') : 0, $markAsPaid ? $journal->getSetting('currency') : '');
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
     // Since this is a waiver, fulfill the payment immediately
     $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver');
     if ($sendToScheduling) {
         $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
     } else {
         $request->redirect(null, null, 'submission', array($articleId));
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:26,代码来源:SubmissionEditHandler.inc.php

示例11: payPublicationFee

 /**
  * Display a form to pay for Publishing an article
  * @param $args array ($articleId)
  * @param $request PKPRequest
  */
 function payPublicationFee($args, $request)
 {
     $articleId = (int) array_shift($args);
     $this->validate($request, $articleId);
     $this->setupTemplate($request, true, $articleId);
     $journal =& $request->getJournal();
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($request);
     $user =& $request->getUser();
     $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_PUBLICATION, $user->getId(), $articleId, $journal->getSetting('publicationFee'));
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
     $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:18,代码来源:TrackSubmissionHandler.inc.php


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