本文整理汇总了PHP中Am_Form_Admin类的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin类的具体用法?PHP Am_Form_Admin怎么用?PHP Am_Form_Admin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Am_Form_Admin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: run
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;
}
}
示例6: createForm
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;
}
示例7: 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;
}
示例8: getTransForm
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;
}
示例9: 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');
}
}
示例10: run
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;
}
}
示例11: 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;
}
示例12: createForm
/**
* 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;
}
示例13: createForm
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;
}
示例14: changePaysysAction
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');
}
示例15: 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;
}
}