Esempio n. 1
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addInteger("tag")->setLabel(___("Sort order"))->addRule('required');
     $form->addAdvCheckbox('_is_disabled')->setLabel(___('Is Disabled?'));
     $form->addText("title")->setLabel(___("Title"))->addRule('required');
     return $form;
 }
 public function createForm(Am_Grid_Editable $grid)
 {
     $id = substr($grid->getId(), 1);
     $form = new Am_Form_Admin();
     $form->addText("value", array('size' => 40))->setLabel(___("Value\nuse % as wildcard mask"));
     $form->addHidden("type")->setValue($id);
     $form->addText('comment', array('size' => 40))->setLabel(___("Comment"));
     return $form;
 }
 public function createForm()
 {
     $f = new Am_Form_Admin();
     $g = $f->addGroup()->setLabel('Name');
     $g->addText('name_f', array('size' => 40));
     $g->addText('name_l', array('size' => 40));
     $f->addText('email', array('size' => 40))->setLabel('E-Mail Address')->addRule('required')->addRule('callback', ___("Please enter valid e-mail address"), array('Am_Validate', 'email'));
     $f->addMagicSelect('_s')->setLabel('Lists')->loadOptions($this->lists);
     return $f;
 }
 public function createForm()
 {
     $form = new Am_Form_Admin();
     $options = Am_Currency::getSupportedCurrencies();
     array_remove_value($options, Am_Currency::getDefault());
     $sel = $form->addSelect('currency', array('class' => 'am-combobox'))->setLabel(___('Currency'))->loadOptions($options)->addRule('required');
     $date = $form->addDate('date')->setLabel(___('Date'))->addRule('required')->addRule('callback2', "--wrong date--", array($this, 'checkDate'));
     $rate = $form->addText('rate', array('length' => 8))->setLabel(___("Exchange Rate\nenter cost of 1 (one) %s", Am_Currency::getDefault()))->addRule('required');
     return $form;
 }
