public function init() { parent::init(); $typeDef = $this->record->getTypeDef(); $type = $this->addSelect('type', null, array('options' => Am_Di::getInstance()->savedFormTable->getTypeOptions())); $type->setLabel(___('Form Type')); if (!empty($this->record->type)) { $type->toggleFrozen(true); } $title = $this->addText('title', array('class' => 'el-wide'))->setLabel(___("Custom Signup Form Title\n" . "keep empty to use default title")); $comment = $this->addText('comment', array('class' => 'el-wide'))->setLabel(___("Comment\nfor admin reference")); if ($this->record->isSignup() || $this->record->isProfile()) { if (!empty($typeDef['generateCode'])) { $code = $this->addText('code')->setLabel(___("Secret Code\n" . "if form is not choosen as default, this code\n" . "(inside URL) will be necessary to open form"))->addRule('regex', ___('Value must be alpha-numeric'), '/[a-zA-Z0-9_]/'); } } if ($this->record->type == SavedForm::T_SIGNUP || $this->record->type == SavedForm::T_PROFILE) { $this->addAdvCheckbox('hide')->setLabel(___("Hide from Menu\n" . "do not include link to this form in members menu")); } $this->brickEditor = $this->addElement(new Am_Form_Element_BricksEditor('fields', array(), $this->record->createForm()))->setLabel(array('Fields')); if ($this->record->isSignup()) { $this->addSelect('tpl')->setLabel(___("Template\nalternative template for signup page") . "\n" . ___("aMember will look for templates in [application/default/views/signup/] folder\n" . "and in theme's [signup/] folder\n" . "and template filename must start with [signup]"))->loadOptions($this->getSignupTemplates()); } $fs = $this->addAdvFieldset('meta', array('id' => 'meta'))->setLabel(___('Meta Data')); $fs->addText('meta_title', array('class' => 'el-wide'))->setLabel(___('Title')); $fs->addText('meta_keywords', array('class' => 'el-wide'))->setLabel(___('Keywords')); $fs->addText('meta_description', array('class' => 'el-wide'))->setLabel(___('Description')); }
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(); }
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 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')); }
public function init() { parent::init(); $typeDef = $this->record->getTypeDef(); $type = $this->addSelect('type', null, array('options' => Am_Di::getInstance()->savedFormTable->getTypeOptions())); $type->setLabel(___('Form Type')); if (!empty($this->record->type)) { $type->toggleFrozen(true); } $title = $this->addText('title', array('size' => 40))->setLabel(___("Custom Signup Form Title\n" . "keep empty to use default title")); $comment = $this->addText('comment', array('size' => 40))->setLabel(___("Comment\nfor admin reference")); if ($this->record->isSignup()) { if (!empty($typeDef['generateCode'])) { $code = $this->addText('code')->setLabel(___("Secret Code\n" . "if form is not choosen as default, this code\n" . "(inside URL) will be necessary to open form"))->addRule('regex', ___('Value must be alpha-numeric'), '/[a-zA-Z0-9_]/'); } } $this->brickEditor = $this->addElement(new Am_Form_Element_BricksEditor('fields', array(), $this->record->createForm()))->setLabel(array('Fields')); if ($this->record->isSignup()) { $this->addSelect('tpl')->setLabel(___("Template\nalternative template for signup page"))->loadOptions($this->getSignupTemplates()); } }
function init() { $this->addText('users_count')->setLabel(___('Generate Users'))->setValue(100); 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'); $script = <<<CUT \$(function() { function toggle_do_not_generate_products() { if (\$('input[name=do_not_generate_products]').attr('checked')) { \$('#form-products-count').parents('.row').hide(); } else { \$('#form-products-count').parents('.row').show(); } } 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')->setLabel(array(___('Generate Products')))->setValue(3)->setId('form-products-count'); $gr = $this->addGroup()->setLabel(array(___('Invoices Per User'))); $gr->addText('invoices_per_user')->setValue(2); $gr->addStatic()->setContent(' +/-'); $gr->addText('invoices_per_user_variation')->setValue(1); $gr = $this->addGroup()->setLabel(___('Products Per Invoice')); $gr->addText('products_per_invoice')->setValue(2); $gr->addStatic()->setContent(' +/-'); $gr->addText('products_per_invoice_variation')->setValue(1); parent::init(); $this->addSaveButton(___('Generate')); }