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


PHP FormBuilder类代码示例

本文整理汇总了PHP中FormBuilder的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder类的具体用法?PHP FormBuilder怎么用?PHP FormBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FormBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PrintFormFormForReEntry

function PrintFormFormForReEntry($Type)
{
    $CurrentPage = htmlspecialchars($_SERVER["PHP_SELF"]);
    //Determinte the introduction to give to the form.
    if ($Type == 0) {
        echo 'Error, Please Compleate form bellow:</br></br>';
    } elseif ($Type == 1) {
        echo 'Error, Incorrect Username or Password:</br></br>';
    }
    require 'FormBuilder.php';
    $FormCreator = new FormBuilder();
    echo '<span id=LogInFormContainer>';
    echo $FormCreator->StartForm($PageCreationInstruction = array("Methord" => "post", "Action" => 1, "id" => "LogInForm"));
    $InputsRequired = array(array("InputLabel" => "UserName: ", "OptInputHTMLSeperator" => "<br>", "Options" => array(array('type', 'text'), array('value', $_POST["RAWUserName"]), array("maxlength", 100), array("name", "RAWUserName"))), array("InputLabel" => "Password: ", "Options" => array(array('type', 'password'), array("maxlength", 100), array("name", "Password"))));
    echo $FormCreator->CreateStandardInput($InputsRequired);
    echo '<br>';
    echo $FormCreator->CreateSubmitButton();
    echo $FormCreator->EndForm();
    echo '<span/>';
    /*
    	//Print the form to the page.
    	echo "<form method=\"post\" action=\"$CurrentPage\" >"; //Submits Data to self
    
    	if(isset($_POST["RAWUserName"])){//Add the submitted user name if avaliable
    	echo 'User: <input type="text" name="RAWUserName" value="' . $_POST["RAWUserName"] . '"/></br>';
    	}else{
    		echo 'User: <input type="text" name="RAWUserName" /></br>';
    	}
    	echo 'Password: <input type="Password" name="Password"/></br>';
    	echo '</br>';
    	echo '<input type="submit" value="Log In"/>';
    	echo "</form>";
    */
}
开发者ID:Ro5635,项目名称:EE1EPE,代码行数:34,代码来源:LogIn.inc.php

示例2: handle

 /**
  * Handle the form.
  *
  * @param FormBuilder $builder
  */
 public function handle(FormBuilder $builder)
 {
     if (!$builder->canSave()) {
         return;
     }
     $builder->saveForm();
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:12,代码来源:FormHandler.php

示例3: index

 public function index()
 {
     $bDrop = $this->uri->segment(3);
     $aTableNames = modelsToTableNames();
     foreach ($aTableNames as $k => $sTableName) {
         $oSqlBuilder = new SqlBuilder();
         //** Build tables
         $oTableName = new $k();
         $sCreateSql = $oSqlBuilder->setTableName($sTableName)->getCreateTableString($oTableName->db);
         $this->db->query('FLUSH TABLES;');
         if ($bDrop) {
             $this->db->query($oSqlBuilder->getDropTableString());
         }
         if (!tableExists($sTableName)) {
             $this->db->query($sCreateSql);
         }
         //** Add in any default data
         foreach ($oSqlBuilder->getDefaultDataArray($oTableName->data) as $v) {
             //$oTableName->
             $this->db->query($v);
         }
     }
     foreach ($aTableNames as $k => $sTableName) {
         $oTableName = new $k();
         //** Make forms
         if (!empty($oTableName->form)) {
             $oFormBuilder = new FormBuilder();
             $sForm = $oFormBuilder->setTableName($sTableName)->setFormName($sTableName)->setFormData($oTableName->form)->getFormString();
             createFile('views/admin/includes/forms/' . $sTableName . '_form.php', $sForm);
         }
     }
 }
开发者ID:nhc,项目名称:agency-cms,代码行数:32,代码来源:deploy.php

示例4: registerFormBuilder

 /**
  * {@inheritdoc}
  */
 protected function registerFormBuilder()
 {
     $this->app->bindShared('form', function ($app) {
         $form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken());
         return $form->setSessionStore($app['session.store']);
     });
 }
开发者ID:happydemon,项目名称:laravel-parsley,代码行数:10,代码来源:LaravelParsleyServiceProvider.php