Esempio n. 5
0
    public function run()
    {
        $form = new Am_Form_Admin('form-grid-config');
        $form->setAttribute('name', 'customize');
        $form->addSortableMagicSelect('fields')->loadOptions($this->getFieldsOptions())->setLabel(___('Fields to Display in Grid'))->setJsOptions(<<<CUT
{
    allowSelectAll:true,
    sortable: true
}
CUT
);
        foreach ($this->grid->getVariablesList() as $k) {
            $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
        }
        $form->addSaveButton();
        $form->setDataSources(array($this->grid->getCompleteRequest()));
        if ($form->isSubmitted()) {
            $values = $form->getValue();
            $this->setConfig($values['fields']);
            $this->grid->redirectBack();
        } else {
            $form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array('fields' => $this->getSelectedFields()))));
            echo $this->renderTitle();
            echo sprintf('<div class="info">%s</div>', ___('You can change Number of %sRecords per Page%s in section %sSetup/Configuration%s', '<strong>', '</strong>', '<a class="link" href="' . REL_ROOT_URL . '/admin-setup" target="_top">', '</a>'));
            echo $form;
        }
    }
    public function createForm()
    {
        $mainForm = new Am_Form_Admin();
        $form = $mainForm->addFieldset()->setLabel(___('Admin Settings'));
        $login = $form->addText('login')->setLabel(___('Admin Username'));
        $login->addRule('required')->addRule('length', ___('Length of username must be from %d to %d', 4, 16), array(4, 16))->addRule('regex', ___('Admin username must be alphanumeric in small caps'), '/^[a-z][a-z0-9_-]+$/');
        $set = $form->addGroup()->setLabel(___('First and Last Name'));
        $set->setSeparator(' ');
        $set->addText('name_f');
        $set->addText('name_l');
        $pass = $form->addPassword('_passwd')->setLabel(___('New Password'));
        $pass->addRule('length', ___('Length of admin password must be from %d to %d', 6, 16), array(6, 16));
        $pass->addRule('neq', ___('Password must not be equal to username'), $login);
        $pass0 = $form->addPassword('_passwd0')->setLabel(___('Confirm New Password'));
        $pass0->addRule('eq', ___('Passwords must be the same'), $pass);
        $form->addText('email')->setLabel(___('E-Mail Address'))->addRule('required');
        $super = $form->addAdvCheckbox('super_user')->setId('super-user')->setLabel(___('Super Admin'));
        //Only Super Admin has access to this page
        $record = $this->grid->getRecord();
        if ($this->getDi()->authAdmin->getUserId() == $record->get('admin_id')) {
            $super->toggleFrozen(true);
        }
        if ($this->getDi()->authAdmin->getUserId() != $record->get('admin_id')) {
            $group = $form->addGroup('perms')->setId('perms')->setLabel(___('Permissions'))->setSeparator('<br />');
            foreach ($this->getDi()->authAdmin->getPermissionsList() as $perm => $title) {
                if (is_string($title)) {
                    $group->addCheckbox($perm)->setContent($title);
                } else {
                    $gr = $group->addGroup($perm);
                    $gr->addStatic()->setContent('<div>');
                    $gr->addStatic()->setContent('<strong>' . $title['__label'] . '</strong>');
                    $gr->addStatic()->setContent('<div style="padding-left:1em">');
                    unset($title['__label']);
                    foreach ($title as $k => $v) {
                        $gr->addCheckbox($k)->setContent($v);
                        $gr->addStatic()->setContent(' ');
                    }
                    $gr->addStatic()->setContent('</div>');
                    $gr->addStatic()->setContent('</div>');
                }
            }
            $mainForm->addScript()->setScript(<<<CUT
\$('#super-user').change(function(){
    \$('#row-perms').toggle(!this.checked);
}).change();
CUT
);
        }
        $self_password = $mainForm->addFieldset()->setLabel(___('Authentification'))->addPassword('self_password')->setLabel(___("Your Password\n" . "enter your current password\n" . "in order to edit admin record"));
        $self_password->addRule('callback', ___('Wrong password'), array($this, 'checkSelfPassword'));
        return $mainForm;
    }
 public function createForm($grid)
 {
     $form = new Am_Form_Admin();
     $name = $form->addText('name', array('class' => 'el-wide'))->setLabel(___('Title'));
     $r = $grid->getRecord();
     if ($r->isLoaded() && $r->pk() < self::DEFAULT_LAYOUT_THRESHOLD) {
         $name->toggleFrozen('true');
     } else {
         $name->addRule('required');
     }
     $form->addTextarea('layout', array('rows' => 25, 'class' => 'row-wide el-wide'))->setLabel(___("Layout\n" . "use placholder %content% for email output"))->addRule('callback', ___('Your layout has not %content% placeholder'), array($this, 'checkLayout'));
     return $form;
 }
Esempio n. 8
0
 protected function getTransForm($text)
 {
     $trans = $this->getTrans($text);
     $lgList = $this->getDi()->languagesListUser;
     $form = new Am_Form_Admin();
     $form->setAction($this->getUrl(null, 'update-trans'));
     $default = $this->getDi()->config->get('lang.default', 'en');
     $form->addStatic('text_default')->setContent(sprintf("<div>%s</div>", $this->escape($text)));
     foreach ($trans as $lg => $t) {
         if ($lg != $default) {
             $form->addElement('textarea', 'trans[' . $lg . ']', array('class' => 'el-wide'))->setLabel($lgList[$lg])->setValue($t);
         }
     }
     $form->addElement('hidden', 'text')->setValue($text);
     return (string) $form;
 }
Esempio n. 9
0
 public function __construct($id)
 {
     parent::__construct('setup_form_' . $id, null);
     $this->setPageId($id);
     if ($plugin_readme = $this->getReadme()) {
         $plugin_readme = str_replace(array('%root_url%', '%root_surl%', '%root_dir%'), array(ROOT_URL, ROOT_SURL, ROOT_DIR), $plugin_readme);
         $this->addEpilog('<div class="info"><pre>' . $plugin_readme . '</pre></div>');
     }
 }
