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(); import('classes.subscription.form.GiftIndividualSubscriptionForm'); $giftSubscriptionForm = new GiftIndividualSubscriptionForm($request); $giftSubscriptionForm->initData(); $giftSubscriptionForm->display(); } /** * 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(); $journalId = $journal->getId(); $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($request, $buyerUserId); $giftSubscriptionForm->readInputData(); if ($giftSubscriptionForm->validate()) { $giftSubscriptionForm->execute(); } else { $giftSubscriptionForm->display(); } } /** * Display generic thank you message following payment * @param $args array * @param $request PKPRequest */ function thankYou($args, $request) { $templateMgr =& TemplateManager::getManager(); $this->setupTemplate(); $journal =& $request->getJournal(); $templateMgr->assign(array( 'currentUrl' => $request->url(null, null, 'gifts'), 'pageTitle' => 'gifts.thankYou', 'journalName' => $journal->getLocalizedTitle(), 'message' => 'gifts.thankYouMessage' )); $templateMgr->display('common/message.tpl'); } } ?>