public function renderElement(HTML_QuickForm2_Container $form) { $form->options['Subuser'][$this->getId()] = $this->title; $group = $form->addGroup($this->getId())->setLabel($this->title)->setAttribute('id', $this->getId())->setAttribute('class', 'searchField empty'); $sel = $group->addSelect('val'); $sel->loadOptions($this->options); }
public function addPayoutInputs(HTML_QuickForm2_Container $fieldSet) { $el = $fieldSet->addSelect('aff_payout_type')->setLabel(___('Affiliate Payout Type'))->loadOptions(array_merge(array('' => ___('Not Selected')))); foreach (Am_Aff_PayoutMethod::getEnabled() as $method) { $el->addOption($method->getTitle(), $method->getId()); } $fieldSet->addScript()->setScript(' /**** show only options for selected payout method */ $(function(){ $("#' . $el->getId() . '").change(function() { for (i in this.options) { var v = this.options[i].value; (i == this.selectedIndex) ? $(":input[name^=aff_"+v+"_]").parents(".row").show() : $(":input[name^=aff_"+v+"_]").parents(".row").hide(); } }).change(); }); /**** end of payout method options */ '); foreach ($this->getDi()->userTable->customFields()->getAll() as $f) { if (strpos($f->name, 'aff_') === 0) { $f->addToQf2($fieldSet); } } }
public function insertBrick(HTML_QuickForm2_Container $form) { if ($this->getConfig('type') == 'checkboxes') { $options = Am_Di::getInstance()->newsletterListTable->getUserOptions(); if ($enabled = $this->getConfig('lists')) { $_ = $options; $options = array(); foreach ($enabled as $id) { $options[$id] = $_[$id]; } } if (!$options) { return; } // no lists enabled $group = $form->addGroup('_newsletter')->setLabel($this->___('Subscribe to Site Newsletters')); $group->setSeparator("<br />\n"); foreach ($options as $list_id => $title) { $c = $group->addAdvCheckbox($list_id)->setContent($title); if (!$this->getConfig('unchecked')) { $c->setAttribute('checked'); } } } else { $c = $form->addAdvCheckbox('_newsletter')->setLabel($this->___('Subscribe to Site Newsletters')); if (!$this->getConfig('unchecked')) { $c->setAttribute('checked'); } } }
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 element(\HTML_QuickForm2_Container $form) { $this->options = [0 => $this->all, -1 => $this->no, 1 => $this->yes]; $form->putGroupRadioButtonTwbs($this->form_field, $this->options)->setLabel($this->label); if (!$this->value) { $form->getForm()->initValues([$this->form_field => 0]); } }
function getIntegrationFormElements(HTML_QuickForm2_Container $container) { $container->addSelect('blog_id', '', array('options' => $this->getBlogs()))->setLabel(array('Blog where user should be added', 'By default user will be added to main blog with the same permissions')); $groups = $this->getParentPlugin()->getManagedUserGroups(); $options = array(); foreach ($groups as $g) { $options[$g->getId()] = $g->getTitle(); } $container->addSelect('gr', array(), array('options' => $options))->setLabel($this->getTitle() . ' usergroup'); parent::getIntegrationFormElements($container); }
function element(\HTML_QuickForm2_Container $form) { $cnt = count($this->options); switch (true) { case $cnt <= 5: $form->putGroupCheckboxButtonTwbs($this->form_field, $this->options)->setLabel($this->label); break; case $cnt <= 15: $form->putGroupCheckboxTwbs($this->form_field, $this->options, false)->setLabel($this->label); break; default: $form->putSelect2Twbs($this->form_field)->setMultiple(true)->setLabel($this->label)->loadOptions($this->options); break; } }
function element(\HTML_QuickForm2_Container $form) { $gr = $form->putGroupTwbs($this->form_field)->setLabel($this->label)->addClass('filter-daterange-block'); $from = $gr->putDateTwbs('from')->setAppendClear()->setWrapClass('col-lg-6')->setPrepend('с'); $to = $gr->putDateTwbs('to')->setAppendClear()->setWrapClass('col-lg-6')->setPrepend('по'); $gr->setAttribute('data-from', $from->getId())->setAttribute('data-to', $to->getId())->setDesc(' <div class="col-lg-12"> <span class="js-filter-daterange" data-from="' . Carbon::now()->format('d.m.Y') . '" data-to="' . Carbon::now()->format('d.m.Y') . '">Сегодня</span> <span class="js-filter-daterange" data-from="' . Carbon::now()->subDay()->format('d.m.Y') . '" data-to="' . Carbon::now()->subDay()->format('d.m.Y') . '">Вчера</span> <span class="js-filter-daterange" data-from="' . Carbon::now()->subDays(7)->format('d.m.Y') . '" data-to="' . Carbon::now()->format('d.m.Y') . '">Неделя</span> <span class="js-filter-daterange" data-from="' . Carbon::now()->subDays(14)->format('d.m.Y') . '" data-to="' . Carbon::now()->format('d.m.Y') . '">2 недели</span> <span class="js-filter-daterange" data-from="' . Carbon::now()->subDays(30)->format('d.m.Y') . '" data-to="' . Carbon::now()->format('d.m.Y') . '">Месяц</span> </div> '); }
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); } }
/** * 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; }
/** * Returns the form's values * * @return array */ public function getValue() { $values = array(); foreach (array_keys($this->pages) as $id) { $values = HTML_QuickForm2_Container::arrayMerge($values, $this->getSessionContainer()->getValues($id)); } return $values; }
public function insertBrick(HTML_QuickForm2_Container $form) { $el = $form->addText('tax_id')->setLabel($this->___("EU VAT Id (optional)"))->addRule('regex', $this->___('Invalid EU VAT Id format'), '/^[A-Za-z]{2}[a-zA-Z0-9\\s]+$/'); if (!$this->getConfig('dont_validate')) { $el->addRule('callback2', '-error-', array($this, 'validate')); } if ($this->getConfig('required')) { $el->addRule('required', $this->___("Please enter EU VAT Id")); } }
/** * Returns the data sources for this element * * @return array */ protected function getDataSources() { if (empty($this->container)) { return array(); } else { return $this->container->getDataSources(); } }
/** * @return HTML_QuickForm2_Container */ public function addGroup(HTML_QuickForm2_Container $form) { $form->options[$this->fieldGroupTitle][$this->getId()] = $this->title; return $form->addGroup($this->getId())->setLabel($this->title)->setAttribute('id', $this->getId())->setAttribute('class', 'searchField empty'); }
public function __construct(HTML_QuickForm2_Container $container) { parent::__construct($container->getElements()); }
protected function _buildForm(HTML_QuickForm2_Container $form) { $form->addElement('static', 'field_' . $this->getName())->setLabel($this->getTitle())->setContent(sprintf("<div>%s</div>", ___('Generated'))); }
/** * Performs the server-side validation * * @return boolean Whether all form's elements are valid */ public function validate() { return $this->isSubmitted() && parent::validate(); }
/** * Adds element's client-side validation rules to a builder object * * This will also call forceValidator() if the repeat does not contain * any (visible) items but some of the child elements define client-side rules * * @param HTML_QuickForm2_JavascriptBuilder $builder */ protected function renderClientRules(HTML_QuickForm2_JavascriptBuilder $builder) { if ($this->toggleFrozen()) { return; } if (!$this->getIndexes()) { $fakeBuilder = new HTML_QuickForm2_JavascriptBuilder(); /* @var $child HTML_QuickForm2_Node */ foreach ($this->getRecursiveIterator() as $child) { $child->renderClientRules($fakeBuilder); } if ($fakeBuilder->getValidator()) { $builder->forceValidator(); } } parent::renderClientRules($builder); }
function element(\HTML_QuickForm2_Container $form) { $form->putTextTwbs($this->form_field)->setLabel($this->label)->setDesc($this->desc); }
public function renderElement(HTML_QuickForm2_Container $form) { $form->options['Newsletter Lists'][$this->getId()] = $this->title; $group = $form->addGroup($this->getId())->setLabel($this->title)->setAttribute('id', $this->getId())->setAttribute('class', 'searchField empty'); $group->addSelect('val', array('multiple' => 'multiple', 'size' => 5))->loadOptions(Am_Di::getInstance()->newsletterListTable->getAdminOptions()); }
public function renderElement(HTML_QuickForm2_Container $form) { $form->options[___('User Groups')][$this->getId()] = $this->title; $group = $form->addGroup($this->getId())->setLabel($this->title)->setAttribute('id', $this->getId())->setAttribute('class', 'searchField empty'); $group->addSelect('ids', 'multiple=multiple size=5')->loadOptions($this->getOptions()); }
public function addPayoutInputs(HTML_QuickForm2_Container $fieldSet) { $el = $fieldSet->addSelect('aff_payout_type')->setLabel(___('Affiliate Payout Type'))->loadOptions(array_merge(array('' => ___('Not Selected')))); foreach (Am_Aff_PayoutMethod::getEnabled() as $method) { $el->addOption($method->getTitle(), $method->getId()); } $fieldSet->addScript()->setScript(' /**** show only options for selected payout method */ $(function(){ $("#' . $el->getId() . '").change(function() { var selected = $("#' . $el->getId() . '").val(); $("option", $(this)).each(function(){ var option = $(this).val(); if(option == selected){ $("input[name^=aff_"+option+"_]").closest(".row").show(); }else{ $("input[name^=aff_"+option+"_]").closest(".row").hide(); } }); }).change(); }); /**** end of payout method options */ '); foreach ($this->getDi()->userTable->customFields()->getAll() as $f) { if (strpos($f->name, 'aff_') === 0) { $f->addToQf2($fieldSet); } } }
function element(\HTML_QuickForm2_Container $form) { $gr = $form->putGroupTwbs($this->form_field)->setLabel($this->label . ($this->units ? ', ' . $this->units : '')); $gr->putNumberTwbs('from')->setPrepend('от')->setAppendClear()->setWrapClass('col-lg-6'); $gr->putNumberTwbs('to')->setPrepend('до')->setAppendClear()->setWrapClass('col-lg-6'); }
public function insertBrick(\HTML_QuickForm2_Container $form) { $user = Am_Di::getInstance()->auth->getUser(); $options = array_filter(array($user->login, $user->name_f, $user->name_l, $user->data()->get('_wordpress_nickname'), $user->name_f . ' ' . $user->name_l, $user->name_l . ' ' . $user->name_f)); $form->addSelect('_wordpress_display')->setLabel($this->___('Display name publicly as'))->loadOptions(array_combine($options, $options)); }
/** * Inserts an element in the container * * If the reference object is not given, the element will be appended. * * @param HTML_QuickForm2_Node Element to insert * @param HTML_QuickForm2_Node Reference to insert before * @return HTML_QuickForm2_Node Inserted element */ public function insertBefore(HTML_QuickForm2_Node $element, HTML_QuickForm2_Node $reference = null) { if (null === $reference) { return $this->appendChild($element); } return parent::insertBefore($this->renameChild($element), $reference); }
/** * 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; }
public function getIntegrationFormElements(HTML_QuickForm2_Container $group) { $group->addText('unsub_list_id')->setLabel(array('<span class="required">* </span>' . ___('ArpReach List Unsubscribe Id'), ___('required value') . '<br/>' . ___('you can get it from ArpReach Unsubscribe form'))); }
public function getIntegrationFormElements(HTML_QuickForm2_Container $container) { $groups = $this->getManagedUserGroups(); $options = array(); foreach ($groups as $g) { $options[$g->getId()] = $g->getTitle(); } $container->addSelect('gr', array(), array('options' => $options))->setLabel($this->getTitle() . ' usergroup'); }
/** * Performs the server-side validation * * @return boolean Whether all form's elements are valid */ public function validate() { $isSubmitted = false; foreach ($this->datasources as $ds) { if ($ds instanceof HTML_QuickForm2_DataSource_Submit) { $isSubmitted = true; break; } } return $isSubmitted ? parent::validate() : false; }
public function renderElement(HTML_QuickForm2_Container $form) { //$form->options['Quick Filter'][$this->getId()] = $this->title; $group = $form->addGroup($this->getId())->setLabel($this->title)->setAttribute('id', $this->getId())->setAttribute('class', 'searchField empty'); $group->addText('val'); }