本文整理汇总了PHP中OJSPaymentManager::acceptGiftSubscriptionPayments方法的典型用法代码示例。如果您正苦于以下问题:PHP OJSPaymentManager::acceptGiftSubscriptionPayments方法的具体用法?PHP OJSPaymentManager::acceptGiftSubscriptionPayments怎么用?PHP OJSPaymentManager::acceptGiftSubscriptionPayments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OJSPaymentManager
的用法示例。
在下文中一共展示了OJSPaymentManager::acceptGiftSubscriptionPayments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: gifts
/**
* Display user gifts page
* @param $args array
* @param $request PKPRequest
*/
function gifts($args, $request)
{
$this->validate();
$journal = $request->getJournal();
if (!$journal) {
$request->redirect(null, 'dashboard');
}
// Ensure gift payments are enabled
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$acceptGiftPayments = $paymentManager->acceptGiftPayments();
if (!$acceptGiftPayments) {
$request->redirect(null, 'dashboard');
}
$acceptGiftSubscriptionPayments = $paymentManager->acceptGiftSubscriptionPayments();
$journalId = $journal->getId();
$user = $request->getUser();
$userId = $user->getId();
// Get user's redeemed and unreedemed gift subscriptions
$giftDao = DAORegistry::getDAO('GiftDAO');
$giftSubscriptions = $giftDao->getGiftsByTypeAndRecipient(ASSOC_TYPE_JOURNAL, $journalId, GIFT_TYPE_SUBSCRIPTION, $userId);
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign(array('journalTitle' => $journal->getLocalizedName(), 'journalPath' => $journal->getPath(), 'acceptGiftSubscriptionPayments' => $acceptGiftSubscriptionPayments, 'giftSubscriptions' => $giftSubscriptions));
$templateMgr->display('user/gifts.tpl');
}
示例3: 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);
}
示例4: subscriptions
/**
* Display subscriptions page.
* @param $args array
* @param $request PKPRequest
*/
function subscriptions($args, &$request)
{
$this->addCheck(new HandlerValidatorJournal($this));
$this->validate();
$this->setupTemplate(true);
$journalDao =& DAORegistry::getDAO('JournalSettingsDAO');
$journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
$subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
$journal =& $request->getJournal();
$journalId = $journal->getId();
$subscriptionName =& $journalSettingsDao->getSetting($journalId, 'subscriptionName');
$subscriptionEmail =& $journalSettingsDao->getSetting($journalId, 'subscriptionEmail');
$subscriptionPhone =& $journalSettingsDao->getSetting($journalId, 'subscriptionPhone');
$subscriptionFax =& $journalSettingsDao->getSetting($journalId, 'subscriptionFax');
$subscriptionMailingAddress =& $journalSettingsDao->getSetting($journalId, 'subscriptionMailingAddress');
$subscriptionAdditionalInformation =& $journal->getLocalizedSetting('subscriptionAdditionalInformation');
$individualSubscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, false, false);
$institutionalSubscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, true, false);
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$acceptGiftSubscriptionPayments = $paymentManager->acceptGiftSubscriptionPayments();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('subscriptionName', $subscriptionName);
$templateMgr->assign('subscriptionEmail', $subscriptionEmail);
$templateMgr->assign('subscriptionPhone', $subscriptionPhone);
$templateMgr->assign('subscriptionFax', $subscriptionFax);
$templateMgr->assign('subscriptionMailingAddress', $subscriptionMailingAddress);
$templateMgr->assign('subscriptionAdditionalInformation', $subscriptionAdditionalInformation);
$templateMgr->assign('acceptGiftSubscriptionPayments', $acceptGiftSubscriptionPayments);
$templateMgr->assign('individualSubscriptionTypes', $individualSubscriptionTypes);
$templateMgr->assign('institutionalSubscriptionTypes', $institutionalSubscriptionTypes);
$templateMgr->display('about/subscriptions.tpl');
}