示例5: appendToForm

 /**
  * @param FormBuilder|Form $builder
  */
 public function appendToForm(&$builder, $data, $formArea)
 {
     if ($formArea == 'features') {
         $name = strtolower($this->getName());
         if ($this->factory->serviceExists('mautic.form.type.cloudstorage.' . $name)) {
             $builder->add('provider', 'cloudstorage_' . $name, ['label' => 'mautic.integration.form.provider.settings', 'required' => false, 'data' => isset($data['provider']) ? $data['provider'] : []]);
         }
     }
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:12,代码来源:CloudStorageIntegration.php

示例6: testStringModel

 public function testStringModel()
 {
     $this->markTestskipped();
     $builder = new FormBuilder();
     $model = new TestModel();
     $form = $builder->createFormBuilder($model)->add('string', 'text')->getForm();
     $form->handle(['string' => 'test']);
     $classMetadata = new ClassMetadata(TestModel::class);
     $classMetadata->mapField(array('name' => 'string', 'type' => 'string'));
     $validatorMetadata = new ClassMetadata(TestModel::class);
     $validatorMetadata->addConstraint();
 }
开发者ID:QafooLabs,项目名称:symfony-testing2,代码行数:12,代码来源:FormTest.php

示例7: registerFormMacro

 /**
  * Register the honeypot form macro
  *
  * @param  Illuminate\Html\FormBuilder|null $form
  * @return void
  */
 public function registerFormMacro(FormBuilder $form = null)
 {
     $honeypotMacro = function ($honey_name, $honey_time) {
         $honeypot = new Honeypot();
         return $honeypot->getFormHTML($honey_name, $honey_time);
     };
     // Add a custom honeypot macro to Laravel's form
     if ($form) {
         $form->macro('honeypot', $honeypotMacro);
     } else {
         FormBuilder::macro('honeypot', $honeypotMacro);
     }
 }
开发者ID:dandarie,项目名称:honeypot,代码行数:19,代码来源:HoneypotServiceProvider.php

示例8: generateElementId

 /**
  *
  * @param Symfony\Component\Form\FormBuilder $formBuilder
  * @param string $elementId
  *
  * @return array
  */
 private function generateElementId(FormBuilder $formBuilder, $elementId)
 {
     $nameBase = $formBuilder->getName();
     $elementId = $nameBase . "_" . $elementId;
     foreach (new FormBuilderIterator($formBuilder) as $name => $formBuilder) {
         $nameClean = substr($name, strlen($nameBase) + 1);
         if (strpos($elementId, $name) === 0) {
             if (strlen($name) == strlen($elementId)) {
                 return array($nameClean);
             }
             return array_merge(array($nameClean), $this->generateElementId($formBuilder, substr($elementId, strlen($name) + 1)));
         }
     }
 }
开发者ID:kwuerl,项目名称:SonataAdminBundle,代码行数:21,代码来源:AdminHelper.php

示例9: WPCW_showPage_Settings_load

/**
 * Shows the settings page for the plugin.
 */
function WPCW_showPage_Settings_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Training Courses - Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    // Check for update flag
    if (isset($_POST['update']) && $_POST['update'] == 'tables_force_upgrade') {
        $page->showMessage(__('Upgrading WP Courseware Tables...', 'wp_courseware'));
        flush();
        $installed_ver = get_option(WPCW_DATABASE_KEY) + 0;
        WPCW_database_upgradeTables($installed_ver, true, true);
        $page->showMessage(sprintf(__('%s tables have successfully been upgraded.', 'wp_courseware'), 'WP Courseware'));
    }
    $settingsFields = array('section_access_key' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Licence Key Settings', 'wp_courseware'))), 'licence_key' => array('label' => __('Licence Key', 'wp_courseware'), 'type' => 'text', 'desc' => __('Your licence key for the WP Courseware plugin.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 32, 'minlen' => 32, 'regexp' => '/^[A-Za-z0-9]+$/', 'error' => __('Please enter your 32 character licence key, which contains only letters and numbers.', 'wp_courseware'))), 'license_activation' => array('label' => __('Licence Activation', 'wp_courseware'), 'type' => 'radio', 'required' => 'true', 'data' => array('activate_license' => sprintf('<b>%s</b>', __('Activate', 'wp_courseware')), 'deactivate_license' => sprintf('<b>%s</b>', __('Deactivate', 'wp_courseware'))), 'desc' => __('If you want to receive updates to this plugin, select "Activate". Otherwise, select "Deactivate" to deactivate license. Selecting "Deactivate" will disable any future updates. Deactivating your license allows you to move your plugin to another site.', 'wp_courseware')), 'section_default_css' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Style &amp; Design Settings', 'wp_courseware'))), 'use_default_css' => array('label' => __('Use Default CSS?', 'wp_courseware'), 'type' => 'radio', 'required' => 'true', 'data' => array('show_css' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Use default stylesheet for the frontend of the website.', 'wp_courseware')), 'hide_css' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t use the default stylesheet for the frontend of the website (you\'ll write your own CSS)', 'wp_courseware'))), 'desc' => __('If you want to style your training course material yourself, you can disable the default stylesheet. If in doubt, select <b>Yes</b>.', 'wp_courseware')), 'section_link' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Powered By Link', 'wp_courseware'))), 'show_powered_by' => array('label' => __('Show Powered By Link?', 'wp_courseware'), 'type' => 'radio', 'required' => 'true', 'data' => array('show_link' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Show the <em>\'Powered By WP Courseware\'</em> link.', 'wp_courseware')), 'hide_link' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t show any powered-by links.', 'wp_courseware'))), 'desc' => __("Do you want to show a 'Powered By WP Courseware' link at the bottom of course outlines?", 'wp_courseware')), 'affiliate_id' => array('label' => __('Your Affiliate ID', 'wp_courseware'), 'type' => 'text', 'desc' => __("(Optional) Earn some money by providing your Affiliate ID, which will turn the <b>Powered By WP Courseware</b> into an affiliate link that earns you a percentage of every sale! If you are not an affiliate, login to the member portal to register and get your ID.", 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 15, 'minlen' => 1, 'regexp' => '/^[A-Za-z0-9\\-_]+$/', 'error' => __('Please enter your Affiliate ID, which is only a number..', 'wp_courseware'))));
    // Remove licence key for child multi-sites
    if (!WPCW_plugin_hasAdminRights()) {
        unset($settingsFields['section_access_key']);
        unset($settingsFields['licence_key']);
    }
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_general');
    $settings->setSaveButtonLabel(__('Save ALL Settings', 'wp_courseware'));
    // Update messages for translation
    $settings->msg_settingsSaved = __('Settings successfully saved.', 'wp_courseware');
    $settings->msg_settingsProblem = __('There was a problem saving the settings.', 'wp_courseware');
    $settings->customFormErrorMsg = __('Sorry, but unfortunately there were some errors saving the course details. Please fix the errors and try again.', 'wp_courseware');
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    // Form event handlers - processes the saved settings in some way
    $settings->afterSaveFunction = 'WPCW_showPage_Settings_afterSave';
    $settings->afterSaveFunction = 'edd_activate_license_WPCW';
    $settings->show();
    // Create little form to force upgrading tables if something went wrong during update.
    echo WPCW_forms_createBreakHTML(__("Upgrade Tables", 'wp_courseware'), false, true, 'wpcw_upgrade_tables');
    ?>
	
	<p><?php 
    _e("If you're getting any errors with WP Courseware relating to database tables when you've updated, you can force an upgrade of the database tables using the button below.", 'wp_courseware');
    ?>
