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


PHP HTMLForm类代码示例

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


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

示例1: build_form

 private function build_form($theme_selected)
 {
     $form = new HTMLForm(__CLASS__);
     $theme_choise_fieldset = new FormFieldsetHTML('theme-choice', $this->lang['customization.interface.theme-choice']);
     $form->add_fieldset($theme_choise_fieldset);
     $theme_choise_fieldset->add_field(new FormFieldSimpleSelectChoice('select_theme', $this->lang['customization.interface.select-theme'], $theme_selected, $this->list_themes(), array('events' => array('change' => 'document.location.href = "' . AdminCustomizeUrlBuilder::customize_interface()->rel() . '" + HTMLForms.getField(\'select_theme\').getValue()'))));
     $customize_interface_fieldset = new FormFieldsetHTML('customize_interface', $this->lang['customization.interface']);
     $form->add_fieldset($customize_interface_fieldset);
     $header_logo_path = $this->get_header_logo_path($theme_selected);
     if (!empty($header_logo_path)) {
         $header_logo_file = new File(PATH_TO_ROOT . $header_logo_path);
         if ($header_logo_file->exists()) {
             $picture = '<img src="' . Url::to_rel($header_logo_file->get_path()) . '" alt="' . $this->lang['customization.interface.logo.current'] . '" title="' . $this->lang['customization.interface.logo.current'] . '"/>';
             $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], $picture));
         } else {
             $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], '<span class="text-strong color-alert">' . $this->lang['customization.interface.logo.current.erased'] . '</span>'));
         }
     } else {
         $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], $this->lang['customization.interface.logo.current.null']));
     }
     $customize_interface_fieldset->add_field(new FormFieldFilePicker('header_logo', $this->lang['customization.interface.logo.current.change'], array('description' => $this->lang['customization.interface.logo.current.change-explain'])));
     $customize_interface_fieldset->add_field(new FormFieldCheckbox('use_default_logo', $this->lang['customization.interface.logo.use-default'], FormFieldCheckbox::UNCHECKED));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:27,代码来源:AdminCustomizeInterfaceController.class.php

示例2: renderForm

 public function renderForm()
 {
     $form = new HTMLForm();
     $form->open('addsnippet', '', 'POST');
     $form->setInput('hsname')->setRules('regexp[#[a-z\\-_0-9]{3,15}#i]')->setErrorText('Имя сниппета может содержать след. символы: a-z_-0-9  от 3 до 15 символов')->setAttr('class|form-control input-lg')->setAttr(isset($_POST['hsname']) ? 'value|' . $_POST['hsname'] : '')->addInput();
     $form->setTextarea('hsdescription')->setRules('trim|notempty')->setErrorText('Введите описание снипета')->setAttr('class|desc  form-control')->setText(isset($_POST['hsdescription']) ? $_POST['hsdescription'] : '')->addTextarea();
     $form->setTextarea('hscode')->setRules('trim|notempty')->setErrorText('Введите код снипета')->setAttr('class|preview desc form-control')->setAttr('id|content')->setText(isset($_POST['hscode']) ? $_POST['hscode'] : '')->addTextarea();
     $form->setInput('addsnippet')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
     $formAddSnippet = $form->close();
     Bufer::add(array('formAddSnippet' => $formAddSnippet));
     /**
      * Провервка отправленной формы
      */
     if (!$form->sendForm('addsnippet')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('hsname' => $this->model->escape($data['hsname']), 'hsdescription' => $this->model->escape($data['hsdescription']), 'hscode' => $this->model->escape($data['hscode']));
         $checkHsname = $this->model->checkHsname($data);
         if (!isset($checkHsname['error'])) {
             $this->addSnippet($data);
         } else {
             Bufer::add(array('errors' => $checkHsname['error']));
         }
     }
 }
开发者ID:vasinsky,项目名称:test,代码行数:27,代码来源:addhtmlsnippets.php

