Exemplo n.º 1
0
 function _displaySelect($tpl = null)
 {
     $uri =& JFactory::getURI();
     $document =& JFactory::getDocument();
     $submit_key = JRequest::getVar('key', '');
     $source = JRequest::getVar('source', '');
     if (empty($submit_key)) {
         echo JText::_('COM_REDFORM_PAYMENT_ERROR_MISSING_KEY');
         return;
     }
     $document->setTitle($document->getTitle() . ' - ' . JText::_('COM_REDFORM'));
     $gwoptions = $this->get('GatewayOptions');
     if (!count($gwoptions)) {
         echo JText::_('COM_REDFORM_PAYMENT_ERROR_MISSING_GATEWAY');
         return;
     }
     $lists['gwselect'] = JHTML::_('select.genericlist', $gwoptions, 'gw');
     $price = $this->get('Price');
     $currency = $this->get('Currency');
     $this->assignRef('lists', $lists);
     $this->assign('action', htmlspecialchars($uri->toString()));
     $this->assign('key', $submit_key);
     $this->assign('source', $submit_key);
     $this->assign('price', $price);
     $this->assign('currency', $currency);
     // Analytics
     if (redFORMHelperAnalytics::isEnabled()) {
         $event = new stdclass();
         $event->category = 'payement';
         $event->action = 'display';
         $event->label = "display payment form {$submit_key}";
         $event->value = null;
         redFORMHelperAnalytics::trackEvent($event);
     }
     parent::display($tpl);
 }
Exemplo n.º 2
0
 /**
  * returns the html code for form elements (only the elements ! not the form itself, or the submit buttons...)
  *
  * @param int id of the form to display
  * @param int/array optional id of submission_id, for example when we are modifying previous answers
  * @param int optional number of instance of forms to display (1 is default)
  * @return string html
  */
 function displayForm($form_id, $reference = null, $multiple = 1, $options = array())
 {
     $this->setFormId($form_id);
     $uri =& JFactory::getURI();
     // was this form already submitted before (and there was an error for example, or editing)
     $answers = $this->getAnswers($reference);
     if ($answers && $reference) {
         $submit_key = $answers[0]->submit_key;
     } else {
         $submit_key = null;
         $answers = null;
     }
     $model_redform = new RedformModelRedform();
     $model_redform->setFormId($form_id);
     $form = $model_redform->getForm();
     $html = '<form action="' . JRoute::_('index.php?option=com_redform') . '" method="post" name="redform" class="' . $form->classname . '" enctype="multipart/form-data" onsubmit="return CheckSubmit();">';
     $html .= $this->getFormFields($form_id, $submit_key, $multiple, $options);
     /* Get the user details form */
     if (!$answers && !JRequest::getVar('redform_edit') && !JRequest::getVar('redform_add')) {
         $html .= '<div id="submit_button" style="display: block;" class="submitform' . $form->classname . '"><input type="submit" id="regularsubmit" name="submit" value="' . JText::_('COM_REDFORM_Submit') . '" />';
         $html .= '</div>';
     }
     $html .= '<input type="hidden" name="task" value="save" />';
     if ($answers && $answers[0]->sid > 0) {
         $html .= '<input type="hidden" name="submitter_id" value="' . $answers[0]->sid . '" />';
     }
     if (JRequest::getVar('redform_edit') || JRequest::getVar('redform_add')) {
         $html .= '<input type="hidden" name="controller" value="submitters" />';
     }
     $html .= '<input type="hidden" name="controller" value="redform" />';
     $html .= '<input type="hidden" name="referer" value="' . htmlspecialchars($uri->toString()) . '" />';
     $html .= '</form>';
     // Analytics
     if (redFORMHelperAnalytics::isEnabled()) {
         $event = new stdclass();
         $event->category = 'form';
         $event->action = 'display';
         $event->label = "display form {$form->formname}";
         $event->value = null;
         redFORMHelperAnalytics::trackEvent($event);
     }
     return $html;
 }
Exemplo n.º 3
0
 /**
  * Handle gateway processing message
  * Occurs when returning from gateway, but payment was not yet confirmed
  *
  * @return void
  */
 public function processing()
 {
     $app = JFactory::getApplication();
     $submit_key = $app->input->getString('key', '');
     if ($app->input->get('lang')) {
         $lang_v = "&lang=" . $app->input->get('lang');
     }
     $model = $this->getModel('payment');
     $model->setSubmitKey($submit_key);
     $submitters = $model->getSubmitters();
     if (count($submitters)) {
         $first = current($submitters);
         if (!empty($first->integration)) {
             switch ($first->integration) {
                 case 'redevent':
                     $app->redirect('index.php?option=com_redevent&view=payment&submit_key=' . $submit_key . '&state=processing' . $lang_v);
                     break;
                 default:
                     $app->redirect('index.php?option=com_' . $first->integration . '&view=payment&submit_key=' . $submit_key . '&state=processing' . $lang_v);
                     break;
             }
         }
     }
     // Analytics for default landing page
     if (redFORMHelperAnalytics::isEnabled()) {
         $payement = $model->getPaymentDetails($submit_key);
         // Add transaction
         $trans = new stdclass();
         $trans->id = $submit_key;
         $trans->affiliation = $payement->form;
         $trans->revenue = $model->getPrice();
         redFORMHelperAnalytics::addTrans($trans);
         // Add submitters as items
         foreach ($submitters as $s) {
             $item = new stdclass();
             $item->id = $submit_key;
             $item->productname = 'submitter' . $s->id;
             $item->sku = 'submitter' . $s->id;
             $item->category = '';
             $item->price = $s->price;
             redFORMHelperAnalytics::addItem($item);
         }
         redFORMHelperAnalytics::trackTrans();
     }
     $app->input->set('view', 'payment');
     $app->input->set('layout', 'final');
     $app->input->set('state', 'processing');
     $this->display();
 }