Esempio n. 10
0
    public function indexAction()
    {
        if ($this->getRequest()->getParam('title') && $this->getRequest()->getParam('actionType')) {
            $productIds = $this->getRequest()->getParam('productIds');
            $prIds = $productIds ? implode(',', $productIds) : implode(',', array_keys($this->getDi()->productTable->getOptions(true)));
            $htmlcode = '
<!-- Button/Link for aMember Shopping Cart -->
<script type="text/javascript">
if (typeof cart  == "undefined")
    document.write("<scr" + "ipt src=\'' . REL_ROOT_URL . '/application/cart/views/public/js/cart.js\'></scr" + "ipt>");
</script>
';
            if ($this->getRequest()->getParam('isLink')) {
                $htmlcode .= '<a href="#" onclick="cart.' . $this->getRequest()->getParam('actionType') . '(this,' . $prIds . '); return false;" >' . $this->getRequest()->getParam('title') . '</a>';
            } else {
                $htmlcode .= '<input type="button" onclick="cart.' . $this->getRequest()->getParam('actionType') . '(this,' . $prIds . '); return false;" value="' . $this->getRequest()->getParam('title') . '">';
            }
            $htmlcode .= '
<!-- End Button/Link for aMember Shopping Cart -->
';
            $this->view->assign('htmlcode', $htmlcode);
            $this->view->display('admin/cart/button-code.phtml');
        } else {
            $form = new Am_Form_Admin();
            $form->addMagicSelect('productIds')->setLabel(___('Select Product(s)
if nothing selected - all products'))->loadOptions($this->getDi()->productTable->getOptions());
            $form->addSelect('isLink')->setLabel(___('Select Type of Element'))->loadOptions(array(0 => 'Button', 1 => 'Link'));
            $form->addSelect('actionType')->setLabel(___('Select Action of Element'))->loadOptions(array('addExternal' => ___('Add to Basket only'), 'addBasketExternal' => ___('Add & Go to Basket'), 'addCheckoutExternal' => ___('Add & Checkout')));
            $form->addText('title')->setLabel(___('Title of Element'))->addRule('required');
            $form->addSaveButton(___('Generate'));
            $this->view->assign('form', $form);
            $this->view->display('admin/cart/button-code.phtml');
        }
    }
Esempio n. 11
0
 function init()
 {
     $self_password = $this->addPassword('self_password')->setLabel(___("Your Password\n" . "enter your current password\n" . "in order to edit admin record"));
     $self_password->addRule('required');
     $self_password->addRule('callback', ___('Wrong password'), array($this, 'checkCurrentPassword'));
     $pass = $this->addPassword('pass')->setLabel(___('New Password'));
     $pass->addRule('length', ___('Length of admin password must be from %d to %d', 6, 16), array(6, 16));
     $pass->addRule('neq', ___('Password must not be equal to username'), Am_Di::getInstance()->authAdmin->getUser()->login);
     $pass0 = $this->addPassword('_passwd0')->setLabel(___('Confirm New Password'));
     $pass0->addRule('eq', ___('Passwords must be the same'), $pass);
     parent::init();
     $this->addSaveButton();
 }
Esempio n. 12
0
 function run()
 {
     $form = new Am_Form_Admin('form-grid-payout');
     $form->setAttribute('name', 'payout');
     $date = $form->addDate('payout_date')->setLabel(___('Payout Date'))->setValue(sqlDate($this->getDi()->dateTime));
     foreach ($this->grid->getVariablesList() as $k) {
         $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
     }
     $form->addSaveButton(___("Run Payout"));
     $form->setDataSources(array($this->grid->getCompleteRequest()));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->getValue();
         $this->getDi()->affCommissionTable->runPayout($values['payout_date']);
         $this->grid->redirectBack();
     } else {
         echo $this->renderTitle();
         echo $form;
     }
 }
Esempio n. 13
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addInteger("tag")->setLabel(___("Sort order"))->addRule('required');
     $form->addAdvCheckbox('_is_disabled')->setLabel(___('Is&nbsp;Disabled?'));
     $form->addText('title')->setLabel(___('Title'))->addRule('required');
     if (!$this->grid->getRecord()->pk()) {
         $gr = $form->addGroup();
         $gr->addStatic()->setContent('<span>' . $this->country . '-</span>');
         $gr->addText('state', array('size' => 5))->addRule('required');
         $gr->setLabel(___('Code'));
     }
     $form->addHidden('country');
     return $form;
 }
