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


PHP OJSPaymentManager::purchaseArticleEnabled方法代码示例

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


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

示例1: import

 /**
  * Given an issue, set up the template with all the required variables for
  * issues/view.tpl to function properly (i.e. current issue and view issue).
  * @param $issue object The issue to display
  * @param $showToc boolean iff false and a custom cover page exists,
  * 	the cover page will be displayed. Otherwise table of contents
  * 	will be displayed.
  */
 function _setupIssueTemplate($request, $issue, $showToc = false)
 {
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $templateMgr =& TemplateManager::getManager();
     if (IssueHandler::_isVisibleIssue($issue, $journalId)) {
         $issueHeadingTitle = $issue->getIssueIdentification(false, true);
         $issueCrumbTitle = $issue->getIssueIdentification(false, true);
         $locale = AppLocale::getLocale();
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPagePath = $request->getBaseUrl() . '/';
         $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
         $templateMgr->assign('coverPagePath', $coverPagePath);
         $templateMgr->assign('locale', $locale);
         $coverLocale = $issue->getFileName($locale) ? $locale : $journal->getPrimaryLocale();
         if (!$showToc && $issue->getFileName($coverLocale) && $issue->getShowCoverPage($coverLocale) && !$issue->getHideCoverPageCover($coverLocale)) {
             $templateMgr->assign('fileName', $issue->getFileName($coverLocale));
             $templateMgr->assign('width', $issue->getWidth($coverLocale));
             $templateMgr->assign('height', $issue->getHeight($coverLocale));
             $templateMgr->assign('coverPageAltText', $issue->getCoverPageAltText($coverLocale));
             $templateMgr->assign('originalFileName', $issue->getOriginalFileName($coverLocale));
             $showToc = false;
         } else {
             // Issue galleys
             $issueGalleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
             $issueGalleys =& $issueGalleyDao->getGalleysByIssue($issue->getId());
             $templateMgr->assign_by_ref('issueGalleys', $issueGalleys);
             // Published articles
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticles =& $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true);
             $publicFileManager = new PublicFileManager();
             $templateMgr->assign_by_ref('publishedArticles', $publishedArticles);
             $showToc = true;
         }
         $templateMgr->assign('showToc', $showToc);
         $templateMgr->assign_by_ref('issue', $issue);
         // Subscription Access
         import('classes.issue.IssueAction');
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $subscribedUser = IssueAction::subscribedUser($journal);
         $subscribedDomain = IssueAction::subscribedDomain($journal);
         $subscriptionExpiryPartial = $journal->getSetting('subscriptionExpiryPartial');
         if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain && $subscriptionExpiryPartial) {
             $templateMgr->assign('subscriptionExpiryPartial', true);
             // Partial subscription expiry for issue
             $partial = IssueAction::subscribedUser($journal, $issue->getId());
             if (!$partial) {
                 IssueAction::subscribedDomain($journal, $issue->getId());
             }
             $templateMgr->assign('issueExpiryPartial', $partial);
             // Partial subscription expiry for articles
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId());
             $articleExpiryPartial = array();
             foreach ($publishedArticlesTemp as $publishedArticle) {
                 $partial = IssueAction::subscribedUser($journal, $issue->getId(), $publishedArticle->getId());
                 if (!$partial) {
                     IssueAction::subscribedDomain($journal, $issue->getId(), $publishedArticle->getId());
                 }
                 $articleExpiryPartial[$publishedArticle->getId()] = $partial;
             }
             $templateMgr->assign_by_ref('articleExpiryPartial', $articleExpiryPartial);
         }
         $templateMgr->assign('subscriptionRequired', $subscriptionRequired);
         $templateMgr->assign('subscribedUser', $subscribedUser);
         $templateMgr->assign('subscribedDomain', $subscribedDomain);
         $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
         import('classes.payment.ojs.OJSPaymentManager');
         $paymentManager = new OJSPaymentManager($request);
         if ($paymentManager->onlyPdfEnabled()) {
             $templateMgr->assign('restrictOnlyPdf', true);
         }
         if ($paymentManager->purchaseArticleEnabled()) {
             $templateMgr->assign('purchaseArticleEnabled', true);
         }
     } else {
         $issueCrumbTitle = __('archive.issueUnavailable');
         $issueHeadingTitle = __('archive.issueUnavailable');
     }
     if ($issue && ($styleFileName = $issue->getStyleFileName())) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/' . $styleFileName);
     }
     $templateMgr->assign('pageCrumbTitleTranslated', $issueCrumbTitle);
     $templateMgr->assign('issueHeadingTitle', $issueHeadingTitle);
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:96,代码来源:IssueHandler.inc.php