示例3: alterForm

 protected function alterForm(HTMLForm $form)
 {
     $form->setWrapperLegendMsg('filerevert-legend');
     $form->setSubmitTextMsg('filerevert-submit');
     $form->addHiddenField('oldimage', $this->getRequest()->getText('oldimage'));
     $form->setTokenSalt(['revert', $this->getTitle()->getPrefixedDBkey()]);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:7,代码来源:RevertAction.php

示例4: spellCheckingForm

 /**
  * Display form for testing spell checking feature
  */
 function spellCheckingForm($languages)
 {
     $fields = array('text' => array('class' => 'HTMLTextField', 'label-message' => 'spellchecker-info-spellcheck-text'), 'lang' => array('class' => 'HTMLSelectField', 'label-message' => 'spellchecker-info-spellcheck-languages', 'options' => array_combine($languages, $languages)));
     $form = new HTMLForm($fields);
     $form->setTitle($this->title);
     $form->setSubmitText($this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-submit'));
     $form->loadData();
     $form->displayForm('');
     // page was POSTed, perform spell cheking
     if ($this->request->wasPosted()) {
         $text = $this->request->getText('wptext');
         $langCode = $this->request->getText('wplang');
         // create spell checking service
         $service = new SpellCheckerService($langCode);
         $info = $service->getInfo();
         // check the spelling (returns true or array of spelling suggestions)
         $data = $service->checkWord($text);
         // print out results
         if ($data === true) {
             $result = $this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-is-correct', $text);
         } else {
             $result = $this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-suggestions', $text, implode(', ', $data));
         }
         $this->out->addHtml("<p>{$result}</p>");
         $this->out->addHtml("<p><small>{$info['desc']} / {$info['lang']}</small></p>");
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:SpellCheckerInfoSpecial.class.php

示例5: build_form

    private function build_form()
    {
        $mail_request = AppContext::get_request()->get_string('mail_newsletter', '');
        if (AppContext::get_current_user()->check_level(User::MEMBER_LEVEL) && empty($mail_request)) {
            $email = AppContext::get_current_user()->get_email();
        } else {
            $email = $mail_request;
        }
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('unsubscribe.newsletter', $this->lang['unsubscribe.newsletter']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldMailEditor('mail', $this->lang['subscribe.mail'], $email, array('required' => true)));
        $fieldset->add_field(new FormFieldCheckbox('delete_all_streams', $this->lang['newsletter.delete_all_streams'], FormFieldCheckbox::UNCHECKED, array('events' => array('click' => '
		if (HTMLForms.getField("delete_all_streams").getValue()) {
			HTMLForms.getField("choice").disable();
		} else { 
			HTMLForms.getField("choice").enable();
		}'))));
        $newsletter_subscribe = AppContext::get_current_user()->check_level(User::MEMBER_LEVEL) ? NewsletterService::get_member_id_streams(AppContext::get_current_user()->get_id()) : array();
        $fieldset->add_field(new FormFieldMultipleCheckbox('choice', $this->lang['unsubscribe.newsletter_choice'], $newsletter_subscribe, $this->get_streams(), array('required' => true)));
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
    }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:25,代码来源:NewsletterUnsubscribeController.class.php

示例6: renderForm

 public function renderForm()
 {
     $form = new HTMLForm();
     $hsid = isset($_GET['hsid']) ? (int) $_GET['hsid'] : 0;
     $data = $this->getDataHtmlSnippet($hsid);
     $form->open('editsnippet', '', 'POST');
     $form->setInput('hsname')->setRules('regexp[#[a-z\\-_0-9]{3,15}#i]')->setErrorText('Имя сниппета может содержать след. символы: a-z_-0-9  от 3 до 15 символов')->setAttr('class|form-control input-lg')->setAttr(isset($data['hsname']) ? 'value|' . $data['hsname'] : '')->addInput();
     $form->setTextarea('hsdescription')->setRules('trim|notempty')->setErrorText('Введите описание снипета')->setAttr('class|desc  form-control')->setText(isset($data['hsdescription']) ? $data['hsdescription'] : '')->addTextarea();
     $form->setTextarea('code')->setRules('trim|notempty')->setErrorText('Введите код снипета')->setAttr('class|preview_desc form-control')->setAttr('id|content')->setText(isset($data['code']) ? $data['code'] : '')->addTextarea();
     $form->setInput('editsnippet')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
     $formEditSnippet = $form->close();
     Bufer::add(array('formEditSnippet' => $formEditSnippet));
     /**
      * Провервка отправленной формы
      */
     if (!$form->sendForm('editsnippet')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('hsid' => $hsid = isset($_GET['hsid']) ? (int) $_GET['hsid'] : 0, 'hsname' => $this->model->escape($data['hsname']), 'hsdescription' => $this->model->escape($data['hsdescription']), 'code' => $this->model->escape($data['code']));
         $checkHsname = $this->model->checkHsname($data);
         if (!isset($checkHsname['error'])) {
             $result = $this->saveSnippet($data);
             if ($result['success'] === false) {
                 Bufer::add(array('errors' => $result['error']));
             } else {
                 Route::go('?mode=admin&route=edithtmlsnippets&hsid=' . $data['hsid']);
             }
         } else {
             Bufer::add(array('errors' => $checkHsname['error']));
         }
     }
 }
开发者ID:vasinsky,项目名称:test,代码行数:34,代码来源:edithtmlsnippets.php

示例7: renderForm

 public function renderForm()
 {
     $model = $this->model;
     $form = new HTMLForm();
     $form->open('addsection', '', 'POST');
     $form->setInput('sname')->setAttr('type|text')->setAttr('onkeyup|document.getElementById(\'child\').value=translit(this.value)')->setAttr(isset($_POST['sname']) ? 'value|' . $_POST['sname'] : '')->setRules('notempty')->setErrorText('Введите наименование раздела')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('sindex')->setAttr('type|text')->setAttr('id|child')->setAttr(isset($_POST['sindex']) ? 'value|' . $_POST['sindex'] : '')->setRules('notempty|regexp[#([a-z]){3,}#i]')->setErrorText('Введите псевдоним раздела (от 3х букв)')->setAttr('class|form-control input-lg')->addInput();
     $form->setTextarea('sdescription')->setAttr('class|form-control')->setRules('notempty')->setText(isset($_POST['sdescription']) ? $_POST['sdescription'] : '')->setErrorText('Введите описание раздела')->addTextarea();
     $form->setInput('createsection')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
     $formAddsection = $form->close();
     Bufer::set(array('formAddsection' => $formAddsection));
     if (!$form->sendForm('createsection')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('sname' => $this->model->escape($data['sname']), 'sdescription' => $this->model->escape($data['sdescription']), 'sindex' => $this->model->escape($data['sindex']));
         $checkIndexSection = $this->model->checkIndexSection($data);
         if (!isset($checkIndexSection['errors'])) {
             $result = $this->addsection($data, $formAddsection);
             if ($result['errors']) {
                 Bufer::add(array('errors' => $result['errors']));
             }
         } else {
             Bufer::add(array('errors' => $checkIndexSection['errors']));
         }
     }
 }
开发者ID:vasinsky,项目名称:fw-test,代码行数:28,代码来源:addsection.php

示例8: build_form

 private function build_form($user_id)
 {
     $form = new HTMLForm('member-view-profile', '', false);
     $fieldset = new FormFieldsetHTML('profile', $this->lang['profile']);
     $form->add_fieldset($fieldset);
     if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) {
         $link_edit = '<a href="' . UserUrlBuilder::edit_profile($user_id)->rel() . '" title="' . $this->lang['profile.edit'] . '" class="fa fa-edit"></a>';
         $fieldset->add_field(new FormFieldFree('profile_edit', $this->lang['profile.edit'], $link_edit));
     }
     $fieldset->add_field(new FormFieldFree('display_name', $this->lang['display_name'], $this->user_infos['display_name']));
     $fieldset->add_field(new FormFieldFree('level', $this->lang['level'], '<a class="' . UserService::get_level_class($this->user_infos['level']) . '">' . $this->get_level_lang() . '</a>'));
     $fieldset->add_field(new FormFieldFree('groups', $this->lang['groups'], $this->build_groups($this->user_infos['groups'])));
     $registration_date = new Date($this->user_infos['registration_date']);
     $fieldset->add_field(new FormFieldFree('registered_on', $this->lang['registration_date'], $registration_date ? $registration_date->format(Date::FORMAT_DAY_MONTH_YEAR) : ''));
     $fieldset->add_field(new FormFieldFree('nbr_msg', $this->lang['number-messages'], $this->user_infos['posted_msg'] . '<br>' . '<a href="' . UserUrlBuilder::messages($user_id)->rel() . '">' . $this->lang['messages'] . '</a>'));
     $last_connection_date = !empty($this->user_infos['last_connection_date']) ? Date::to_format($this->user_infos['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main');
     $fieldset->add_field(new FormFieldFree('last_connect', $this->lang['last_connection'], $last_connection_date));
     if (AppContext::get_current_user()->check_auth(UserAccountsConfig::load()->get_auth_read_members(), UserAccountsConfig::AUTH_READ_MEMBERS_BIT) && $this->user_infos['show_email']) {
         $link_email = '<a href="mailto:' . $this->user_infos['email'] . '" class="basic-button smaller">Mail</a>';
         $fieldset->add_field(new FormFieldFree('email', $this->lang['email'], $link_email));
     }
     if (!$this->same_user_view_profile($user_id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
         $link_mp = '<a href="' . UserUrlBuilder::personnal_message($user_id)->rel() . '" class="basic-button smaller">MP</a>';
         $fieldset->add_field(new FormFieldFree('private_message', $this->lang['private_message'], $link_mp));
     }
     MemberExtendedFieldsService::display_profile_fields($form, $user_id);
     $this->form = $form;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:28,代码来源:UserViewProfileController.class.php

示例9: getForm

 /**
  * Get the HTMLForm to control behavior
  * @return HTMLForm|null
  */
 protected function getForm()
 {
     $this->fields = $this->getFormFields();
     $form = new HTMLForm($this->fields, $this->getContext(), $this->getMessagePrefix());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     // If the form is a compact vertical form, then don't output this ugly
     // fieldset surrounding it.
     // XXX Special pages can setDisplayFormat to 'vform' in alterForm(), but that
     // is called after this.
     if (!$form->isVForm()) {
         $form->setWrapperLegendMsg($this->getMessagePrefix() . '-legend');
     }
     $headerMsg = $this->msg($this->getMessagePrefix() . '-text');
     if (!$headerMsg->isDisabled()) {
         $form->addHeaderText($headerMsg->parseAsBlock());
     }
     // Retain query parameters (uselang etc)
     $params = array_diff_key($this->getRequest()->getQueryValues(), array('title' => null));
     $form->addHiddenField('redirectparams', wfArrayToCgi($params));
     $form->addPreText($this->preText());
     $form->addPostText($this->postText());
     $this->alterForm($form);
     // Give hooks a chance to alter the form, adding extra fields or text etc
     wfRunHooks('SpecialPageBeforeFormDisplay', array($this->getName(), &$form));
     return $form;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:30,代码来源:FormSpecialPage.php

示例10: listDomains

 /**
  * @return void
  */
 function listDomains()
 {
     $this->setHeaders();
     $this->getOutput()->setPagetitle($this->msg('openstackmanager-domainlist'));
     $this->getOutput()->addModuleStyles('ext.openstack');
     $domainInfo = array();
     $domainInfo['domainname'] = array('type' => 'text', 'label-message' => 'openstackmanager-domainname', 'default' => '', 'section' => 'domain', 'name' => 'domainname');
     $domainInfo['fqdn'] = array('type' => 'text', 'label-message' => 'openstackmanager-fqdn', 'default' => '', 'section' => 'domain', 'name' => 'fqdn');
     $domainInfo['location'] = array('type' => 'text', 'label-message' => 'openstackmanager-location', 'default' => '', 'section' => 'domain', 'help-message' => 'openstackmanager-location-help', 'name' => 'location');
     $domainInfo['action'] = array('type' => 'hidden', 'default' => 'create', 'name' => 'action');
     $domainForm = new HTMLForm($domainInfo, $this->getContext(), 'openstackmanager-novadomain');
     $domainForm->setSubmitID('novadomain-form-createdomainsubmit');
     $domainForm->setSubmitCallback(array($this, 'tryCreateSubmit'));
     $domainForm->show();
     $headers = array('openstackmanager-domainname', 'openstackmanager-fqdn', 'openstackmanager-location', 'openstackmanager-actions');
     $domains = OpenStackNovaDomain::getAllDomains();
     $domainRows = array();
     foreach ($domains as $domain) {
         $domainRow = array();
         $domainName = $domain->getDomainName();
         $this->pushResourceColumn($domainRow, $domainName);
         $this->pushResourceColumn($domainRow, $domain->getFullyQualifiedDomainName());
         $this->pushResourceColumn($domainRow, $domain->getLocation());
         $this->pushRawResourceColumn($domainRow, $this->createActionLink('openstackmanager-delete', array('action' => 'delete', 'domainname' => $domainName)));
         $domainRows[] = $domainRow;
     }
     if ($domainRows) {
         $out = $this->createResourceTable($headers, $domainRows);
     } else {
         $out = '';
     }
     $this->getOutput()->addHTML($out);
 }
开发者ID:valhallasw,项目名称:mediawiki-extensions-OpenStackManager,代码行数:36,代码来源:SpecialNovaDomain.php

示例11: display_profile_fields

 /**
  * @desc This function displayed fields profile
  * @param object $member_extended_field MemberExtendedField containing user_id, Template and field_type.
  */
 public static function display_profile_fields(HTMLForm $form, $user_id)
 {
     $extended_fields_displayed = PersistenceContext::get_querier()->row_exists(DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST, 'WHERE display=1');
     if ($extended_fields_displayed) {
         $fieldset = new FormFieldsetHTML('other', LangLoader::get_message('other', 'main'));
         $nbr_field = 0;
         $result = PersistenceContext::get_querier()->select("SELECT exc.name, exc.description, exc.field_type, exc.required, exc.field_name, exc.possible_values, exc.default_value, exc.auth, exc.regex, ex.*\r\n\t\t\tFROM " . DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST . " exc\r\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER_EXTENDED_FIELDS . " ex ON ex.user_id = :user_id\r\n\t\t\tWHERE exc.display = 1\r\n\t\t\tORDER BY exc.position", array('user_id' => $user_id));
         while ($extended_field = $result->fetch()) {
             if (AppContext::get_current_user()->check_auth(unserialize($extended_field['auth']), ExtendedField::READ_PROFILE_AUTHORIZATION)) {
                 $value = !empty($extended_field[$extended_field['field_name']]) ? $extended_field[$extended_field['field_name']] : $extended_field['default_value'];
                 $extended_field['value'] = $value;
                 $member_extended_field = new MemberExtendedField();
                 $member_extended_field->set_user_id($user_id);
                 $member_extended_field->set_fieldset($fieldset);
                 $member_extended_field->set_properties($extended_field);
                 $member_extended_field->get_instance()->display_field_profile($member_extended_field);
                 $nbr_field++;
             }
         }
         if ($nbr_field > 0) {
             $form->add_fieldset($fieldset);
         }
         $result->dispose();
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:29,代码来源:MemberExtendedFieldsService.class.php

示例12: build_form

 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('search_member', LangLoader::get_message('search_member', 'main'));
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldAjaxSearchUserAutoComplete('member', $this->lang['display_name'], ''));
     return $form;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:8,代码来源:AdminViewAllMembersController.class.php

示例13: getPopupEinstellungen

 public function getPopupEinstellungen()
 {
     $F = new HTMLForm("allgemeineWerte", array("OWMApiKey"));
     $F->getTable()->setColWidth(1, 120);
     $F->setValue("OWMApiKey", mUserdata::getGlobalSettingValue("OWMApiKey", ""));
     $F->setSaveRMEPCR("Speichern", "", "mOpenWeatherMap", "-1", "saveEinstellungen", OnEvent::closePopup("mOpenWeatherMap"));
     echo $F;
 }
开发者ID:nemiah,项目名称:fheME,代码行数:8,代码来源:mOpenWeatherMapGUI.class.php

示例14: get_data

 public function get_data(HTMLForm $form, MemberExtendedField $member_extended_field)
 {
     $field_name = $member_extended_field->get_field_name();
     if ($form->has_field($field_name)) {
         return $form->get_value($field_name)->format(Date::FORMAT_TIMESTAMP);
     }
     return '';
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:8,代码来源:MemberDateExtendedField.class.php

示例15: buildForm

 function buildForm()
 {
     $form = new HTMLForm($this->getFormFields(), $this->getContext(), 'lqt-' . $this->getPageName());
     $par = $this->mThread->title()->getPrefixedText();
     $form->setSubmitText($this->getSubmitText());
     $form->setSubmitCallback(array($this, 'trySubmit'));
     return $form;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:8,代码来源:ThreadActionPage.php


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