Example #1
0
 function addBillingPlanElements(HTML_QuickForm2_Container $fieldSet, $plan)
 {
     $prefix = '_plan[' . $plan . '][';
     $suffix = ']';
     $firstPrice = $fieldSet->addElement('text', $prefix . 'first_price' . $suffix)->setLabel(___("First Price\n" . "price of first period of subscription"));
     $firstPrice->addRule('gte', ___('must be equal or greather than 0'), 0.0)->addRule('regex', ___('must be a number in format 99 or 99.99'), '/^(\\d+(\\.\\d+)?|)$/');
     $firstPeriod = $fieldSet->addElement('period', $prefix . 'first_period' . $suffix)->setLabel(___('First Period'));
     $group = $fieldSet->addGroup()->setLabel(___("Rebill Times\n" . "This is the number of payments which\n" . "will occur at the Second Price"));
     $group->setSeparator(' ');
     $sel = $group->addElement('select', $prefix . '_rebill_times' . $suffix)->setId('s_rebill_times');
     $sel->addOption(___('No more charges'), 0);
     $sel->addOption(___('Charge Second Price Once'), 1);
     $sel->addOption(___('Charge Second Price x Times'), 'x');
     $sel->addOption(___('Rebill Second Price until cancelled'), IProduct::RECURRING_REBILLS);
     $txt = $group->addElement('text', $prefix . 'rebill_times' . $suffix, array('size' => 5, 'maxlength' => 6))->setId('t_rebill_times');
     $secondPrice = $fieldSet->addElement('text', $prefix . 'second_price' . $suffix)->setLabel(___("Second Price\n" . "price that must be billed for second and\n" . "the following periods of subscription"));
     $secondPrice->addRule('gte', ___('must be equal or greather than 0.0'), 0.0)->addRule('regex', ___('must be a number in format 99 or 99.99'), '/^\\d+(\\.\\d+)?$/');
     $secondPeriod = $fieldSet->addElement('period', $prefix . 'second_period' . $suffix)->setLabel(___('Second Period'));
     $secondPeriod = $fieldSet->addElement('text', $prefix . 'terms' . $suffix, array('size' => 40, 'class' => 'translate'))->setLabel(___("Terms Text\nautomatically calculated if empty"));
     $fs = $fieldSet->addGroup()->setLabel(___("Quantity\ndefault - 1, normally you do not need to change it\nFirst and Second Price is the total for specified qty"));
     $fs->setSeparator(' ');
     $fs->addInteger($prefix . 'qty' . $suffix, array('placeholder' => 1));
     $fs->addCheckbox($prefix . 'variable_qty' . $suffix, array('class' => 'variable_qty'))->setContent(___('allow user to change quantity'));
     if (Am_Di::getInstance()->config->get('product_paysystem')) {
         $fieldSet->addMagicSelect($prefix . 'paysys_id' . $suffix)->setLabel(___("Payment System\n" . "Choose payment system to be used with this product"))->loadOptions(Am_Di::getInstance()->paysystemList->getOptions());
     }
     foreach (Am_Di::getInstance()->billingPlanTable->customFields()->getAll() as $k => $f) {
         $el = $f->addToQf2($fieldSet);
         $el->setName($prefix . $el->getName() . $suffix);
     }
 }
 function addBillingPlanElements(HTML_QuickForm2_Container $fieldSet, $plan)
 {
     $prefix = '_plan[' . $plan . '][';
     $suffix = ']';
     $firstPrice = $fieldSet->addElement('text', $prefix . 'first_price' . $suffix)->setLabel(___("First Price\n" . "price of first period of subscription"));
     $firstPrice->addRule('gte', ___('must be equal or greather than 0'), 0.0)->addRule('regex', ___('must be a number in format 99 or 99.99'), '/^(\\d+(\\.\\d+)?|)$/');
     $firstPeriod = $fieldSet->addElement('period', $prefix . 'first_period' . $suffix)->setLabel(___('First Period'));
     $group = $fieldSet->addGroup()->setLabel(___("Rebill Times\n" . "This is the number of payments which\n" . "will occur at the Second Price"));
     $sel = $group->addElement('select', $prefix . '_rebill_times' . $suffix)->setId('s_rebill_times');
     $sel->addOption(___('No more charges'), 0);
     $sel->addOption(___('Charge Second Price Once'), 1);
     $sel->addOption(___('Charge Second Price x Times'), 'x');
     $sel->addOption(___('Rebill Second Price until cancelled'), IProduct::RECURRING_REBILLS);
     $txt = $group->addElement('text', $prefix . 'rebill_times' . $suffix, array('size' => 5, 'maxlength' => 6))->setId('t_rebill_times');
     $secondPrice = $fieldSet->addElement('text', $prefix . 'second_price' . $suffix)->setLabel(___("Second Price\n" . "price that must be billed for second and\n" . "the following periods of subscription"));
     $secondPrice->addRule('gte', ___('must be equal or greather than 0.0'), 0.0)->addRule('regex', ___('must be a number in format 99 or 99.99'), '/^\\d+(\\.\\d+)?$/');
     $secondPeriod = $fieldSet->addElement('period', $prefix . 'second_period' . $suffix)->setLabel(___('Second Period'));
     $secondPeriod = $fieldSet->addElement('text', $prefix . 'terms' . $suffix, array('size' => 40, 'class' => 'translate'))->setLabel(___("Terms Text\nautomatically calculated if empty"));
     foreach (Am_Di::getInstance()->billingPlanTable->customFields()->getAll() as $k => $f) {
         $el = $f->addToQf2($fieldSet);
         $el->setName($prefix . $el->getName() . $suffix);
     }
 }
 protected function _buildForm(HTML_QuickForm2_Container $form)
 {
     $form->addElement('static', 'field_' . $this->getName())->setLabel($this->getTitle())->setContent(sprintf("<div>%s</div>", ___('Generated')));
 }