Esempio n. 14
0
 /**
  * Add elements to config form
  * no need to add "time" controls
  */
 protected function createForm()
 {
     $form = new Am_Form_Admin('form-' . $this->getId());
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array($this->getFormDefaults()));
     $form->setAction(REL_ROOT_URL . '/admin-reports/run/report_id/' . $this->getId());
     if ($this->getPointFieldType() == self::POINT_DATE) {
         $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());
     }
     $this->_initConfigForm($form);
     $form->addSubmit('save', array('value' => ___('Run Report')));
     return $form;
 }
Esempio n. 15
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->setAction($this->getUrl(null, 'clear'));
     $form->addDate('dat')->setLabel(___("Date to Purge\nall records prior to this date will be removed from selected tables"))->addRule('required');
     $section = $form->addFieldset('tables')->setLabel(___('Tables to Purge'));
     foreach ($this->getItems() as $id => $item) {
         $section->addAdvCheckbox($id)->setLabel(array($item['title'], $item['desc']));
     }
     $form->addSaveButton(___('Clear'));
     return $form;
 }
Esempio n. 16
0
    function init()
    {
        $this->addText('users_count')->setLabel(___('Generate Users Count'))->setValue(100);
        $this->addText('email_domain')->setLabel(___("Email Domain\nused to generate email address for users"))->setValue('cgi-central.int');
        if ($this->isProductsExists()) {
            $this->addCheckbox('do_not_generate_products', array('checked' => 'checked'))->setLabel(___("Do not generate products\n" . "use existing products for demo records"))->setId('form-do-not-generate-products');
            $this->addMagicSelect('product_ids')->setLabel(___("Use the following product for demo users\n" . 'keep it empty to use any products'))->setId('form-product_ids')->loadOptions(Am_Di::getInstance()->productTable->getOptions());
            $script = <<<CUT
\$(function() {

    function toggle_do_not_generate_products() {
        if (\$('input[name=do_not_generate_products]').prop('checked')) {
            \$('#form-products-count').parents('.row').hide();
            \$('#form-product_ids').parents('.row').show();
        } else {
            \$('#form-products-count').parents('.row').show();
            \$('#form-product_ids').parents('.row').hide();
        }
    }

    toggle_do_not_generate_products()

    \$('input[name=do_not_generate_products]').bind('change', function(){
        toggle_do_not_generate_products();
    })
});
CUT;
            $this->addScript('script')->setScript($script);
        }
        $this->addText('products_count', array('size' => 3))->setLabel(___('Generate Products Count'))->setValue(3)->setId('form-products-count');
        $gr = $this->addGroup()->setLabel(___('Invoices Per User'));
        $gr->addText('invoices_per_user', array('size' => 3))->setValue(2);
        $gr->addStatic()->setContent(' +/- ');
        $gr->addText('invoices_per_user_variation', array('size' => 3))->setValue(1);
        $gr = $this->addGroup()->setLabel(___('Products Per Invoice'));
        $gr->addText('products_per_invoice', array('size' => 3))->setValue(2);
        $gr->addStatic()->setContent(' +/- ');
        $gr->addText('products_per_invoice_variation', array('size' => 3))->setValue(1);
        $gr = $this->addGroup()->setLabel(___('Period'));
        $gr->setSeparator(' ');
        $gr->addDate('date_begin', array('size' => 8))->setValue(sqlDate('-60 days'));
        $gr->addDate('date_end', array('size' => 8))->setValue(sqlDate('now'));
        parent::init();
        $this->addSaveButton(___('Generate'));
    }
 function changePaysysAction()
 {
     $form = new Am_Form_Admin();
     $form->setDataSources(array($this->_request));
     $form->addStatic()->setContent(___('If you are moving from one payment processor, you can use this page to switch existing subscription from one payment processor to another. It is possible only if full credit card info is stored on aMember side.'));
     $options = array();
     foreach ($this->getModule()->getPlugins() as $ps) {
         $options[$ps->getId()] = $ps->getTitle();
     }
     $from = $form->addSelect('from')->setLabel('Move Active Invoices From')->loadOptions($options)->addRule('required');
     $to = $form->addSelect('to')->setLabel('Move To')->loadOptions($options)->addRule('required');
     $to->addRule('neq', ___('Values must not be equal'), $from);
     $form->addSaveButton();
     if ($form->isSubmitted() && $form->validate()) {
         $vars = $form->getValue();
         $updated = $this->getDi()->db->query("UPDATE ?_invoice SET paysys_id=? WHERE paysys_id=? AND status IN (?a)", $vars['to'], $vars['from'], array(Invoice::RECURRING_ACTIVE));
         $this->view->content = "{$updated} rows changed. New rebills for these invoices will be handled with [{$vars['to']}]";
     } else {
         $this->view->content = (string) $form;
     }
     $this->view->title = ___("Change Paysystem");
     $this->view->display('admin/layout.phtml');
 }
