本文整理匯總了PHP中Am_Form_Admin::isSubmitted方法的典型用法代碼示例。如果您正苦於以下問題:PHP Am_Form_Admin::isSubmitted方法的具體用法?PHP Am_Form_Admin::isSubmitted怎麽用?PHP Am_Form_Admin::isSubmitted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::isSubmitted方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createConfirmForm
protected function createConfirmForm($force_submited = false)
{
$form = new Am_Form_Admin('confirm');
$form->setAction($this->getUrl(null, 'confirm'));
$form->addAdvRadio('mode')->setLabel(___('Import Mode'))->loadOptions(self::getImportModeOptions())->setValue(self::MODE_SKIP);
$group = $form->addGroup();
$group->setSeparator(' ');
$group->addElement('inputbutton', 'back', array('value' => ___('Back')))->setId('back');
$group->addElement('submit', '_submit_', array('value' => ___('Do Import')))->setId('_submit_');
if ($force_submited || $form->isSubmitted()) {
$form->setDataSources(array($this->getRequest()));
} else {
$form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array())));
}
return $form;
}
示例7: replaceProductAction
function replaceProductAction()
{
$this->getDi()->authAdmin->getUser()->checkPermission('_payment', 'edit');
$item = $this->getDi()->invoiceItemTable->load($this->_request->getInt('id'));
$pr = $this->getDi()->productTable->load($item->item_id);
$form = new Am_Form_Admin('replace-product-form');
$form->setDataSources(array($this->_request));
$form->method = 'post';
$form->addHidden('id');
$form->addHidden('user_id');
$form->addStatic()->setLabel(___('Replace Product'))->setContent("#{$pr->product_id} [{$pr->title}]");
$sel = $form->addSelect('product_id')->setLabel('To Product');
$options = array('' => '-- ' . ___('Please select') . ' --');
foreach ($this->getDi()->billingPlanTable->getProductPlanOptions() as $k => $v) {
if (strpos($k, $pr->pk() . '-') !== 0) {
$options[$k] = $v;
}
}
$sel->loadOptions($options);
$sel->addRule('required');
$form->addSubmit('_save', array('value' => ___('Save')));
if ($form->isSubmitted() && $form->validate()) {
try {
list($p, $b) = explode("-", $sel->getValue(), 2);
$item->replaceProduct(intval($p), intval($b));
$this->getDi()->adminLogTable->log("Inside invoice: product #{$item->item_id} replaced to product #{$p} (plan #{$b})", 'invoice', $item->invoice_id);
return $this->ajaxResponse(array('ok' => true));
} catch (Am_Exception $e) {
$sel->setError($e->getMessage());
}
}
echo $form->__toString();
}
示例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: createconfirmForm
protected function createconfirmForm()
{
$form = new Am_Form_Admin('confirm');
$form->setAction($this->getUrl(null, 'confirm'));
$form->addElement('select', 'mode')->setLabel('Import Mode')->loadOptions(self::getImportModeOptions());
$group = $form->addGroup();
$group->addElement('inputbutton', 'back', array('value' => 'Back'))->setId('back');
$group->addElement('submit', '_submit_', array('value' => 'Do Import'))->setId('_submit_');
if ($form->isSubmitted()) {
$form->setDataSources(array($this->_request));
} else {
$form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array())));
}
return $form;
}
示例10: 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;
}
}
示例11: 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');
}