Example #4
0
 public function insertBrick(HTML_QuickForm2_Container $form)
 {
     $fieldSet = $form->addElement('fieldset', 'fieldset')->setLabel($this->___('Fieldset title'));
 }
Example #5
0
 /**
  * Add the current field to QF2 container
  * @param HTML_QuickForm2_Container
  * @return HTML_QuickForm2_Node
  */
 public function addToQF2(HTML_QuickForm2_Container $container, $params = array())
 {
     $el = $container->addElement($this->qfType, $this->name, $params)->setLabel(!empty($this->description) ? ___($this->title) . "\n" . ___($this->description) : ___($this->title));
     if (!empty($this->size)) {
         $el->setAttribute('size', $this->size);
     }
     if (!empty($this->default)) {
         $el->setValue($this->default);
     }
     if (!(defined('AM_ADMIN') && AM_ADMIN)) {
         $this->addValidateFunction($el);
     }
     return $el;
 }
Example #6
0
 /**
  * Add the current field to QF2 container
  * @param HTML_QuickForm2_Container
  * @return HTML_QuickForm2_Node
  */
 public function addToQF2(HTML_QuickForm2_Container $container, $params = array())
 {
     $el = $container->addElement($this->qfType, $this->name, $params)->setLabel(!empty($this->description) ? array($this->title, $this->description) : $this->title);
     if (!empty($this->size)) {
         $el->setAttribute('size', $this->size);
     }
     $this->addValidateFunction($el);
     return $el;
 }
Example #7
0
 public function insertBrick(HTML_QuickForm2_Container $form)
 {
     $fieldSet = $form->addElement('fieldset', 'address', array('id' => 'row-address-0'))->setLabel($this->___('Address Information'));
     $street = $fieldSet->addText('street')->setLabel($this->___('Street'));
     $city = $fieldSet->addText('city')->setLabel($this->___('City'));
     $zip = $fieldSet->addText('zip')->setLabel($this->___('ZIP Code'));
     $country = $fieldSet->addSelect('country')->setLabel($this->___('Country'))->setId('f_country')->loadOptions(Am_Di::getInstance()->countryTable->getOptions(true));
     $group = $fieldSet->addGroup()->setLabel($this->___('State'));
     $stateSelect = $group->addSelect('state')->setId('f_state')->loadOptions($stateOptions = Am_Di::getInstance()->stateTable->getOptions(@$_REQUEST['country'], true));
     $stateText = $group->addText('state')->setId('t_state');
     $disableObj = $stateOptions ? $stateText : $stateSelect;
     $disableObj->setAttribute('disabled', 'disabled')->setAttribute('style', 'display: none');
     if ($this->getConfig('required')) {
         $street->addRule('required', ___('Please enter %s', $this->___('Street')));
         $city->addRule('required', ___('Please enter %s', $this->___('City')));
         $zip->addRule('required', ___('Please enter %s', $this->___('ZIP Code')));
         $country->addRule('required', ___('Please enter %s', $this->___('Country')));
         $group->addRule('required', ___('Please enter %s', $this->___('State')));
     }
 }