本文整理汇总了PHP中Am_Form_Admin::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::__toString方法的具体用法?PHP Am_Form_Admin::__toString怎么用?PHP Am_Form_Admin::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::__toString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}