本文整理汇总了PHP中HTMLForm::add_button方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::add_button方法的具体用法?PHP HTMLForm::add_button怎么用?PHP HTMLForm::add_button使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::add_button方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_form
private function build_form()
{
$this->form = new HTMLForm('smtp_config');
$fieldset = new FormFieldsetHTML('mail_properties', $this->lang['mail.title']);
$this->form->add_fieldset($fieldset);
$sender_mail = new FormFieldMailEditor('sender_mail', $this->lang['mail.sender_mail'], '');
$fieldset->add_field($sender_mail);
$fieldset->add_field(new FormFieldTextEditor('sender_name', $this->lang['mail.sender_name'], '', array(), array(new FormFieldConstraintNotEmpty())));
$recipient_mail = new FormFieldMailEditor('recipient_mail', $this->lang['mail.recipient_mail'], '');
$fieldset->add_field($recipient_mail);
$fieldset->add_field(new FormFieldTextEditor('recipient_name', $this->lang['mail.recipient_name'], '', array(), array(new FormFieldConstraintNotEmpty())));
$fieldset->add_field(new FormFieldTextEditor('mail_subject', $this->lang['mail.subject'], '', array(), array(new FormFieldConstraintNotEmpty())));
$fieldset->add_field(new FormFieldMultiLineTextEditor('mail_content', $this->lang['mail.content'], ''));
$fieldset = new FormFieldsetHTML('send_configuration', $this->lang['mail.smtp_config'], array('description' => $this->lang['mail.smtp_config.explain']));
$this->form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldCheckbox('use_smtp', $this->lang['mail.use_smtp'], false, array('events' => array('click' => 'if ($FF("use_smtp").getValue()) { $FFS("smtp_configuration").enable(); } else { $FFS("smtp_configuration").disable(); }'))));
$fieldset = new FormFieldsetHTML('smtp_configuration', $this->lang['mail.smtp_configuration'], array('disabled' => true));
$this->form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldTextEditor('smtp_host', $this->lang['mail.smtp.host'], '', array('disabled' => true), array(new FormFieldConstraintRegex('`^[a-z0-9-]+(?:\\.[a-z0-9-]+)*$`i'))));
$fieldset->add_field(new FormFieldTextEditor('smtp_port', $this->lang['mail.smtp.port'], 25, array('disabled' => true), array(new FormFieldConstraintIntegerRange(0, 65535))));
$fieldset->add_field(new FormFieldTextEditor('smtp_login', $this->lang['mail.smtp.login'], '', array('disabled' => true), array(new FormFieldConstraintNotEmpty())));
$fieldset->add_field(new FormFieldPasswordEditor('smtp_password', $this->lang['mail.smtp.password'], '', array('disabled' => true)));
$select_option = new FormFieldSelectChoiceOption($this->lang['mail.smtp.secure_protocol.none'], 'none');
$fieldset->add_field(new FormFieldSimpleSelectChoice('secure_protocol', $this->lang['mail.smtp.secure_protocol'], $select_option, array($select_option, new FormFieldSelectChoiceOption($this->lang['mail.smtp.secure_protocol.tls'], 'tls'), new FormFieldSelectChoiceOption($this->lang['mail.smtp.secure_protocol.ssl'], 'ssl')), array('disabled' => true)));
$this->submit_button = new FormButtonDefaultSubmit();
$this->form->add_button($this->submit_button);
$this->form->add_constraint(new FormConstraintFieldsInequality($recipient_mail, $sender_mail));
}
示例2: build_form
public function build_form()
{
$form = new HTMLForm(__CLASS__);
// Fieldset to configure path
$fieldsetPath = new FormFieldsetHTML('wpimport-path', $this->lang['wpimport.fieldset-path']);
$form->add_fieldset($fieldsetPath);
$fieldsetPath->add_field(new FormFieldTextEditor('phpboostpath', $this->lang['wpimport.phpboostpath'], realpath(__DIR__ . '/../../')));
$fieldsetPath->add_field(new FormFieldTextEditor('wppath', $this->lang['wpimport.wppath'], realpath(__DIR__ . '/../../../'), array(), array(new FormFieldConstraintWordPressPath($this->lang['constraint.wp-path']))));
// Fieldset to configure which data are import
$fieldsetImporter = new FormFieldsetHTML('wpimport-importer', $this->lang['wpimport.fieldset-importer']);
$form->add_fieldset($fieldsetImporter);
$importers = $this->listImporters();
foreach ($importers as $importer) {
$fieldsetImporter->add_field(new FormFieldCheckbox('importer_' . $importer['name'], $importer['name'], FormFieldCheckbox::UNCHECKED, array('description' => $this->lang['wpimport.description'] . ': ' . utf8_decode($importer['description']) . '<br />' . $this->lang['wpimport.version'] . ': ' . $importer['version'])));
}
// Fieldset to confgure options
$fieldsetOptions = new FormFieldsetHTML('wpimport-options', $this->lang['wpimport.fieldset-options']);
$form->add_fieldset($fieldsetOptions);
// Default Author
$fieldsetOptions->add_field(new FormFieldAjaxUserAutoComplete('default_author', $this->lang['wpimport.default_author'], AppContext::get_current_user()->get_login(), array('description' => $this->lang['wpimport.default_author.decription']), array(new FormFieldConstraintUserExist($this->lang['wpimport.default_author.error_user_exist']))));
// Default Image
$fieldsetOptions->add_field(new FormFieldUploadFile('default_cat_image', $this->lang['wpimport.default_cat_image'], $this->getDefaultConfiguration()['PHPBOOST_CAT_IMAGE'], array('description' => $this->lang['wpimport.default_cat_image.description'])));
$fieldsetOptions->add_field(new FormFieldTextEditor('import_location', $this->lang['wpimport.import_location'], $this->getDefaultConfiguration()['FILESYSTEM_IMPORT_LOCATION'], array('description' => $this->lang['wpimport.import_location.description'])));
$this->submit_button = new FormButtonSubmit($this->lang['wpimport.submit_configuration'], 'submit_configuration');
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset($this->lang['wpimport.reset']));
$this->form = $form;
}
示例3: 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;
}
示例4: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__);
$fieldset = new FormFieldsetHTML('config', $this->lang['config.title']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new QuestionCaptchaFormFieldQuestions('questions', $this->lang['form.questions'], $this->config->get_questions(), array('description' => $this->lang['form.questions.explain'])));
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例5: build_form
private function build_form()
{
$this->form = new HTMLForm('sitemap_global_config', SitemapUrlBuilder::get_general_config()->rel());
$fieldset = new FormFieldsetHTML('general_config', $this->lang['general_config']);
$this->form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldCheckbox('enable_sitemap_xml', $this->lang['auto_generate_xml_file'], SitemapXMLFileService::is_xml_file_generation_enabled() ? FormFieldCheckbox::CHECKED : FormFieldCheckbox::UNCHECKED, array('events' => array('click' => 'if ($FF("enable_sitemap_xml").getValue()) { $FF("file_life_time").enable(); } else { $FF("file_life_time").disable(); }'))));
$fieldset->add_field(new FormFieldNumberEditor('file_life_time', $this->lang['xml_file_life_time'], SitemapXMLFileService::get_life_time(), array('required' => true, 'min' => 0, 'description' => $this->lang['xml_file_life_time_explain'], 'hidden' => !SitemapXMLFileService::is_xml_file_generation_enabled()), array(new FormFieldConstraintIntegerRange(1, 50))));
$this->submit_button = new FormButtonDefaultSubmit();
$this->form->add_button($this->submit_button);
$this->form->add_button(new FormButtonReset());
}
示例6: create_form
protected function create_form()
{
$form = new HTMLForm('comments', REWRITED_SCRIPT . '#comments-list');
$fieldset = new FormFieldsetHTML('edit_comment', $this->comments_lang['comment.edit']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldRichTextEditor('message', $this->lang['message'], $this->get_contents(), array('formatter' => $this->get_formatter(), 'rows' => 10, 'cols' => 47, 'required' => $this->lang['require_text']), array(new FormFieldConstraintMaxLinks($this->comments_configuration->get_max_links_comment()))));
$form->add_button($submit_button = new FormButtonDefaultSubmit());
$form->add_button(new FormButtonReset());
$this->set_form($form);
$this->set_submit_button($submit_button);
return $form;
}
示例7: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__);
$fieldset = new FormFieldsetHTML('config', $this->lang['config.title']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldFree('explain', '', $this->lang['config.recaptcha-explain']));
$fieldset->add_field(new FormFieldTextEditor('site_key', $this->lang['config.site_key'], $this->config->get_site_key(), array('required' => true), array(new FormFieldConstraintLengthMin(30))));
$fieldset->add_field(new FormFieldPasswordEditor('secret_key', $this->lang['config.secret_key'], $this->config->get_secret_key(), array('required' => true), array(new FormFieldConstraintLengthMin(30))));
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例8: build_form
private function build_form($id)
{
$form = new HTMLForm(__CLASS__);
$columns = array('*');
$condition = "WHERE id = '" . $id . "' AND user_id = -1";
$row = PersistenceContext::get_querier()->select_single_row(NewsletterSetup::$newsletter_table_subscribers, $columns, $condition);
$fieldset = new FormFieldsetHTML('edit-subscriber', $this->lang['subscriber.edit']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldMailEditor('mail', $this->lang['subscribe.mail'], $row['mail'], array('required' => true)));
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例9: create_form
protected function create_form()
{
$form = new HTMLForm('comments', TextHelper::htmlentities($this->comments_topic->get_url()) . '#comments-list');
$fieldset = new FormFieldsetHTML('add_comment', $this->comments_lang['comment.add']);
$form->add_fieldset($fieldset);
if (!$this->user->check_level(User::MEMBER_LEVEL)) {
$fieldset->add_field(new FormFieldTextEditor('name', $this->common_lang['form.name'], LangLoader::get_message('visitor', 'user-common'), array('maxlength' => 25)));
}
$fieldset->add_field(new FormFieldRichTextEditor('message', $this->lang['message'], '', array('formatter' => $this->get_formatter(), 'rows' => 10, 'cols' => 47, 'required' => $this->lang['require_text']), array(new FormFieldConstraintMaxLinks($this->comments_configuration->get_max_links_comment(), true), new FormFieldConstraintAntiFlood(CommentsManager::get_last_comment_added($this->user->get_id())))));
$form->add_button($submit_button = new FormButtonDefaultSubmit());
$form->add_button(new FormButtonReset());
$this->set_form($form);
$this->set_submit_button($submit_button);
return $form;
}
示例10: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__);
$fieldset = new FormFieldsetHTML('language-config', $this->lang['content.config.language']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldEditors('formatting_language', $this->lang['content.config.default-formatting-language'], $this->content_formatting_config->get_default_editor(), array('description' => $this->lang['content.config.default-formatting-language-explain'])));
$fieldset->add_field(new FormFieldMultipleSelectChoice('forbidden_tags', $this->lang['comments.config.forbidden-tags'], $this->content_formatting_config->get_forbidden_tags(), $this->generate_forbidden_tags_option(), array('size' => 10)));
$fieldset = new FormFieldsetHTML('html-language-config', $this->lang['content.config.html-language']);
$form->add_fieldset($fieldset);
$auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['content.config.html-language-use-authorization'], self::HTML_USAGE_AUTHORIZATIONS, $this->lang['content.config.html-language-use-authorization-explain'])));
$auth_settings->build_from_auth_array($this->content_formatting_config->get_html_tag_auth());
$auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
$fieldset->add_field($auth_setter);
$fieldset = new FormFieldsetHTML('post-management', $this->lang['content.config.post-management']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldNumberEditor('max_pm_number', $this->lang['content.config.max-pm-number'], $this->user_accounts_config->get_max_private_messages_number(), array('required' => true, 'description' => $this->lang['content.config.max-pm-number-explain']), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common')))));
$fieldset->add_field(new FormFieldCheckbox('anti_flood_enabled', $this->lang['content.config.anti-flood-enabled'], $this->content_management_config->is_anti_flood_enabled(), array('description' => $this->lang['content.config.anti-flood-enabled-explain'])));
$fieldset->add_field(new FormFieldNumberEditor('delay_flood', $this->lang['content.config.delay-flood'], $this->content_management_config->get_anti_flood_duration(), array('required' => true, 'description' => $this->lang['content.config.delay-flood-explain']), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common')))));
$fieldset = new FormFieldsetHTML('captcha', $this->lang['content.config.captcha']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldSimpleSelectChoice('captcha_used', $this->lang['content.config.captcha-used'], $this->content_management_config->get_used_captcha_module(), $this->generate_captcha_available_option(), array('description' => $this->lang['content.config.captcha-used-explain'])));
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例11: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__);
$fieldset = new FormFieldsetHTML('config', $this->admin_common_lang['configuration']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldCheckbox('database_tables_optimization_enabled', $this->lang['config.database-tables-optimization-enabled'], $this->config->is_database_tables_optimization_enabled(), array('events' => array('change' => '
if (HTMLForms.getField("database_tables_optimization_enabled").getValue()) {
HTMLForms.getField("database_tables_optimization_day").enable();
} else {
HTMLForms.getField("database_tables_optimization_day").disable();
}'))));
$date_lang = LangLoader::get('date-common');
$fieldset->add_field(new FormFieldSimpleSelectChoice('database_tables_optimization_day', $this->lang['config.database-tables-optimization-day'], $this->config->get_database_tables_optimization_day(), array(new FormFieldSelectChoiceOption($date_lang['sunday'], 0), new FormFieldSelectChoiceOption($date_lang['monday'], 1), new FormFieldSelectChoiceOption($date_lang['tuesday'], 2), new FormFieldSelectChoiceOption($date_lang['wednesday'], 3), new FormFieldSelectChoiceOption($date_lang['thursday'], 4), new FormFieldSelectChoiceOption($date_lang['friday'], 5), new FormFieldSelectChoiceOption($date_lang['saturday'], 6), new FormFieldSelectChoiceOption($date_lang['every_month'], 7)), array('description' => $this->lang['config.database-tables-optimization-day.explain'], 'hidden' => !$this->config->is_database_tables_optimization_enabled())));
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例12: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__, AdminErrorsUrlBuilder::clear_logged_errors()->rel(), false);
$fieldset = new FormFieldsetHTML('clear_errors', $this->lang['clear_list']);
$form->add_fieldset($fieldset);
$submit_button = new FormButtonSubmit($this->lang['clear_list'], 'clear', '', 'submit', $this->lang['logged_errors_clear_confirmation']);
$form->add_button($submit_button);
return $form;
}
示例13: build_form
private function build_form()
{
//Creation of a new form
$form = new HTMLForm(__CLASS__);
//Add a fieldset
$fieldset_authorizations = new FormFieldsetHTML('authorizations', LangLoader::get_message('authorizations', 'common'));
$form->add_fieldset($fieldset_authorizations);
//Authorizations list
$auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['config.auth.read'], BugtrackerAuthorizationsService::READ_AUTHORIZATIONS), new ActionAuthorization($this->lang['config.auth.create'], BugtrackerAuthorizationsService::WRITE_AUTHORIZATIONS), new ActionAuthorization($this->lang['config.auth.create_advanced'], BugtrackerAuthorizationsService::ADVANCED_WRITE_AUTHORIZATIONS, $this->lang['config.auth.create_advanced_explain']), new ActionAuthorization($this->lang['config.auth.moderate'], BugtrackerAuthorizationsService::MODERATION_AUTHORIZATIONS)));
//Load the authorizations in the configuration
$auth_settings->build_from_auth_array(BugtrackerConfig::load()->get_authorizations());
$fieldset_authorizations->add_field(new FormFieldAuthorizationsSetter('authorizations', $auth_settings));
//Submit and reset buttons
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例14: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__);
$newsletter_config = NewsletterConfig::load();
$fieldset_config = new FormFieldsetHTML('configuration', LangLoader::get_message('configuration', 'admin'));
$form->add_fieldset($fieldset_config);
$fieldset_config->add_field(new FormFieldMailEditor('mail_sender', $this->lang['admin.mail-sender'], $newsletter_config->get_mail_sender(), array('description' => $this->lang['admin.mail-sender-explain'], 'required' => true)));
$fieldset_config->add_field(new FormFieldTextEditor('newsletter_name', $this->lang['admin.newsletter-name'], $newsletter_config->get_newsletter_name(), array('maxlength' => 255, 'description' => $this->lang['admin.newsletter-name-explain'], 'required' => true)));
$fieldset_authorizations = new FormFieldsetHTML('authorizations', $this->lang['admin.newsletter-authorizations']);
$form->add_fieldset($fieldset_authorizations);
$auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['auth.read'], NewsletterAuthorizationsService::AUTH_READ), new ActionAuthorization($this->lang['auth.subscribe'], NewsletterAuthorizationsService::AUTH_SUBSCRIBE), new ActionAuthorization($this->lang['auth.subscribers-read'], NewsletterAuthorizationsService::AUTH_READ_SUBSCRIBERS), new ActionAuthorization($this->lang['auth.subscribers-moderation'], NewsletterAuthorizationsService::AUTH_MODERATION_SUBSCRIBERS), new ActionAuthorization($this->lang['auth.create-newsletter'], NewsletterAuthorizationsService::AUTH_CREATE_NEWSLETTERS), new ActionAuthorization($this->lang['auth.archives-read'], NewsletterAuthorizationsService::AUTH_READ_ARCHIVES), new ActionAuthorization($this->lang['auth.archives-moderation'], NewsletterAuthorizationsService::AUTH_MODERATION_ARCHIVES)));
$auth_settings->build_from_auth_array($newsletter_config->get_authorizations());
$auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
$fieldset_authorizations->add_field($auth_setter);
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$form->add_button(new FormButtonReset());
$this->form = $form;
}
示例15: build_form
private function build_form()
{
$form = new HTMLForm(__CLASS__);
$fieldset = new FormFieldsetHTML('fieldset', $this->lang['forget-password']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldMailEditor('email', $this->lang['email'], '', array('required' => true)));
$this->submit_button = new FormButtonDefaultSubmit();
$form->add_button($this->submit_button);
$this->form = $form;
}