Esempio n. 18
0
 function run()
 {
     $form = new Am_Form_Admin('form-vomm-void');
     $form->setAttribute('name', 'void');
     $comm = $this->grid->getRecord();
     $form->addText('amount', array('size' => 6))->setlabel(___('Void Amount'));
     foreach ($this->grid->getVariablesList() as $k) {
         $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
     }
     $g = $form->addGroup();
     $g->setSeparator(' ');
     $g->addSubmit('_save', array('value' => ___("Void")));
     $g->addStatic()->setContent(sprintf('<a href="%s" class="link" style="margin-left:0.5em">%s</a>', $this->grid->getBackUrl(), ___('Cancel')));
     $form->setDataSources(array($this->grid->getCompleteRequest(), new HTML_QuickForm2_DataSource_Array(array('amount' => $comm->amount))));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->getValue();
         $this->void($values['amount']);
         $this->grid->redirectBack();
     } else {
         echo $this->renderTitle();
         echo $form;
     }
 }
Esempio n. 19
0
    function createForm()
    {
        $form = new Am_Form_Admin();
        $form->addText('title', array('size' => 80))->setLabel(___('Title'))->addRule('required');
        $form->addText('desc', array('size' => 80))->setLabel(___('Description'));
        $sel = $form->addSelect('access', array('size' => 1, 'id' => 'newsletter-access'))->setLabel(___('Access'));
        $sel->loadOptions(array(NewsletterList::ACCESS_RESTRICTED => ___('Restricted Access'), NewsletterList::ACCESS_USERS => ___('Access allowed for all Users'), NewsletterList::ACCESS_GUESTS_AND_USERS => ___('Access allowed for all Users and Guests')));
        $form->addScript()->setScript(<<<CUT
jQuery(document).ready(function(\$) {
    \$("#newsletter-access").change(function(){
        \$("select.category").closest(".row").toggle(\$(this).val() == 0);
    }).change();
});
CUT
);
        $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'))->setAttribute('without_period', 'true');
        return $form;
    }
 function init()
 {
     $this->addElement('text', 'root_url', array('size' => 40))->setLabel(___("Root URL\nroot script URL, usually %s", '<i>http://www.yoursite.com/amember</i>'))->addRule('callback2', '-error-must-be-returned-', array($this, 'validateRootUrl'));
     $this->addElement('text', 'root_surl', array('size' => 40))->setLabel(___("Secure Root URL\nsecure URL, usually %s", '<i>http<b>s</b>://www.yoursite.com/amember</i>'))->addRule('callback2', '-error-must-be-returned-', array($this, 'validateRootUrl'));
     if ('==TRIAL==' == '==' . 'TRIAL==') {
         $license = Am_Di::getInstance()->config->get('license');
         $this->addElement('textarea', 'license', array('style' => 'width:95%', 'rows' => count(explode("\n", $license)) + 1))->setLabel(___("License Key"))->addRule('required')->addRule('notregex', ___('You have license keys from past versions of aMember, please replace it with latest, one-line keys'), '/====\\s+LICENSE/')->addRule('callback', ___('Valid license key are one-line string,starts with L and ends with X'), array($this, 'validateKeys'));
         if ($domains = Am_License::getInstance()->getDomains()) {
             $cnt = '<i>' . implode(",", Am_License::getInstance()->getDomains()) . '</i> ';
             $cnt .= ___("expires") . ' ';
             $cnt .= amDate(Am_License::getInstance()->getExpires());
         } else {
             $cnt = "No License Configured";
         }
     } else {
         $cnt = "Using TRIAL Version - expires ==TRIAL_EXPIRES==";
     }
     $this->addElement('static')->setLabel(___('Configured License Keys'))->setContent($cnt);
     parent::init();
     $this->addSaveButton(___('Update License Information'));
 }
