本文整理汇总了PHP中FormValidator::addRadio方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addRadio方法的具体用法?PHP FormValidator::addRadio怎么用?PHP FormValidator::addRadio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addRadio方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @param FormValidator $form
* @param array $questionData
* @param array $answers
*/
public function render(FormValidator $form, $questionData = array(), $answers = null)
{
if (is_array($questionData['options'])) {
if ($questionData['display'] == 'vertical') {
$class = 'radio';
} else {
$class = 'radio-inline';
}
$name = 'question' . $questionData['question_id'];
$form->addRadio($name, null, $questionData['options'], ['radio-class' => $class, 'label-class' => $class]);
if (!empty($answers)) {
$form->setDefaults([$name => $answers]);
}
}
}
示例2: unset
}
exit;
}
$form->addHeader($plugin->get_lang('UserInformation'));
$form->addText('name', get_lang('Name'), false, ['cols-size' => [5, 7, 0]]);
$form->addText('username', get_lang('Username'), false, ['cols-size' => [5, 7, 0]]);
$form->addText('email', get_lang('EmailAddress'), false, ['cols-size' => [5, 7, 0]]);
$form->addHeader($plugin->get_lang('PaymentMethods'));
$paymentTypesOptions = $plugin->getPaymentTypes();
if (!$paypalEnabled) {
unset($paymentTypesOptions[BuyCoursesPlugin::PAYMENT_TYPE_PAYPAL]);
}
if (!$transferEnabled) {
unset($paymentTypesOptions[BuyCoursesPlugin::PAYMENT_TYPE_TRANSFER]);
}
$form->addRadio('payment_type', null, $paymentTypesOptions);
$form->addHidden('t', intval($_GET['t']));
$form->addHidden('i', intval($_GET['i']));
$form->freeze(['name', 'username', 'email']);
$form->setDefaults(['name' => $userInfo['complete_name'], 'username' => $userInfo['username'], 'email' => $userInfo['email']]);
$form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
// View
$templateName = $plugin->get_lang('PaymentMethods');
$interbreadcrumb[] = array("url" => "course_catalog.php", "name" => $plugin->get_lang('CourseListOnSale'));
$tpl = new Template($templateName);
$tpl->assign('buying_course', $buyingCourse);
$tpl->assign('buying_session', $buyingSession);
$tpl->assign('user', api_get_user_info());
$tpl->assign('form', $form->returnForm());
if ($buyingCourse) {
$tpl->assign('course', $courseInfo);
示例3: isset
$selectedStatus = isset($_GET['status']) ? $_GET['status'] : BuyCoursesPlugin::SALE_STATUS_PENDING;
$selectedSale = isset($_GET['sale']) ? intval($_GET['sale']) : 0;
$searchTerm = '';
$form = new FormValidator('search', 'get');
if ($form->validate()) {
$selectedFilterType = $form->getSubmitValue('filter_type');
$selectedStatus = $form->getSubmitValue('status');
$searchTerm = $form->getSubmitValue('user');
if ($selectedStatus === false) {
$selectedStatus = BuyCoursesPlugin::SALE_STATUS_PENDING;
}
if ($selectedFilterType === false) {
$selectedFilterType = '0';
}
}
$form->addRadio('filter_type', get_lang('Filter'), [$plugin->get_lang('ByStatus'), $plugin->get_lang('ByUser')]);
$form->addHtml('<div id="report-by-status" ' . ($selectedFilterType !== '0' ? 'style="display:none"' : '') . '>');
$form->addSelect('status', $plugin->get_lang('OrderStatus'), $saleStatuses);
$form->addHtml('</div>');
$form->addHtml('<div id="report-by-user" ' . ($selectedFilterType !== '1' ? 'style="display:none"' : '') . '>');
$form->addText('user', get_lang('UserName'), false);
$form->addHtml('</div>');
$form->addButtonFilter(get_lang('Search'));
$form->setDefaults(['filter_type' => $selectedFilterType, 'status' => $selectedStatus]);
switch ($selectedFilterType) {
case '0':
$sales = $plugin->getSaleListByStatus($selectedStatus);
break;
case '1':
$sales = $plugin->getSaleListByUser($searchTerm);
break;