本文整理汇总了PHP中Am_Form_Admin::addCheckbox方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::addCheckbox方法的具体用法?PHP Am_Form_Admin::addCheckbox怎么用?PHP Am_Form_Admin::addCheckbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Admin
的用法示例。
在下文中一共展示了Am_Form_Admin::addCheckbox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stepConfirmUpgrades
public function stepConfirmUpgrades()
{
$form = new Am_Form_Admin();
$upgrades = $form->addGroup('upgrades', array('class' => 'no-label'));
$options = array();
$static = '';
$upgrades->addStatic()->setContent('<h2>' . ___('Available Upgrades') . '</h2>');
foreach ($this->getSession()->upgrades as $k => $upgrade) {
if (!empty($upgrade->new)) {
$upgrades->addStatic()->setContent('<br /><h2>' . ___('New Modules Available') . '</h2>');
}
$text = sprintf('%s%s, ' . ___('version') . ' %s - %s' . '<br />', '<b>' . $upgrade->title . '</b>', $upgrade->type == 'core' ? '' : sprintf(' [%s - %s]', $upgrade->type, $upgrade->id), '<i>' . $upgrade->version . '</i>', '<i>' . amDate($upgrade->date) . '</i>');
$upgrades->addCheckbox($k, empty($upgrade->checked) ? null : array('checked' => 'checked'))->setContent($text);
$static .= "<div class='changelog' style='' data-for='{$k}'><pre>" . $upgrade->text . "</pre></div>\n";
$upgrades->addStatic()->setContent($static);
}
$form->addCheckbox('_confirm', array('class' => 'no-label'))->setContent(___('I understand that upgrade may overwrite customized PHP files and templates, I have already made a backup of aMember Pro folder and database'))->addRule('required');
$form->addSubmit('', array('value' => ___('Install Updates')));
if ($form->isSubmitted() && $form->validate()) {
$confirmed = array_keys(array_filter($upgrades->getValue()));
if (!$confirmed) {
$this->view->title = ___('No upgrades to install');
$this->view->content = '<a href="' . REL_ROOT_URL . '/admin">' . ___('Back') . '</a>';
return false;
}
$upgrades = $this->getSession()->upgrades;
foreach ($upgrades as $k => $v) {
if (!in_array($k, $confirmed)) {
unset($upgrades[$k]);
}
}
$this->getSession()->upgrades = $upgrades;
return true;
} else {
$this->view->content = (string) $form;
$this->view->title = ___('Choose Upgrades to Install');
$this->view->display('admin/layout.phtml');
$this->noDisplay = true;
return false;
}
}
示例2: createForm
protected function createForm()
{
$f = new Am_Form_Admin();
$f->addText('user')->setLabel('Enter username of existing user')->addRule('required', 'This field is required');
$f->addText('aff')->setLabel('Enter username of existing affiliate')->addRule('required', 'This field is required');
$f->addText('coupon')->setLabel('Enter coupon code or leave field empty');
$f->addCheckbox('is_first')->setLabel('Is first user invoice?');
$f->addElement(new Am_Form_Element_ProductsWithQty('product_id'))->setLabel(___('Choose products to include into test invoice'))->loadOptions(Am_Di::getInstance()->billingPlanTable->selectAllSorted())->addRule('required');
$f->addSelect('paysys_id')->setLabel(___('Payment System'))->loadOptions(Am_Di::getInstance()->paysystemList->getOptions());
$f->addSubmit('', array('value' => 'Test'));
$f->addScript()->setScript(<<<CUT
\$(function(){
\$("#user-0, #aff-0" ).autocomplete({
minLength: 2,
source: window.rootUrl + "/admin-users/autocomplete"
});
});
CUT
);
foreach ($this->grid->getVariablesList() as $k) {
$kk = $this->grid->getId() . '_' . $k;
if ($v = @$_REQUEST[$kk]) {
$f->addHidden($kk)->setValue($v);
}
}
return $f;
}