Esempio n. 21
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addText('comment', 'size=60')->setLabel(___('Comment'))->addRule('required');
     $form->addText('key', 'size=60 maxlength=50')->setLabel(___('Api Key'))->addRule('required')->addRule('regex', ___('Digits and latin letters only please'), '/^[a-zA-Z0-9]+$/')->addRule('minlength', ___('Key must be 20 chars or longer'), 20);
     $form->addAdvCheckbox('is_disabled')->setLabel(___('Is Disabled'));
     $fs = $form->addFieldset('perms')->setLabel(___('Permissions'));
     $gr = $fs->addGroup('', array('class' => 'no-label'));
     $module = $this->getModule();
     foreach ($module->getControllers() as $alias => $record) {
         $gr->addStatic()->setContent("<div style='width: 30%; font-weight: bold;'>{$alias}  - " . $record['comment'] . '</div>');
         foreach ($record['methods'] as $method) {
             $gr->addCheckbox("_perms[{$alias}][{$method}]")->setContent($method);
         }
         $gr->addStatic()->setContent("<br />");
     }
     return $form;
 }
Esempio n. 22
0
    function askRemoteAccess()
    {
        $form = new Am_Form_Admin();
        $info = $this->loadRemoteAccess();
        if ($info && !empty($info['_tested'])) {
            return true;
        }
        if ($info) {
            $form->addDataSource(new Am_Request($info));
        }
        $method = $form->addSelect('method', null, array('options' => array('ftp' => 'FTP', 'sftp' => 'SFTP')))->setLabel(___('Access Method'));
        $gr = $form->addGroup('hostname')->setLabel(___('Hostname'));
        $gr->addText('host')->addRule('required')->addRule('regex', 'Incorrect hostname value', '/^[\\w\\._-]+$/');
        $gr->addHTML('port-label')->setHTML('&nbsp;<b>Port</b>');
        $gr->addText('port', array('size' => 3));
        $gr->addHTML('port-notice')->setHTML('&nbsp;leave empty if default');
        $form->addText('user')->setLabel(___('Username'))->addRule('required');
        $form->addPassword('pass')->setLabel(___('Password'));
        //        $form->addTextarea('ssh_public_key')->setLabel(___('SSH Public Key'));
        //        $form->addTextarea('ssh_private_key')->setLabel(___('SSH Private Key'));
        $form->addSubmit('', array('value' => ___('Continue')));
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$('#method-0').change(function(){
        \$('#ssh_public_key-0,#ssh_private_key-0').closest('.row').toggle( \$(this).val() == 'ssh' );
    }).change();
});
CUT
);
        $error = null;
        $vars = $form->getValue();
        if ($form->isSubmitted() && $form->validate() && !($error = $this->tryConnect($vars))) {
            $vars['_tested'] = true;
            $this->storeRemoteAccess($vars);
            return true;
        } else {
            //$this->view->title = ___("File Access Credentials Required");
            $this->view->title = ___('Upgrade');
            $this->view->content = "";
            $this->outStepHeader();
            if ($error) {
                $method->setError($error);
            }
            $this->view->content .= (string) $form;
            $this->view->display('admin/layout.phtml');
            $this->noDisplay = true;
        }
    }