示例2: import

 /**
  * Given an issue, set up the template with all the required variables for
  * frontend/objects/issue_toc.tpl to function properly (i.e. current issue
  * and view issue).
  * @param $issue object The issue to display
  * @param $showToc boolean iff false and a custom cover page exists,
  * 	the cover page will be displayed. Otherwise table of contents
  * 	will be displayed.
  */
 function _setupIssueTemplate($request, $issue, $showToc = false)
 {
     $journal = $request->getJournal();
     $templateMgr = TemplateManager::getManager($request);
     // Determine pre-publication access
     // FIXME: Do that. (Bug #8278)
     if (!$issue) {
         $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     }
     $templateMgr->assign(array('issueIdentification' => $issue->getIssueIdentification(), 'issueTitle' => $issue->getLocalizedTitle(), 'issueSeries' => $issue->getIssueIdentification(array('showTitle' => false))));
     $locale = AppLocale::getLocale();
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $templateMgr->assign(array('coverPagePath' => $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/', 'locale' => $locale));
     if (!$showToc && $issue->getFileName($locale) && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageCover($locale)) {
         $templateMgr->assign(array('fileName' => $issue->getFileName($locale), 'width' => $issue->getWidth($locale), 'height' => $issue->getHeight($locale), 'coverPageAltText' => $issue->getCoverPageAltText($locale), 'originalFileName' => $issue->getOriginalFileName($locale), 'originalFileName' => $issue->getOriginalFileName($locale)));
     } else {
         $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO');
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $templateMgr->assign(array('issueGalleys' => $issueGalleyDao->getByIssueId($issue->getId()), 'publishedArticles' => $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true)));
         $showToc = true;
     }
     $templateMgr->assign(array('showToc' => $showToc, 'issue' => $issue));
     // Subscription Access
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $subscriptionRequired = $issueAction->subscriptionRequired($issue);
     $subscribedUser = $issueAction->subscribedUser($journal);
     $subscribedDomain = $issueAction->subscribedDomain($journal);
     if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain) {
         $templateMgr->assign('subscriptionExpiryPartial', true);
         // Partial subscription expiry for issue
         $partial = $issueAction->subscribedUser($journal, $issue->getId());
         if (!$partial) {
             $issueAction->subscribedDomain($journal, $issue->getId());
         }
         $templateMgr->assign('issueExpiryPartial', $partial);
         // Partial subscription expiry for articles
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId());
         $articleExpiryPartial = array();
         foreach ($publishedArticlesTemp as $publishedArticle) {
             $partial = $issueAction->subscribedUser($journal, $issue->getId(), $publishedArticle->getId());
             if (!$partial) {
                 $issueAction->subscribedDomain($journal, $issue->getId(), $publishedArticle->getId());
             }
             $articleExpiryPartial[$publishedArticle->getId()] = $partial;
         }
         $templateMgr->assign('articleExpiryPartial', $articleExpiryPartial);
     }
     $templateMgr->assign(array('showGalleyLinks' => !$subscriptionRequired || $journal->getSetting('showGalleyLinks'), 'hasAccess' => !$subscriptionRequired || $issue->getAccessStatus() == ISSUE_ACCESS_OPEN || $subscribedUser || $subscribedDomain));
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($request);
     if ($paymentManager->onlyPdfEnabled()) {
         $templateMgr->assign('restrictOnlyPdf', true);
     }
     if ($paymentManager->purchaseArticleEnabled()) {
         $templateMgr->assign('purchaseArticleEnabled', true);
     }
     if ($styleFileName = $issue->getStyleFileName()) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $styleFileName);
     }
 }
开发者ID:mosvits,项目名称:ojs,代码行数:74,代码来源:IssueHandler.inc.php

示例3: 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

示例4: import

 /**
  * Given an issue, set up the template with all the required variables for
  * frontend/objects/issue_toc.tpl to function properly (i.e. current issue
  * and view issue).
  * @param $issue object The issue to display
  * @param $showToc boolean iff false and a custom cover page exists,
  * 	the cover page will be displayed. Otherwise table of contents
  * 	will be displayed.
  */
 function _setupIssueTemplate($request, $issue, $showToc = false)
 {
     $journal = $request->getJournal();
     $templateMgr = TemplateManager::getManager($request);
     // Determine pre-publication access
     // FIXME: Do that. (Bug #8278)
     if (!$issue) {
         $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     }
     $templateMgr->assign(array('issueIdentification' => $issue->getIssueIdentification(), 'issueTitle' => $issue->getLocalizedTitle(), 'issueSeries' => $issue->getIssueIdentification(array('showTitle' => false))));
     $locale = AppLocale::getLocale();
     $templateMgr->assign(array('locale' => $locale));
     $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO');
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     $templateMgr->assign(array('issue' => $issue, 'issueGalleys' => $issueGalleyDao->getByIssueId($issue->getId()), 'publishedArticles' => $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true)));
     // Subscription Access
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $subscriptionRequired = $issueAction->subscriptionRequired($issue);
     $subscribedUser = $issueAction->subscribedUser($journal);
     $subscribedDomain = $issueAction->subscribedDomain($journal);
     if ($subscriptionRequired && !$subscribedUser && !$subscribedDomain) {
         $templateMgr->assign('subscriptionExpiryPartial', true);
         // Partial subscription expiry for issue
         $partial = $issueAction->subscribedUser($journal, $issue->getId());
         if (!$partial) {
             $issueAction->subscribedDomain($journal, $issue->getId());
         }
         $templateMgr->assign('issueExpiryPartial', $partial);
         // Partial subscription expiry for articles
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId());
         $articleExpiryPartial = array();
         foreach ($publishedArticlesTemp as $publishedArticle) {
             $partial = $issueAction->subscribedUser($journal, $issue->getId(), $publishedArticle->getId());
             if (!$partial) {
                 $issueAction->subscribedDomain($journal, $issue->getId(), $publishedArticle->getId());
             }
             $articleExpiryPartial[$publishedArticle->getId()] = $partial;
         }
         $templateMgr->assign('articleExpiryPartial', $articleExpiryPartial);
     }
     $templateMgr->assign(array('hasAccess' => !$subscriptionRequired || $issue->getAccessStatus() == ISSUE_ACCESS_OPEN || $subscribedUser || $subscribedDomain));
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($request);
     if ($paymentManager->onlyPdfEnabled()) {
         $templateMgr->assign('restrictOnlyPdf', true);
     }
     if ($paymentManager->purchaseArticleEnabled()) {
         $templateMgr->assign('purchaseArticleEnabled', true);
     }
 }
开发者ID:pkp,项目名称:ojs,代码行数:61,代码来源:IssueHandler.inc.php


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