本文整理汇总了PHP中OJSPaymentManager::acceptSubscriptionPayments方法的典型用法代码示例。如果您正苦于以下问题:PHP OJSPaymentManager::acceptSubscriptionPayments方法的具体用法?PHP OJSPaymentManager::acceptSubscriptionPayments怎么用?PHP OJSPaymentManager::acceptSubscriptionPayments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OJSPaymentManager
的用法示例。
在下文中一共展示了OJSPaymentManager::acceptSubscriptionPayments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: payRenewSubscription
/**
* Pay the "renew subscription" fee.
* @param $args array
* @param $request PKPRequest
*/
function payRenewSubscription($args, $request)
{
$this->validate();
if (count($args) != 2) {
$request->redirect(null, 'dashboard');
}
$journal = $request->getJournal();
if (!$journal) {
$request->redirect(null, 'dashboard');
}
if ($journal->getSetting('publishingMode') != PUBLISHING_MODE_SUBSCRIPTION) {
$request->redirect(null, 'dashboard');
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$acceptSubscriptionPayments = $paymentManager->acceptSubscriptionPayments();
if (!$acceptSubscriptionPayments) {
$request->redirect(null, 'dashboard');
}
$this->setupTemplate($request);
$user = $request->getUser();
$userId = $user->getId();
$institutional = array_shift($args);
$subscriptionId = (int) array_shift($args);
if ($institutional == 'institutional') {
$subscriptionDao = DAORegistry::getDAO('InstitutionalSubscriptionDAO');
} else {
$subscriptionDao = DAORegistry::getDAO('IndividualSubscriptionDAO');
}
if (!$subscriptionDao->subscriptionExistsByUser($subscriptionId, $userId)) {
$request->redirect(null, 'dashboard');
}
$subscription = $subscriptionDao->getSubscription($subscriptionId);
if ($subscription->isNonExpiring()) {
$request->redirect(null, 'dashboard');
}
import('classes.subscription.Subscription');
$subscriptionStatus = $subscription->getStatus();
$validStatus = array(SUBSCRIPTION_STATUS_ACTIVE, SUBSCRIPTION_STATUS_AWAITING_ONLINE_PAYMENT, SUBSCRIPTION_STATUS_AWAITING_MANUAL_PAYMENT);
if (!in_array($subscriptionStatus, $validStatus)) {
$request->redirect(null, 'dashboard');
}
$subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
$subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId());
$queuedPayment = $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_RENEW_SUBSCRIPTION, $user->getId(), $subscriptionId, $subscriptionType->getCost(), $subscriptionType->getCurrencyCodeAlpha());
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
$paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
}
示例3: saveSubscriptionPolicies
/**
* Save subscription policies for the current journal.
* @param $args array
* @param $request PKPRequest
*/
function saveSubscriptionPolicies($args, &$request)
{
import('classes.subscription.form.SubscriptionPolicyForm');
$subscriptionPolicyForm = new SubscriptionPolicyForm();
$subscriptionPolicyForm->readInputData();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
if (Config::getVar('general', 'scheduled_tasks')) {
$templateMgr->assign('scheduledTasksEnabled', true);
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$templateMgr->assign('acceptSubscriptionPayments', $paymentManager->acceptSubscriptionPayments());
if ($subscriptionPolicyForm->validate()) {
$subscriptionPolicyForm->execute();
$templateMgr->assign('subscriptionPoliciesSaved', '1');
$subscriptionPolicyForm->display();
} else {
$subscriptionPolicyForm->display();
}
}
示例4: getSubscriptionSettings
/**
* Returns an array of information on the journal's subscription settings
* @return array
*/
function getSubscriptionSettings(&$request)
{
$journal = $request->getJournal();
if (!$journal) {
return array();
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$settings = array('subscriptionsEnabled' => $paymentManager->acceptSubscriptionPayments(), 'allowRegReviewer' => $journal->getSetting('allowRegReviewer'), 'allowRegAuthor' => $journal->getSetting('allowRegAuthor'));
return $settings;
}