Esempio n. 23
0
    public function createUpgradesForm(Am_Grid_Editable $grid)
    {
        $form = new Am_Form_Admin();
        $options = $grid->_planOptions;
        $from = $form->addSelect('from_billing_plan_id', null, array('options' => $options))->setLabel(___('Upgrade From'));
        $to = $form->addSelect('to_billing_plan_id', null, array('options' => $options))->setLabel(___('Upgrade To'));
        $to->addRule('neq', ___('[From] and [To] billing plans must not be equal'), $from);
        $form->addText('surcharge', array('placeholder' => '0.0'))->setLabel(___("Surcharge\nto be additionally charged when customer moves [From]->[To] plan\naMember will not charge First Price on upgrade, use Surcharge instead"));
        $el = $form->addAdvRadio('type')->setLabel(___('Upgrade Price Calculation Type'));
        $el->addOption(<<<CUT
          <b>Default</b> - Unused amount from previous subscription  will be applied as discount to new one
CUT
, ProductUpgrade::TYPE_DEFAULT);
        $el->addOption(<<<CUT
          <b>Flat</b> - User only pay flat rate on upgrade (Surcharge amount)
CUT
, ProductUpgrade::TYPE_FLAT);
        return $form;
    }
Esempio n. 24
0
 public function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addText('title', array('class' => 'el-wide'))->setLabel(___('Title'))->addRule('required');
     $form->addTextarea('content', array('class' => 'el-wide', 'rows' => 10))->setLabel(___('Content'))->addRule('required');
     return $form;
 }
 protected function createUploadForm($force_submited = false)
 {
     $form = new Am_Form_Admin('upload');
     $form->setAction($this->getUrl(null, ''));
     $form->setAttribute('enctype', 'multipart/form-data');
     $file = $form->addElement('file', 'file[]')->setLabel(___('File'));
     $file->setAttribute('class', 'styled');
     $file->addRule('required', ___('This field is a requried field'));
     $form->addElement('submit', '_submit_', array('value' => ___('Next')));
     return $form;
 }
 function createForm()
 {
     $form = new Am_Form_Admin('aff-general-link');
     $form->addElement('text', 'general_link_url', array('class' => 'el-wide'))->setLabel(___("General Affiliate Link Redirect URL\n" . 'It is url of landing page for default affiliate link (which does not related to any banner), ' . 'home page will be used if you keep it empty'))->setValue($this->getDi()->config->get('aff.general_link_url', ''));
     $form->addSaveButton();
     return $form;
 }