</p>
	<?php 
    $form = new FormBuilder('tables_force_upgrade');
    $form->setSubmitLabel(__('Force Table Upgrade', 'wp_courseware'));
    echo $form->toString();
    // RHS Support Information
    $page->showPageMiddle('23%');
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
开发者ID:Juni4567,项目名称:meritscholarship,代码行数:51,代码来源:page_settings.inc.php

示例10: __call

 /**
  * Add a new field to the group
  * @param string $fn
  * @param array $args
  * @return FormField
  */
 function __call($fn, $args)
 {
     $name = $args[0];
     $fullname = $this->name . '[' . $name . ']';
     $this->fields[$name] = \FormBuilder::field($this->form, $fullname, $fn);
     return $this->fields[$name];
 }
开发者ID:plokko,项目名称:FormBuilder,代码行数:13,代码来源:FieldGroup.php

示例11: preforward

 function preforward()
 {
     $this->af->setApp('params', $this->af->getArray(false));
     $this->af->setApp('options', array('いいえ', 'はい'));
     $this->af->setApp('group_options', array('いいえ', 'はい(一行)', 'はい(改行)'));
     $this->af->setApp('custom_options', array('' => 'なし', 'checkHiragana' => 'ふりがな', 'checkKatakana' => 'フリガナ', 'checkMailaddress' => 'メールアドレス ( 例: info@example.com )', 'checkMailaddress_r' => 'メールアドレス ( このアドレスに控えメールを送信します。 )', 'checkRepeat' => '上段のフォーム内容の再入力 ( 確認の為に再度入力して下さい。 )', 'checkURL' => 'URL ( 例: http://www.example.com/ )', 'checkAlphabet' => '英字 ( 英字を入力して下さい。 )', 'checkAlphanum' => '英数字 ( 英数字を入力して下さい。 )', 'checkNumber' => '数字', 'checkInteger' => '正整数', 'checkZipcode' => '郵便番号 ( 例: 000-1111 )', 'checkZipcode_d' => '郵便番号 ( 例: 0001111 (ハイフン不要) )', 'checkPhone' => '固定電話 ( 例: 03-111-2222 )', 'checkPhone_d' => '固定電話 ( 例: 031112222 (ハイフン不要) )', 'checkMbphone' => '携帯電話 ( 例: 090-1111-2222 )', 'checkMbphone_d' => '携帯電話 ( 例: 09011112222 (ハイフン不要) )'));
     if ($this->af->getApp('attr') != null) {
         $params = $this->af->getArray();
         $params['id'] = 'none';
         $values =& $params['values'];
         $values = preg_replace('/\\r\\n?/', "\n", $values);
         $form = FormBuilder::build($params);
         $default = $params['default'];
         $t = $params['type_name'][0];
         // 初期値代入
         if ($t == 't' || $t == 'f') {
             $form = str_replace('<?=$none_v?>', $default, $form);
         } else {
             $selected = $t == 's' ? ' selected="selected"' : ' checked="checked"';
             $value = $t == 'c' ? preg_split('/[、,]/u', $default) : array($default);
             $values = explode("\n", $values);
             foreach ($values as $i => $v) {
                 $v = in_array($v, $value) ? $selected : '';
                 $form = str_replace(sprintf('<?=$none%d_v?>', $i), $v, $form);
             }
         }
         $this->af->setAppNE('form', $form);
     }
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:29,代码来源:FormModify.php

示例12: autoload

 /**
  * Подключаем в начале
  *
  * @param $formBuilder
  */
 static function autoload($formBuilder)
 {
     FormBuilder::jsAdd('jquery');
     FormBuilder::jsAdd('js/vendor/jquery.ui.widget', 'upload');
     FormBuilder::jsAdd('js/jquery.iframe-transport', 'upload');
     FormBuilder::jsAdd('js/jquery.fileupload', 'upload');
 }
开发者ID:nifus,项目名称:formbuilder,代码行数:12,代码来源:UploadExtension.php

示例13: validateSubForm

 public function validateSubForm()
 {
     $class = get_class($this);
     $fb = FormBuilder::load($class);
     $listView = $fb->findAllField(['type' => 'ListView']);
     foreach ($listView as $k => $lv) {
         ## if listview is valid
         if ((@$lv['fieldTemplate'] == "datasource" || @$lv["fieldTemplate"] == "form") && @$lv['templateForm'] != '') {
             if (isset($this->attributes[$lv['name']])) {
                 $items = $this->attributes[$lv['name']];
                 foreach ($items as $k => $item) {
                     Yii::import($lv['templateForm']);
                     $newClass = Helper::explodeLast(".", $lv['templateForm']);
                     $new = new $newClass();
                     $new->attributes = $item;
                     $new->validate();
                     if ($new->hasErrors()) {
                         foreach ($new->errors as $name => $errors) {
                             $this->addError($name, implode("<br> &bull; ", $errors));
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:26,代码来源:Form.php

示例14: autoload

 /**
  * Подключаем в начале
  *
  * @param $formBuilder
  */
 static function autoload($formBuilder)
 {
     FormBuilder::jsAdd('jquery');
     FormBuilder::jsAdd('jquery.mask.min', 'mask');
     $v = \View::make('formbuilder::extends/mask/js')->with('form', $formBuilder->config['id']);
     $formBuilder->setJs($v->render(), $v->getPath());
 }
开发者ID:nifus,项目名称:formbuilder,代码行数:12,代码来源:MaskExtension.php

示例15: render

 /**
  * render
  * Fungsi ini untuk me-render layout
  * @param array $layout
  * @param array $sections
  * @param array $model
  * @param boolean $return
  * @return mixed me-return sebuah layout
  */
 public static function render($layout, $sections = null, $model = null, $return = false)
 {
     $formpath = @$sections['editor'] ? '//layouts/forms_editor/' : "//layouts/forms/";
     if (count($sections) > 0) {
         foreach ($sections as $k => $section) {
             switch (@$section['type']) {
                 case "menu":
                     if (@$section['file'] == "") {
                         continue;
                     }
                     $options = ['title' => @$section['title'], 'icon' => @$section['icon'], 'sections' => $sections, 'options' => @$section['menuOptions'], 'inlineJS' => @$section['inlineJS']];
                     $mt = MenuTree::load($section['file'], $options);
                     if ($mt != null) {
                         $sections[$k]['content'] = $mt->render(false);
                     }
                     break;
                 case "form":
                     if (@$section['class'] == "") {
                         continue;
                     }
                     $fb = FormBuilder::load(@$section['class']);
                     if ($fb != null) {
                         $sections[$k]['content'] = $fb->render($model, ['renderInAjax' => true]);
                     }
                     break;
             }
         }
     }
     return Yii::app()->controller->renderPartial($formpath . $layout, $sections, $return);
 }
开发者ID:reggi49,项目名称:plansys,代码行数:39,代码来源:Layout.php


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