Пример #1
0
    public function initConfigForm(Am_Form $form)
    {
        $el = $form->addSelect('type', array('id' => 'newsletter-type-select'))->setLabel(___('Type'));
        $el->addOption(___('Single Checkbox'), 'checkbox');
        $el->addOption(___('Checkboxes for Selected Lists'), 'checkboxes');
        $form->addAdvCheckbox('no_label', array('id' => 'newsletter-no-label'))->setLabel(___("Hide Label"));
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$('#newsletter-type-select').change(function(){
        \$('#newsletter-no-label').closest('.row').toggle(\$(this).val() == 'checkbox')
    }).change();
})
CUT
);
        $lists = $form->addSortableMagicSelect('lists', array('id' => 'newsletter-lists-select'))->setLabel(___("Lists\n" . 'All List will be displayed if none selected'));
        $lists->loadOptions(Am_Di::getInstance()->newsletterListTable->getAdminOptions());
        $form->addScript()->setScript(<<<CUT
jQuery(document).ready(function(\$) {
    \$("#newsletter-type-select").change(function(){
        var val = \$(this).val();
        \$("#row-newsletter-lists-select").toggle(val == 'checkboxes');
    }).change();
});
CUT
);
        $form->addAdvCheckbox('unchecked')->setLabel(___("Default unchecked\n" . 'Leave unchecked if you want newsletter default to be checked'));
    }
Пример #2
0
 function createForm(array $vars)
 {
     $form = new Am_Form();
     $form->setDataSources(array(new Am_Request($vars)));
     $select = $form->addSelect('', array('size' => 1, 'id' => 'search-add-field'));
     $search = $form->addGroup($this->prefix);
     $search->options[''] = '** ' . ___('Select a condition to add into search') . ' **';
     foreach ($this->possibleConditions as $cond) {
         $cond->renderElement($search);
     }
     $select->loadOptions($search->options);
     $this->form = $form;
 }
Пример #3
0
    public function initConfigForm(Am_Form $form)
    {
        $el = $form->addSelect('type', array('id' => 'newsletter-type-select'))->setLabel('Type');
        $el->addOption('Single Checkbox', 'checkbox');
        $el->addOption('Checkboxes for Selected Lists', 'checkboxes');
        $lists = $form->addMagicSelect('lists', array('id' => 'newsletter-lists-select'))->setLabel(array('Lists', 'All List will be displayed if none selected'));
        $lists->loadOptions(Am_Di::getInstance()->newsletterListTable->getAdminOptions());
        $form->addScript()->setScript(<<<CUT
jQuery(document).ready(function(\$) {
    \$("#newsletter-type-select").change(function(){
        var val = \$(this).val();
        \$("#row-newsletter-lists-select").toggle(val == 'checkboxes');
    }).change();
});
CUT
);
        $form->addAdvCheckbox('unchecked')->setLabel(array('Default unchecked', 'Must the checkboxes be initially unchecked?'));
    }
Пример #4
0
    public function initConfigForm(Am_Form $form)
    {
        $id = $this->field->name . '-display-type';
        $id_value = $this->field->name . '-value';
        $form->addSelect('display_type')->setLabel(___('Display Type'))->setId($id)->loadOptions(array(self::TYPE_NORMAL => ___('Normal'), self::TYPE_READONLY => ___('Read-only'), self::TYPE_HIDDEN => ___('Hidden')));
        $form->addText('value')->setId($id_value)->setLabel(___("Default Value for this field\n" . 'hidden field will be populated with this value'));
        $type_hidden = self::TYPE_HIDDEN;
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$('#{$id}').change(function(){
        \$('#{$id_value}').closest('.row').toggle(\$(this).val() == '{$type_hidden}');
    }).change()
});
CUT
);
        $form->addAdvCheckbox('skip_access_check')->setLabel(___("Do not check Access Permissions\nfor this field on this form (show it without any conditions)"));
    }
Пример #5
0
    protected function _initConfigForm(Am_Form $form)
    {
        $period = $form->addSelect('period')->setLabel(___('Period'))->loadOptions(array_merge($this->getDi()->interval->getOptions(), array(self::PERIOD_EXACT => ___('Exact'))));
        $period_exact = self::PERIOD_EXACT;
        $script = <<<CUT
\$(function(){
\$('select[name=period]').change(function(){
    \$(this).closest('.am-form').find('input[name=start], input[name=stop]').
        closest('div.row').
        toggle(\$(this).val() == '{$period_exact}');
}).change();
})
CUT;
        $form->addScript()->setScript($script);
        $start = $form->addElement('Date', 'start')->setLabel(___('Start'));
        $start->addRule('required');
        $stop = $form->addElement('Date', 'stop')->setLabel(___('End'));
        $stop->addRule('required');
        $form->addRule('callback', 'Start Date cannot be later than the End Date', array($this, 'checkStopDate'));
        $quant = $form->addElement('Select', 'quant')->setLabel(___('Quantity'));
        $quant->addRule('required');
        $quant->loadOptions($this->getQuantityOptions());
    }
Пример #6
0
 public function createRunForm()
 {
     $form = new Am_Form();
     $form->setAction($this->getUrl(null, 'run'));
     $s = $form->addSelect('paysys_id')->setLabel(___('Choose a plugin'));
     $s->addRule('required');
     foreach ($this->getModule()->getPlugins() as $p) {
         $s->addOption($p->getTitle(), $p->getId());
     }
     $form->addDate('date')->setLabel(___('Run Rebill Manually'))->addRule('required');
     $form->addHidden('back_url');
     $form->addSubmit('run', array('value' => ___('Run')));
     return $form;
 }
Пример #7
0
 public function initConfigForm(Am_Form $form)
 {
     $form->addSelect('theme')->setLabel(array('reCaptcha Theme', '<a target="_blank" href="http://code.google.com/apis/recaptcha/docs/customization.html">examples<a/>'))->loadOptions($this->theme_options);
 }