本文整理汇总了PHP中Am_Form_Admin::addSortableMagicSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::addSortableMagicSelect方法的具体用法?PHP Am_Form_Admin::addSortableMagicSelect怎么用?PHP Am_Form_Admin::addSortableMagicSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::addSortableMagicSelect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: run
public function run()
{
$form = new Am_Form_Admin();
$form->setAction($this->getUrl());
$form->setAttribute('name', 'export');
$form->setAttribute('target', '_blank');
$form->addSortableMagicSelect('fields_to_export')->loadOptions($this->getExportOptions())->setLabel(___('Fields To Export'))->setJsOptions(<<<CUT
{
allowSelectAll:true,
sortable: true
}
CUT
);
$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;
}
}
示例3: createWidgetSalesConfigForm
public function createWidgetSalesConfigForm()
{
$form = new Am_Form_Admin();
$form->addSortableMagicSelect('interval', null, array('options' => $this->getDi()->interval->getOptions()))->setLabel(___('Period'))->setValue(array(Am_Interval::PERIOD_TODAY));
return $form;
}