Esempio n. 27
0
 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addText('comment', array('class' => 'el-wide'))->setLabel(___("Comment\n" . 'for your reference'))->addRule('required');
     $sel = $form->addMagicSelect('conditions[product]')->setLabel(___("Conditions\n" . 'After actual payment aMember will check user invoice and in case ' . 'of it contains one of defined  product or product from defined ' . 'product category this OTO will be shown for him instead of ' . 'ordinary thank you page. In case of you use OTO (Downsell) ' . 'condition it will be matched if user click NO link in defined ' . 'offer and this OTO will be shown for user'));
     $cats = $pr = $oto = array();
     foreach ($this->getDi()->productCategoryTable->getAdminSelectOptions() as $k => $v) {
         $cats['category-' . $k] = ___('Category') . ':' . $v;
     }
     foreach ($this->getDi()->productTable->getOptions() as $k => $v) {
         $pr['product-' . $k] = ___('Product') . ':' . $v;
     }
     foreach ($this->getDi()->otoTable->getOptions() as $k => $v) {
         $oto['oto-' . $k] = ___('OTO') . ':' . $v;
     }
     $options = array(___('Categories') => $cats) + ($pr ? array(___('Products') => $pr) : array()) + ($oto ? array(___('OTO (Downsell)') => $oto) : array());
     $sel->loadOptions($options);
     $sel->addRule('required');
     $bpOptions = array();
     foreach ($this->getDi()->productTable->findBy(array('is_archived' => 0)) as $product) {
         /* @var $product Product */
         foreach ($product->getBillingOptions() as $bp_id => $title) {
             $bpOptions[$product->pk() . '-' . $bp_id] = sprintf('(%d) %s (%s)', $product->pk(), $product->title, $title);
         }
     }
     $form->addSelect('product_id')->setLabel('Product to Offer')->loadOptions($bpOptions)->addRule('required');
     $coupons = array('' => '');
     foreach ($this->getDi()->db->selectCol("\n\t\tSELECT c.coupon_id as ARRAY_KEY,\n\t\tCONCAT(c.code, ' - ' , b.comment)\n\t\tFROM ?_coupon c LEFT JOIN ?_coupon_batch b USING (batch_id)\n\t\tORDER BY c.code\n        ") as $k => $v) {
         $coupons[$k] = $v;
     }
     $form->addSelect('coupon_id')->setLabel(___('Apply Coupon (optional)'))->loadOptions($coupons);
     $psList = array('' => '') + $this->getDi()->paysystemList->getOptionsPublic();
     $form->addSelect('view[paysys_id]')->setLabel(___('Paysystem (optional)'))->loadOptions($psList);
     $fs = $form->addFieldSet()->setLabel(___('Offer Page Settings'));
     $fs->addText('view[title]', array('class' => 'el-wide'))->setLabel(___('Title'));
     $fs->addHtmlEditor('view[html]')->setLabel("Offer Text\nuse %yes% and %no% to insert buttons");
     $fs->addHtmlEditor('view[yes][label]')->setLabel('[Yes] button text');
     $fs->addHtmlEditor('view[no][label]')->setLabel('[No] button code');
     $fs->addAdvCheckbox('view[no_layout]')->setLabel(___("Avoid using standard layout\nyou have to design entire page in the 'Offer Text' field"));
     return $form;
 }
 function createForm()
 {
     $form = new Am_Form_Admin();
     $text = $form->addElement('text', 'title', array('size' => 60))->setLabel('Title');
     $text->addRule('required');
     $url = $form->addElement('text', 'url', array('size' => 60))->setLabel('Redirect URL');
     $url->addRule('required');
     $form->addElement('textarea', 'desc', array('rows' => 10, 'style' => 'width:90%'))->setLabel(array('Description', ''));
     $form->addElement('hidden', 'type')->setValue($this->affBannerType);
     return $form;
 }
Esempio n. 29
0
    public function run()
    {
        $form = new Am_Form_Admin();
        $form->setAction($this->getUrl());
        $form->setAttribute('name', 'export');
        $form->setAttribute('target', '_blank');
        $form->addElement('magicselect', 'fields_to_export')->loadOptions($this->getExportOptions())->setLabel(___('Fields To Export'));
        $form->addElement('select', 'export_type')->loadOptions(Am_Grid_Export_Processor_Factory::getOptions())->setLabel(___('Export Format'))->setId('form-export-type');
        foreach (Am_Grid_Export_Processor_Factory::createAll() as $id => $obj) {
            $obj->buildForm($form->addElement('fieldset', $id)->setId('form-export-options-' . $id));
        }
        $form->addSubmit('export', array('value' => ___('Export')));
        $script = <<<CUT
(function(\$){
    \$(function(){
        function update_options(\$sel) {
            \$('[id^=form-export-options-]').hide();
            \$('#form-export-options-' + \$sel.val()).show();
        }   
        
        update_options(\$('#form-export-type'));
        \$('#form-export-type').bind('change', function() {
            update_options(\$(this));
        })

    })
})(jQuery)
CUT;
        $form->addScript('script')->setScript($script);
        $this->initForm($form);
        if ($form->isSubmitted()) {
            $values = $form->getValue();
            $fields = array();
            foreach ($values['fields_to_export'] as $fieldName) {
                $fields[$fieldName] = $this->getField($fieldName);
            }
            $export = Am_Grid_Export_Processor_Factory::create($values['export_type']);
            $export->run($this->grid, $this->getDataSource($fields), $fields, $values);
            exit;
        } else {
            echo $this->renderTitle();
            echo $form;
        }
    }
Esempio n. 30
0
 protected function createForm()
 {
     $form = new Am_Form_Admin();
     $form->setAttribute('class', 'am-form-helpdesk');
     return $form;
 }