本文整理汇总了PHP中Am_Form_Admin::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::getValue方法的具体用法?PHP Am_Form_Admin::getValue怎么用?PHP Am_Form_Admin::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::getValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
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;
}
}
示例3: 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');
}
示例4: 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;
}
}
示例5: askRemoteAccess
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(' <b>Port</b>');
$gr->addText('port', array('size' => 3));
$gr->addHTML('port-notice')->setHTML(' 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;
}
}
示例6: createAssignForm
protected function createAssignForm($force_submited = false)
{
$form = new Am_Form_Admin('assign');
$form->setAction($this->getUrl(null, 'assign'));
$form->addElement('checkbox', 'skip')->setLabel(___('Skip First Line'))->setId('skip');
$form->addElement('checkbox', 'add_subscription')->setLabel('<strong>' . ___('Add Subscription') . '</strong>')->setId('add_subscription');
$form->addElement('checkbox', 'add_encrypted_pass')->setLabel('<strong>' . ___('Import Encrypted Password') . '</strong>')->setId('add_encrypted_pass');
$form->addElement('select', 'encrypted_pass_format')->loadOptions($this->getEncryptedPassFormatOptions())->setId('encrypted_pass_format');
$form->addElement('select', 'delim')->setLabel(___('Delimiter'))->loadOptions(Import_DataSource::getDelimOptions())->setId('delim');
$form->addElement('submit', '_submit_', array('value' => ___('Next')))->setId('_submit_');
for ($i = 0; $i < $this->dataSource->getColNum(); $i++) {
$fSelect = $form->addElement('select', 'FIELD' . $i)->setId('FIELD' . $i);
}
if ($force_submited || $form->isSubmitted()) {
$form->setDataSources(array($this->getRequest()));
} else {
$form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array('delim' => $this->dataSource->getDelim(Import_DataSource::DELIM_CODE)) + $this->getRequestVarsFromFieldsMap() + $this->getRequestVarsFromImportOptions())));
}
$formValues = $form->getValue();
$add_subscription = @$formValues['add_subscription'];
$add_encrypted_pass = @$formValues['add_encrypted_pass'];
for ($i = 0; $i < $this->dataSource->getColNum(); $i++) {
$fSelect = $form->getElementsByName('FIELD' . $i);
$this->loadFieldsOptions($fSelect[0], $add_subscription, $add_encrypted_pass);
}
return $form;
}
示例7: changeRebillDateAction
function changeRebillDateAction()
{
$this->getDi()->authAdmin->getUser()->checkPermission('grid_invoice', 'edit');
$invoice_id = $this->_request->getInt('invoice_id');
$form = new Am_Form_Admin();
$form->addDate('rebill_date');
$vals = $form->getValue();
$rebill_date = $vals['rebill_date'];
try {
if (!$invoice_id) {
throw new Am_Exception_InputError('No invoice provided');
}
$invoice = $this->getDi()->invoiceTable->load($invoice_id);
// Invoice must be recurring active and rebills should be controlled by paylsystem,
// otherwise this doesn't make any sence
if ($invoice->status != Invoice::RECURRING_ACTIVE || $invoice->getPaysystem()->getRecurringType() != Am_Paysystem_Abstract::REPORTS_CRONREBILL) {
throw new Am_Exception_InputError('Unable to change rebill_date for this invoice!');
}
$rebill_date = new DateTime($rebill_date);
$old_rebill_date = $invoice->rebill_date;
$invoice->updateQuick('rebill_date', $rebill_date->format('Y-m-d'));
$invoice->data()->set('first_rebill_failure', null)->update();
$this->getDi()->invoiceLogTable->log($invoice_id, null, ___('Rebill Date changed from %s to %s', $old_rebill_date, $invoice->rebill_date));
Am_Controller::ajaxResponse(array('ok' => true, 'msg' => ___('Rebill date has been changed!')));
} catch (Exception $e) {
Am_Controller::ajaxResponse(array('ok' => false, 'msg' => $e->getMessage()));
}
}
示例8: importAction
function importAction()
{
$form = new Am_Form_Admin();
$import = $form->addFile('import')->setLabel('Upload file [email-templates.xml]');
$form->addStatic('')->setContent('WARNING! All existing e-mail templates will be removed from database!');
//$import->addRule('required', 'Please upload file');
//$form->addAdvCheckbox('remove')->setLabel('Remove your existing templates?');
$form->addSaveButton(___('Upload'));
if ($form->isSubmitted() && $form->validate()) {
$value = $form->getValue();
$fn = DATA_DIR . '/import.email-templates.xml';
if (!move_uploaded_file($value['import']['tmp_name'], $fn)) {
throw new Am_Exception_InternalError("Could not move uploaded file");
}
$xml = file_get_contents($fn);
if (!$xml) {
throw new Am_Exception_InputError("Could not read XML");
}
$count = $this->getDi()->emailTemplateTable->deleteBy(array())->importXml($xml);
$this->view->content = "Import Finished. {$count} templates imported.";
} else {
$this->view->content = (string) $form;
}
$this->view->title = "Import E-Mail Templates from XML file";
$this->view->display('admin/layout.phtml');
}
示例9: run
function run()
{
$form = new Am_Form_Admin('form-grid-merge');
$form->setAttribute('name', 'merge');
$user = $this->grid->getRecord();
$login = $form->addText('login');
$login->setId('login')->setLabel(___("Username of Source User\nmove information from"));
$login->addRule('callback', ___('Can not find user with such username'), array($this, 'checkUser'));
$login->addRule('callback', ___('You can not merge user with itself'), array($this, 'checkIdenticalUser'));
$target = $form->addStatic()->setContent(sprintf('<div>%s</div>', Am_Controller::escape($user->login)));
$target->setLabel(___("Target User\nmove information to"));
$script = <<<CUT
\$("input#login").autocomplete({
minLength: 2,
source: window.rootUrl + "/admin-users/autocomplete"
});
CUT;
$form->addStatic('', array('class' => 'no-label'))->setContent('<div class="info"><strong>' . ___("WARNING! Once [Merge] button clicked, all invoices, payments, logs\n" . "and other information regarding 'Source User' will be moved\n" . "to the 'Target User' account. 'Source User' account will be deleted.\n" . "There is no way to undo this operation!") . '</strong></div>');
$form->addScript('script')->setScript($script);
foreach ($this->grid->getVariablesList() as $k) {
$form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
}
$form->addSaveButton(___("Merge"));
$form->setDataSources(array($this->grid->getCompleteRequest()));
if ($form->isSubmitted() && $form->validate()) {
$values = $form->getValue();
$this->merge($this->grid->getRecord(), Am_Di::getInstance()->userTable->findFirstByLogin($values['login']));
$this->grid->redirectBack();
} else {
echo $this->renderTitle();
echo $form;
}
}
示例10: 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.'));
$ccPlugins = $echeckPlugins = array();
foreach ($this->getModule()->getPlugins() as $ps) {
if ($ps instanceof Am_Paysystem_CreditCard) {
$ccPlugins[$ps->getId()] = $ps->getTitle();
} elseif ($ps instanceof Am_Paysystem_Echeck) {
$echeckPlugins[$ps->getId()] = $ps->getTitle();
}
}
if (count($ccPlugins) < 2) {
$ccPlugins = array();
}
if (count($echeckPlugins) < 2) {
$echeckPlugins = array();
}
$options = array('' => '-- ' . ___('Please select') . ' --') + ($ccPlugins ? array(___('Credit Card Plugins') => $ccPlugins) : array()) + ($echeckPlugins ? array(___('Echeck Plugins') => $echeckPlugins) : array());
$from = $form->addSelect('from', array('id' => 'paysys_from'))->setLabel('Move Active Invoices From')->loadOptions($options);
$from->addRule('required');
$to = $form->addSelect('to', array('id' => 'paysys_to'))->setLabel('Move To')->loadOptions($options);
$to->addRule('required');
$to->addRule('neq', ___('Values must not be equal'), $from);
$form->addScript()->setScript(<<<CUT
jQuery(function(\$){
\$("#paysys_from").on('change', function(){
\$("#paysys_to").find('option').removeAttr("disabled");
\$("#paysys_to").removeAttr("disabled","disabled");
val_from = \$(this).val();
if (!val_from){
\$("#paysys_to").val('');
\$("#paysys_to").attr("disabled","disabled");
return;
}
val_to = \$("#paysys_to").val();
if(val_from == val_to)
\$("#paysys_to").val('');
obj_to = \$("#paysys_to").find('option[value="'+\$(this).val()+'"]');
obj_to.attr("disabled","disabled");
\$("#paysys_to").find('optgroup[label!="'+obj_to.parent().attr('label')+'"]').find('option').attr("disabled","disabled");
}).change();
});
CUT
);
$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');
}