Beispiel #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);
 }
Beispiel #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;
 }