本文整理汇总了PHP中Am_Form_Admin::addText方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::addText方法的具体用法?PHP Am_Form_Admin::addText怎么用?PHP Am_Form_Admin::addText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::addText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createForm
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;
}
示例2: indexAction
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');
}
}
示例3: createForm
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;
}
示例4: createForm
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;
}
示例5: createForm
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;
}
示例6: createForm
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;
}
示例7: createForm
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;
}
示例8: createForm
public function createForm()
{
$form = new Am_Form_Admin();
$form->setAttribute('enctype', 'multipart/form-data');
$file = $form->addElement('file', 'upload[]')->setLabel(___('File'))->setAttribute('class', 'styled');
$file->addRule('required');
$form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
$form->addHidden('prefix')->setValue($this->prefix);
return $form;
}
示例9: createForm
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;
}
示例10: createForm
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');
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;
}
示例11: getAddForm
public function getAddForm()
{
$form = new Am_Form_Admin();
$form->setAction($url = $this->getUrl(null, 'c', null, 'payments', 'addpayment', 'user_id', $this->user_id));
$form->addText("receipt_id", array('tabindex' => 2))->setLabel("Receipt#")->addRule('required');
$amt = $form->addSelect("amount", array('tabindex' => 3), array('intrinsic_validation' => false))->setLabel("Amount");
$amt->addRule('required', 'This field is required');
if ($this->_request->getInt('invoice_id')) {
$invoice = $this->getDi()->invoiceTable->load($this->_request->getInt('invoice_id'));
if (!$invoice->first_total || $invoice->getPaymentsCount()) {
$amt->addOption($invoice->second_total, $invoice->second_total);
} else {
$amt->addOption($invoice->first_total, $invoice->first_total);
}
}
$form->addSelect("paysys_id", array('tabindex' => 1))->setLabel("Payment System")->loadOptions($this->getDi()->paysystemList->getOptions());
$date = $form->addDate("dattm", array('tabindex' => 4))->setLabel("Date Of Transaction");
$date->addRule('required', 'This field is required');
$date->setValue(sqlDate('now'));
$form->addHidden("invoice_id");
$form->addSaveButton();
return $form;
}
示例12: run
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;
}
}
示例13: createConfigForm
public function createConfigForm(Am_Grid_Editable $grid)
{
$form = new Am_Form_Admin();
$record = $grid->getRecord($grid->getCurrentAction());
if (empty($record->type)) {
$record->type = null;
}
if (empty($record->tier)) {
$record->tier = 0;
}
$globalOptions = AffCommissionRule::getTypes();
$record->type && !isset($globalOptions[$record->type]) && ($globalOptions[$record->type] = $record->getTypeTitle());
$cb = $form->addSelect('type')->setLabel('Type')->loadOptions($globalOptions);
if ($record->isGlobal()) {
$cb->toggleFrozen(true);
}
$form->addScript()->setScript(<<<CUT
\$(function(){
\$("select#type-0").change(function(){
var val = \$(this).val();
\$("fieldset#multiplier").toggle(val == 'multi');
\$("fieldset#commission").toggle(val != 'multi');
var checked = val.match(/^global-/);
\$("#conditions").toggle(!checked);
\$("#sort_order-0").closest(".row").toggle(!checked);
}).change();
\$("#condition-select").change(function(){
var val = \$(this).val();
\$(this.options[this.selectedIndex]).prop("disabled", true);
this.selectedIndex = 0;
\$('input[name="_conditions_status[' + val + ']"]').val(1);
\$('#row-'+val).show();
});
\$("#conditions .row").not("#row-condition-select").each(function(){
var val = /row-(.*)/i.exec(this.id).pop();
if (!\$('input[name="_conditions_status[' + val + ']"]').val()) {
\$(this).hide();
} else {
\$("#condition-select option[value='"+val+"']").prop("disabled", true);
}
\$(this).find(".element-title").append(" <a href='javascript:' class='hide-row'>X</a> ");
});
\$(document).on('click',"a.hide-row",function(){
var row = \$(this).closest(".row");
var id = row.hide().attr("id");
var val = /row-(.*)/i.exec(id).pop();
\$('input[name="_conditions_status[' + val + ']"]').val(0);
\$("#condition-select option[value='"+val+"']").prop("disabled", false);
});
\$('#used-type').change(function(){
\$('#used-batch_id, #used-code').hide();
switch (\$(this).val()) {
case 'batch' :
\$('#used-batch_id').show();
break;
case 'coupon' :
\$('#used-code').show();
break;
}
}).change()
});
CUT
);
$comment = $form->addText('comment', array('size' => 40))->setLabel('Rule title - for your own reference');
if ($record->isGlobal()) {
$comment->toggleFrozen(true);
} else {
$comment->addRule('required', 'This field is required');
}
if (!$record->isGlobal()) {
$form->addInteger('sort_order')->setLabel('Sort order - rules with lesser values executed first');
}
if (!$record->isGlobal()) {
$set = $form->addFieldset('', array('id' => 'conditions'))->setLabel('Conditions');
$set->addSelect('', array('id' => 'condition-select'))->setLabel('Add Condition')->loadOptions(array('' => ___('Select Condition...'), 'first_time' => ___('First Time Purchase of Product'), 'coupon' => ___('By Used Coupon'), 'paysys_id' => ___('By Used Payment System'), 'product_id' => ___('By Product'), 'product_category_id' => ___('By Product Category'), 'aff_group_id' => ___('By Affiliate Group Id'), 'aff_sales_count' => ___('By Affiliate Sales Count'), 'aff_items_count' => ___('By Affiliate Item Sales Count'), 'aff_sales_amount' => ___('By Affiliate Sales Amount'), 'aff_product_id' => ___('By Affiliate Active Product'), 'aff_product_category_id' => ___('By Affiliate Active Product Category')));
$set->addHidden('_conditions_status[product_id]');
$set->addMagicSelect('_conditions[product_id]', array('id' => 'product_id'))->setLabel(___("This rule is for particular products\n" . 'if none specified, rule works for all products'))->loadOptions(Am_Di::getInstance()->productTable->getOptions());
$set->addHidden('_conditions_status[product_category_id]');
$el = $set->addMagicSelect('_conditions[product_category_id]', array('id' => 'product_category_id'))->setLabel(___("This rule is for particular product categories\n" . "if none specified, rule works for all product categories"));
$el->loadOptions(Am_Di::getInstance()->productCategoryTable->getAdminSelectOptions());
$set->addHidden('_conditions_status[aff_group_id]');
$el = $set->addMagicSelect('_conditions[aff_group_id]', array('id' => 'aff_group_id'))->setLabel(___("This rule is for particular affiliate groups\n" . "you can add user groups and assign it to customers in User editing form"));
$el->loadOptions(Am_Di::getInstance()->userGroupTable->getSelectOptions());
$set->addHidden('_conditions_status[aff_sales_count]');
$gr = $set->addGroup('_conditions[aff_sales_count]', array('id' => 'aff_sales_count'))->setLabel(___("Affiliate sales count\n" . "trigger this commission if affiliate made more than ... sales within ... days before the current date\n" . "(only count of new invoices is calculated)"));
$gr->addStatic()->setContent('use only if affiliate referred ');
$gr->addInteger('count', array('size' => 4));
$gr->addStatic()->setContent(' invoices within last ');
$gr->addInteger('days', array('size' => 4));
$gr->addStatic()->setContent(' days');
$set->addHidden('_conditions_status[aff_items_count]');
$gr = $set->addGroup('_conditions[aff_items_count]', array('id' => 'aff_items_count'))->setLabel(___("Affiliate items count\n" . "trigger this commission if affiliate made more than ... item sales within ... days before the current date\n" . "(only count of items in new invoices is calculated"));
$gr->addStatic()->setContent('use only if affiliate made ');
$gr->addInteger('count', array('size' => 4));
$gr->addStatic()->setContent(' item sales within last ');
//.........这里部分代码省略.........
示例14: createForm
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;
}
示例15: addEmailOrLogin
function createForm()
{
$form = new Am_Form_Admin();
$form->addAdvRadio('is_custom')->loadOptions(array(0 => ___('Use Pre-Defined Template'), 1 => ___('Define Custom Html Message')))->setValue(0);
$form->addTextarea('content', array('rows' => '7', 'class' => 'row-wide el-wide'))->setLabel(___("Content\n" . 'You can use all user specific placeholders here eg. %user.login%, %user.name_f%, %user.name_l% etc.'))->addRule('required');
$form->addText('url', array('class' => 'el-wide', 'rel' => 'form-pre-defined'))->setLabel(___('Link'));
$form->addAdvcheckbox('is_blank', array('rel' => 'form-pre-defined'))->setLabel(___('Open Link in New Window'));
$form->addScript()->setScript(<<<CUT
\$('[name=is_custom]').change(function(){
\$('[rel=form-pre-defined]').closest('.row').toggle(\$('[name=is_custom]:checked').val() == 0)
}).change();
CUT
);
$sel = $form->addMagicSelect('_target')->setLabel(___('Target By User'));
$cats = $pr = $gr = array();
foreach ($this->getDi()->userGroupTable->getSelectOptions() as $k => $v) {
$gr['user_group_id-' . $k] = 'Group: ' . $v;
}
$options = array('free' => ___('All'), 'user_id' => ___('Specific User')) + ($cats ? array(___('Product Categories') => $cats) : array()) + ($gr ? array(___('User Groups') => $gr) : array()) + ($pr ? array(___('Products') => $pr) : array());
$sel->loadOptions($options);
//$sel->addRule('required');
$sel->setJsOptions('{onChange:function(val){
$("input[name^=_loginOrEmail]").closest(\'.row\').toggle(val.hasOwnProperty("user_id"));
}}');
$loginGroup = $form->addGroup('');
$loginGroup->setLabel(___('E-Mail Address or Username'));
$loginGroup->addHidden('_savedLoginOrEmail')->setValue('');
$login = $loginGroup->addText('_loginOrEmail[]');
$label_add_user = ___('Add User');
$loginGroup->addHtml()->setHtml(<<<CUT
<div><a href="javascript:void(null);" id="target-user_id-add" class="local">{$label_add_user}</a></div>
CUT
);
$form->addElement(new Am_Form_Element_ResourceAccess('_raccess', array('without_free' => true)))->setLabel('Target By Product');
$gr = $form->addGroup()->setSeparator(' ')->setLabel(___("Dates\n" . 'date range when notification is shown'));
$gr->addDate('begin', array('placeholder' => ___('Begin Date')));
$gr->addDate('expire', array('placeholder' => ___('Expire Date')));
$form->addScript('script')->setScript(<<<CUT
\$("input[name^=_loginOrEmail]").autocomplete({
minLength: 2,
source: window.rootUrl + "/admin-users/autocomplete"
});
CUT
);
$delIcon = $this->getDi()->view->icon('delete');
$form->addScript('script2')->setScript(<<<CUT
var arr = \$('[name=_savedLoginOrEmail]').val().split(',').reverse();
\$('[name^=_loginOrEmail]').val(arr.pop());
for (var i in arr) {
var \$field = addEmailOrLogin(\$('#target-user_id-add'));
\$field.val(arr[i]);
}
function addEmailOrLogin(context) {
var \$field = \$('<input tyep="text" name="_loginOrEmail[]" />');
\$(context).before('<br />');
\$(context).before(\$field);
\$(context).before('<a href="javascript:void(null)" onclick="\$(this).prev().remove();\$(this).prev().remove();\$(this).next().remove();\$(this).remove()">{$delIcon}</a>');
\$(context).before('<br />');
\$field.autocomplete({
minLength: 2,
source: window.rootUrl + "/admin-users/autocomplete"
});
return \$field;
}
\$('#target-user_id-add').click(function(){
addEmailOrLogin(this);
})
CUT
);
$form->addText('limit', array('placeholder' => ___('Unlimited')))->setLabel(___("Limit Number of Display per User\n" . 'keep it empty for unlimited'));
return $form;
}