当前位置: 首页>>代码示例>>PHP>>正文


PHP FormValidator::addRadio方法代码示例

本文整理汇总了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]);
         }
     }
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:20,代码来源:ch_yesno.php

示例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);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:process.php

示例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;
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:sales_report.php


注:本文中的FormValidator::addRadio方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。