private function build_form()
    {
        $security_config = SecurityConfig::load();
        $this->form = new HTMLForm('adminForm', '', false);
        $fieldset = new FormFieldsetHTML('adminAccount', $this->lang['admin.account']);
        $this->form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldTextEditor('display_name', LangLoader::get_message('display_name', 'user-common'), '', array('maxlength' => 100, 'required' => true, 'events' => array('blur' => '
				if (!HTMLForms.getField("login").getValue() && HTMLForms.getField("display_name").validate() == "") {
					HTMLForms.getField("login").setValue(HTMLForms.getField("display_name").getValue().replace(/\\s/g, \'\'));
					HTMLForms.getField("login").enableValidationMessage();
					HTMLForms.getField("login").liveValidate();
				}')), array(new FormFieldConstraintLengthRange(3, 100, $this->lang['admin.login.length']))));
        $fieldset->add_field(new FormFieldMailEditor('email', $this->lang['admin.email'], '', array('required' => true)));
        $fieldset->add_field(new FormFieldCheckbox('custom_login', LangLoader::get_message('login.custom', 'user-common'), false, array('description' => LangLoader::get_message('login.custom.explain', 'user-common'), 'events' => array('click' => '
				if (HTMLForms.getField("custom_login").getValue()) {
					HTMLForms.getField("login").enable();
				} else {
					HTMLForms.getField("login").disable();
				}'))));
        $fieldset->add_field(new FormFieldTextEditor('login', LangLoader::get_message('login', 'user-common'), '', array('required' => true, 'hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists())));
        $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['admin.password'], '', array('description' => StringVars::replace_vars($this->lang['admin.password.explanation'], array('number' => $security_config->get_internal_password_min_length())), 'required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length(), StringVars::replace_vars($this->lang['admin.password.length'], array('number' => $security_config->get_internal_password_min_length()))), new FormFieldConstraintPasswordStrength())));
        $fieldset->add_field($repeatPassword = new FormFieldPasswordEditor('repeatPassword', $this->lang['admin.password.repeat'], '', array('required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength())));
        $this->form->add_constraint(new FormConstraintFieldsEquality($password, $repeatPassword));
        $fieldset->add_field(new FormFieldCheckbox('createSession', $this->lang['admin.connectAfterInstall'], true));
        $fieldset->add_field(new FormFieldCheckbox('autoconnect', $this->lang['admin.autoconnect'], true));
        $action_fieldset = new FormFieldsetSubmit('actions');
        $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::website(), 'fa fa-arrow-left');
        $action_fieldset->add_element($back);
        $this->submit_button = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'admin');
        $action_fieldset->add_element($this->submit_button);
        $this->form->add_fieldset($action_fieldset);
    }
 private function add_navigation(Template $view)
 {
     $form = new HTMLForm('preambleForm', InstallUrlBuilder::license()->rel(), false);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $next = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'welcome');
     $action_fieldset->add_element($next);
     $form->add_fieldset($action_fieldset);
     $view->put('LICENSE_FORM', $form->display());
 }
 private function add_navigation(Template $view)
 {
     $form = new HTMLForm('preambleForm', UpdateUrlBuilder::server_configuration()->rel(), false);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $next = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'introduction');
     $action_fieldset->add_element($next);
     $form->add_fieldset($action_fieldset);
     $view->put_all(array('C_PUT_UNDER_MAINTENANCE' => !MaintenanceConfig::load()->is_under_maintenance(), 'SERVER_FORM' => $form->display()));
 }
 private function add_navigation(Template $view)
 {
     $form = new HTMLForm('continueForm', '#error', false);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $back = new FormButtonLinkCssImg($this->lang['step.previous'], UpdateServices::database_config_file_checked() ? UpdateUrlBuilder::server_configuration() : UpdateUrlBuilder::database(), 'fa fa-arrow-left');
     $action_fieldset->add_element($back);
     $this->submit = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'finish');
     $action_fieldset->add_element($this->submit);
     $form->add_fieldset($action_fieldset);
     $view->put('SERVER_FORM', $form->display());
 }
 private function build_form()
 {
     $this->form = new HTMLForm('continueForm', '', false);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $back = new FormButtonLinkCssImg($this->lang['step.previous'], UpdateUrlBuilder::introduction(), 'fa fa-arrow-left');
     $action_fieldset->add_element($back);
     $refresh = new FormButtonLinkCssImg($this->lang['folders.chmod.refresh'], UpdateUrlBuilder::server_configuration()->rel(), 'fa fa-refresh');
     $action_fieldset->add_element($refresh);
     $this->submit = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'server');
     $action_fieldset->add_element($this->submit);
     $this->form->add_fieldset($action_fieldset);
 }
 private function build_form()
 {
     $this->form = new HTMLForm('licenseForm', '', false);
     $fieldset = new FormFieldsetHTML('agreementFieldset', $this->lang['step.license.terms.title']);
     $this->form->add_fieldset($fieldset);
     $agreement = new FormFieldHTML('agreementExplanation', $this->lang['step.license.require.agreement'] . '<br /><br />');
     $fieldset->add_field($agreement);
     $license_content = file_get_contents('gpl-license.txt');
     $license_block = '<div class="licence-container"><div class="license-content">' . $license_content . '</div></div>';
     $license = new FormFieldHTML('licenseContent', $license_block);
     $fieldset->add_field($license);
     $agree_checkbox = new FormFieldCheckbox('agree', $this->lang['step.license.please_agree'], FormFieldCheckbox::UNCHECKED, array('required' => $this->lang['step.license.submit.alert']));
     $fieldset->add_field($agree_checkbox);
     $action_fieldset = new FormFieldsetSubmit('actions');
     $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::welcome(), 'fa fa-arrow-left');
     $action_fieldset->add_element($back);
     $this->submit = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'license');
     $action_fieldset->add_element($this->submit);
     $this->form->add_fieldset($action_fieldset);
 }
    private function build_form()
    {
        $admin_user_lang = LangLoader::get('admin-user-common');
        $this->form = new HTMLForm('websiteForm', '', false);
        $fieldset = new FormFieldsetHTML('yourSite', $this->lang['website.yours']);
        $this->form->add_fieldset($fieldset);
        $host = new FormFieldUrlEditor('host', $this->lang['website.host'], $this->current_server_host(), array('description' => $this->lang['website.host.explanation'], 'required' => $this->lang['website.host.required']));
        $host->add_event('change', $this->warning_if_not_equals($host, $this->lang['website.host.warning']));
        $fieldset->add_field($host);
        $path = new FormFieldTextEditor('path', $this->lang['website.path'], $this->current_server_path(), array('description' => $this->lang['website.path.explanation']));
        $path->add_event('change', $this->warning_if_not_equals($path, $this->lang['website.path.warning']));
        $fieldset->add_field($path);
        $fieldset->add_field(new FormFieldTextEditor('name', $this->lang['website.name'], '', array('required' => $this->lang['website.name.required'])));
        $fieldset->add_field(new FormFieldTextEditor('slogan', $this->lang['website.slogan'], ''));
        $fieldset->add_field(new FormFieldMultiLineTextEditor('description', $this->lang['website.description'], '', array('description' => $this->lang['website.description.explanation'])));
        $fieldset->add_field(new FormFieldTimezone('timezone', $this->lang['website.timezone'], 'Europe/Paris', array('description' => $this->lang['website.timezone.explanation'])));
        $fieldset = new FormFieldsetHTML('security_config', $admin_user_lang['members.config-security']);
        $this->form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldNumberEditor('internal_password_min_length', $admin_user_lang['security.config.internal-password-min-length'], $this->security_config->get_internal_password_min_length(), array('min' => 6, 'max' => 30), array(new FormFieldConstraintRegex('`^[0-9]+$`i'), new FormFieldConstraintIntegerRange(6, 30))));
        $fieldset->add_field(new FormFieldSimpleSelectChoice('internal_password_strength', $admin_user_lang['security.config.internal-password-strength'], $this->security_config->get_internal_password_strength(), array(new FormFieldSelectChoiceOption($admin_user_lang['security.config.internal-password-strength.weak'], SecurityConfig::PASSWORD_STRENGTH_WEAK), new FormFieldSelectChoiceOption($admin_user_lang['security.config.internal-password-strength.medium'], SecurityConfig::PASSWORD_STRENGTH_MEDIUM), new FormFieldSelectChoiceOption($admin_user_lang['security.config.internal-password-strength.strong'], SecurityConfig::PASSWORD_STRENGTH_STRONG))));
        $fieldset->add_field(new FormFieldCheckbox('login_and_email_forbidden_in_password', $admin_user_lang['security.config.login-and-email-forbidden-in-password'], $this->security_config->are_login_and_email_forbidden_in_password()));
        if ($this->server_configuration->has_curl_library()) {
            $fieldset = new FormFieldsetHTML('authentication_config', $admin_user_lang['members.config-authentication']);
            $this->form->add_fieldset($fieldset);
            $fieldset->add_field(new FormFieldCheckbox('fb_auth_enabled', $admin_user_lang['authentication.config.fb-auth-enabled'], $this->authentication_config->is_fb_auth_enabled(), array('description' => $admin_user_lang['authentication.config.fb-auth-enabled-explain'], 'events' => array('click' => '
					if (HTMLForms.getField("fb_auth_enabled").getValue()) { 
						HTMLForms.getField("fb_app_id").enable(); 
						HTMLForms.getField("fb_app_key").enable(); 
					} else { 
						HTMLForms.getField("fb_app_id").disable(); 
						HTMLForms.getField("fb_app_key").disable(); 
					}'))));
            $fieldset->add_field(new FormFieldTextEditor('fb_app_id', $admin_user_lang['authentication.config.fb-app-id'], $this->authentication_config->get_fb_app_id(), array('required' => true, 'hidden' => !$this->authentication_config->is_fb_auth_enabled())));
            $fieldset->add_field(new FormFieldPasswordEditor('fb_app_key', $admin_user_lang['authentication.config.fb-app-key'], $this->authentication_config->get_fb_app_key(), array('required' => true, 'hidden' => !$this->authentication_config->is_fb_auth_enabled())));
            $fieldset->add_field(new FormFieldCheckbox('google_auth_enabled', $admin_user_lang['authentication.config.google-auth-enabled'], $this->authentication_config->is_google_auth_enabled(), array('description' => $admin_user_lang['authentication.config.google-auth-enabled-explain'], 'events' => array('click' => '
					if (HTMLForms.getField("google_auth_enabled").getValue()) { 
						HTMLForms.getField("google_client_id").enable(); 
						HTMLForms.getField("google_client_secret").enable(); 
					} else { 
						HTMLForms.getField("google_client_id").disable(); 
						HTMLForms.getField("google_client_secret").disable(); 
					}'))));
            $fieldset->add_field(new FormFieldTextEditor('google_client_id', $admin_user_lang['authentication.config.google-client-id'], $this->authentication_config->get_google_client_id(), array('required' => true, 'hidden' => !$this->authentication_config->is_google_auth_enabled())));
            $fieldset->add_field(new FormFieldPasswordEditor('google_client_secret', $admin_user_lang['authentication.config.google-client-secret'], $this->authentication_config->get_google_client_secret(), array('required' => true, 'hidden' => !$this->authentication_config->is_google_auth_enabled())));
        }
        $action_fieldset = new FormFieldsetSubmit('actions');
        $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::database(), 'fa fa-arrow-left');
        $action_fieldset->add_element($back);
        $this->submit_button = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'website');
        $action_fieldset->add_element($this->submit_button);
        $this->form->add_fieldset($action_fieldset);
    }
 private function build_form()
 {
     $security_config = SecurityConfig::load();
     $form = new HTMLForm('sandboxForm');
     // FIELDSET
     $fieldset = new FormFieldsetHTML('fieldset_1', 'Fieldset');
     $form->add_fieldset($fieldset);
     $fieldset->set_description('Ceci est ma description');
     // SINGLE LINE TEXT
     $fieldset->add_field(new FormFieldTextEditor('text', 'Champ texte', 'toto', array('maxlength' => 25, 'description' => 'Contraintes lettres, chiffres et tiret bas'), array(new FormFieldConstraintRegex('`^[a-z0-9_ ]+$`i'))));
     $fieldset->add_field(new FormFieldTextEditor('textdisabled', 'Champ désactivé', '', array('maxlength' => 25, 'description' => 'désactivé', 'disabled' => true)));
     $fieldset->add_field(new FormFieldUrlEditor('siteweb', 'Site web', 'http://www.phpboost.com/index.php', array('description' => 'Url valide')));
     $fieldset->add_field(new FormFieldMailEditor('mail', 'Mail', '*****@*****.**', array('description' => 'Mail valide')));
     $fieldset->add_field(new FormFieldMailEditor('mail_multiple', 'Mail multiple', 'team.hein@phpboost.com, test@phpboost.com', array('description' => 'Mails valides, séparés par une virgule', 'multiple' => true)));
     $fieldset->add_field(new FormFieldTelEditor('tel', 'Numéro de téléphone', '0123456789', array('description' => 'Numéro de téléphone valide')));
     $fieldset->add_field(new FormFieldTextEditor('text2', 'Champ texte2', 'toto2', array('maxlength' => 25, 'description' => 'Champs requis rempli', 'required' => true)));
     $fieldset->add_field(new FormFieldTextEditor('text3', 'Champ requis', '', array('maxlength' => 25, 'description' => 'Champs requis vide', 'required' => true)));
     $fieldset->add_field(new FormFieldNumberEditor('number', 'Nombre requis', 20, array('min' => 0, 'max' => 1000, 'description' => 'Intervalle 0 à 1000', 'required' => true), array(new FormFieldConstraintIntegerRange(0, 1000))));
     $fieldset->add_field(new FormFieldNumberEditor('age', 'Age', 20, array('min' => 10, 'max' => 100, 'description' => 'Intervalle 10 à 100'), array(new FormFieldConstraintIntegerRange(10, 100))));
     $fieldset->add_field(new FormFieldDecimalNumberEditor('decimal', 'Nombre décimal', 5.5, array('min' => 0, 'step' => 0.1)));
     // RANGE
     $fieldset->add_field($password = new FormFieldRangeEditor('range', 'Longueur', 4, array('min' => 1, 'max' => 10, 'description' => 'Slider horizontal')));
     // PASSWORD
     $fieldset->add_field($password = new FormFieldPasswordEditor('password', 'Mot de passe', 'aaaaaa', array('description' => 'Minimum ' . $security_config->get_internal_password_min_length() . ' caractères'), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()))));
     $fieldset->add_field($password_bis = new FormFieldPasswordEditor('password_bis', 'Confirmation du mot de passe', 'aaaaaa', array('description' => 'Minimum ' . $security_config->get_internal_password_min_length() . ' caractères'), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()))));
     // SHORT MULTI LINE TEXT
     $fieldset->add_field(new FormFieldShortMultiLineTextEditor('short_multi_line_text', 'Champ texte multi lignes moyen', 'titi', array('rows' => 7, 'required' => true)));
     // MULTI LINE TEXT
     $fieldset->add_field(new FormFieldMultiLineTextEditor('multi_line_text', 'Champ texte multi lignes', 'toto', array('rows' => 6, 'cols' => 47, 'description' => 'Description', 'required' => true)));
     // RICH TEXT
     $fieldset->add_field(new FormFieldRichTextEditor('rich_text', 'Champ texte riche dans éditeur', 'toto <strong>tata</strong>', array('required' => true)));
     //Checkbox
     $fieldset->add_field(new FormFieldMultipleCheckbox('multiple_check_box', 'Plusieurs checkbox', array(), array(new FormFieldMultipleCheckboxOption('meet', 'la viande'), new FormFieldMultipleCheckboxOption('fish', 'le poisson')), array('required' => true)));
     // RADIO
     $default_option = new FormFieldRadioChoiceOption('Choix 1', '1');
     $fieldset->add_field(new FormFieldRadioChoice('radio', 'Choix énumération', '', array($default_option, new FormFieldRadioChoiceOption('Choix 2', '2')), array('required' => true)));
     // CHECKBOX
     $fieldset->add_field(new FormFieldCheckbox('checkbox', 'Case à cocher', FormFieldCheckbox::CHECKED));
     // SELECT
     $fieldset->add_field(new FormFieldSimpleSelectChoice('select', 'Liste déroulante', '', array(new FormFieldSelectChoiceOption('', ''), new FormFieldSelectChoiceOption('Choix 1', '1'), new FormFieldSelectChoiceOption('Choix 2', '2'), new FormFieldSelectChoiceOption('Choix 3', '3'), new FormFieldSelectChoiceGroupOption('Groupe 1', array(new FormFieldSelectChoiceOption('Choix 4', '4'), new FormFieldSelectChoiceOption('Choix 5', '5'))), new FormFieldSelectChoiceGroupOption('Groupe 2', array(new FormFieldSelectChoiceOption('Choix 6', '6'), new FormFieldSelectChoiceOption('Choix 7', '7')))), array('required' => true)));
     // SELECT MULTIPLE
     $fieldset->add_field(new FormFieldMultipleSelectChoice('multiple_select', 'Liste déroulante multiple', array('1', '2'), array(new FormFieldSelectChoiceOption('Choix 1', '1'), new FormFieldSelectChoiceOption('Choix 2', '2'), new FormFieldSelectChoiceOption('Choix 3', '3')), array('required' => true)));
     $fieldset->add_field(new FormFieldTimezone('timezone', 'TimeZone', 'UTC+0'));
     $fieldset->add_field(new FormFieldAjaxSearchUserAutoComplete('user_completition', 'Auto complétion utilisateurs', ''));
     $fieldset->add_element(new FormButtonButton('Envoyer'));
     $fieldset2 = new FormFieldsetHTML('fieldset2', 'Fieldset 2');
     $form->add_fieldset($fieldset2);
     // CAPTCHA
     $fieldset2->add_field(new FormFieldCaptcha('captcha'));
     // HIDDEN
     $fieldset2->add_field(new FormFieldHidden('hidden', 'hidden'));
     // FREE FIELD
     $fieldset2->add_field(new FormFieldFree('free', 'Champ libre', 'Valeur champ libre', array()));
     // DATE
     $fieldset2->add_field(new FormFieldDate('date', 'Date', null, array('required' => true)));
     // DATE TIME
     $fieldset2->add_field(new FormFieldDateTime('date_time', 'Heure', null, array('required' => true)));
     // COLOR PICKER
     $fieldset2->add_field(new FormFieldColorPicker('color', 'Couleur', '#CC99FF'));
     // SEARCH
     $fieldset2->add_field(new FormFieldSearch('search', 'Recherche', ''));
     // FILE PICKER
     $fieldset2->add_field(new FormFieldFilePicker('file', 'Fichier'));
     // MULTIPLE FILE PICKER
     $fieldset2->add_field(new FormFieldMultipleFilePicker('multiple_files', 'Plusieurs Fichiers'));
     // UPLOAD FILE
     $fieldset2->add_field(new FormFieldUploadFile('upload_file', 'Lien vers un fichier', '', array('required' => true)));
     // UPLOAD PICTURE FILE
     $fieldset2->add_field(new FormFieldUploadPictureFile('upload_picture_file', 'Lien vers une image', '', array('required' => true)));
     // AUTH
     $fieldset3 = new FormFieldsetHTML('fieldset3', 'Autorisations');
     $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization('Action 1', 1, 'Autorisations pour l\'action 1'), new ActionAuthorization('Action 2', 2)));
     $auth_settings->build_from_auth_array(array('r1' => 3, 'r0' => 2, 'm1' => 1, '1' => 2));
     $auth_setter = new FormFieldAuthorizationsSetter('auth', $auth_settings);
     $fieldset3->add_field($auth_setter);
     $form->add_fieldset($fieldset3);
     // VERTICAL FIELDSET
     $vertical_fieldset = new FormFieldsetVertical('fieldset4');
     $vertical_fieldset->set_description('Ceci est ma description');
     $form->add_fieldset($vertical_fieldset);
     $vertical_fieldset->add_field(new FormFieldTextEditor('alone', 'Texte', 'fieldset séparé'));
     $vertical_fieldset->add_field(new FormFieldCheckbox('cbhor', 'A cocher', FormFieldCheckbox::UNCHECKED));
     // HORIZONTAL FIELDSET
     $horizontal_fieldset = new FormFieldsetHorizontal('fieldset5');
     $horizontal_fieldset->set_description('Ceci est ma description');
     $form->add_fieldset($horizontal_fieldset);
     $horizontal_fieldset->add_field(new FormFieldTextEditor('texthor', 'Texte', 'fieldset séparé', array('required' => true)));
     $horizontal_fieldset->add_field(new FormFieldCheckbox('cbvert', 'A cocher', FormFieldCheckbox::CHECKED));
     // BUTTONS
     $buttons_fieldset = new FormFieldsetSubmit('buttons');
     $buttons_fieldset->add_element(new FormButtonReset());
     $this->preview_button = new FormButtonSubmit('Prévisualiser', 'preview', 'alert("Voulez-vous vraiment prévisualiser ?")');
     $buttons_fieldset->add_element($this->preview_button);
     $this->submit_button = new FormButtonDefaultSubmit();
     $buttons_fieldset->add_element($this->submit_button);
     $buttons_fieldset->add_element(new FormButtonButton('Bouton', 'alert("coucou");'));
     $form->add_fieldset($buttons_fieldset);
     // FORM CONSTRAINTS
     $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis));
     return $form;
 }
예제 #9
0
 /**
  * @desc Displays the form
  * @return Template The template containing all the form elements which is ready to be displayed.
  */
 public function display()
 {
     if ($this->enable_captcha_protection) {
         $this->move_captcha_protection_in_last_position();
     }
     $template = $this->get_template_to_use();
     $template->put_all(array('C_JS_NOT_ALREADY_INCLUDED' => !self::$js_already_included, 'C_HAS_REQUIRED_FIELDS' => self::$instance_id == 1 ? $this->has_required_fields() : false, 'C_TARGET' => !empty($this->target), 'FORMCLASS' => $this->css_class, 'TARGET' => $this->target, 'HTML_ID' => $this->html_id, 'L_REQUIRED_FIELDS' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'C_VALIDATION_ERROR' => count($this->validation_error_messages), 'TITLE_VALIDATION_ERROR_MESSAGE' => LangLoader::get_message('form.validation_error', 'status-messages-common'), 'METHOD' => $this->method));
     foreach ($this->validation_error_messages as $error_message) {
         if (!empty($error_message)) {
             $template->assign_block_vars('validation_error_messages', array('ERROR_MESSAGE' => $error_message));
         }
     }
     self::$js_already_included = true;
     foreach ($this->fieldsets as $fieldset) {
         $template->assign_block_vars('fieldsets', array(), array('FIELDSET' => $fieldset->display()));
         //Onsubmit constraints
         foreach ($fieldset->get_onsubmit_validations() as $constraints) {
             foreach ($constraints as $constraint) {
                 $template->assign_block_vars('check_constraints', array('ONSUBMIT_CONSTRAINTS' => $constraint));
             }
         }
     }
     if (count($this->buttons) > 0) {
         $buttons_fieldset = new FormFieldsetSubmit('fbuttons');
         $buttons_fieldset->set_form_id($this->html_id);
         foreach ($this->buttons as $button) {
             $buttons_fieldset->add_element($button);
         }
         $template->assign_block_vars('fieldsets', array(), array('FIELDSET' => $buttons_fieldset->display()));
     }
     return $template;
 }
 private function build_form()
 {
     $this->form = new HTMLForm('databaseForm', '', false);
     $fieldset_server = new FormFieldsetHTML('serverConfig', $this->lang['dbms.parameters']);
     $this->form->add_fieldset($fieldset_server);
     $host = new FormFieldTextEditor('host', $this->lang['dbms.host'], 'localhost', array('description' => $this->lang['dbms.host.explanation'], 'required' => $this->lang['db.required.host']));
     $fieldset_server->add_field($host);
     $port = new FormFieldTextEditor('port', $this->lang['dbms.port'], '3306', array('description' => $this->lang['dbms.port.explanation'], 'required' => $this->lang['db.required.port']));
     $port->add_constraint(new FormFieldConstraintIntegerRange(1, 65536));
     $fieldset_server->add_field($port);
     $login = new FormFieldTextEditor('login', $this->lang['dbms.login'], 'root', array('description' => $this->lang['dbms.login.explanation'], 'required' => $this->lang['db.required.login']));
     $fieldset_server->add_field($login);
     $password = new FormFieldPasswordEditor('password', $this->lang['dbms.password'], '', array('description' => $this->lang['dbms.password.explanation']));
     $fieldset_server->add_field($password);
     $fieldset_schema = new FormFieldsetHTML('schemaConfig', $this->lang['schema.properties']);
     $this->form->add_fieldset($fieldset_schema);
     $schema = new FormFieldTextEditor('schema', $this->lang['schema'], '', array('description' => $this->lang['schema.explanation'], 'required' => $this->lang['db.required.schema']), array(new FormFieldConstraintRegex('`^[a-z0-9_-]+$`i')));
     $schema->add_event('change', '$FFS(\'overwriteFieldset\').disable()');
     $fieldset_schema->add_field($schema);
     $tables_prefix = new FormFieldTextEditor('tablesPrefix', $this->lang['schema.tablePrefix'], 'phpboost_', array('description' => $this->lang['schema.tablePrefix.explanation'], 'required' => true), array(new FormFieldConstraintRegex('`^[a-z0-9_]+$`i')));
     $fieldset_schema->add_field($tables_prefix);
     $this->overwrite_fieldset = new FormFieldsetHTML('overwriteFieldset', $this->lang['phpboost.alreadyInstalled']);
     $this->form->add_fieldset($this->overwrite_fieldset);
     $overwrite_message = new FormFieldHTML('', $this->lang['phpboost.alreadyInstalled.explanation']);
     $this->overwrite_fieldset->add_field($overwrite_message);
     $this->overwrite_field = new FormFieldCheckbox('overwrite', $this->lang['phpboost.alreadyInstalled.overwrite'], false, array('required' => $this->lang['phpboost.alreadyInstalled.overwrite.confirm']));
     $this->overwrite_fieldset->add_field($this->overwrite_field);
     $this->overwrite_fieldset->disable();
     $action_fieldset = new FormFieldsetSubmit('actions');
     $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::server_configuration(), 'fa fa-arrow-left');
     $action_fieldset->add_element($back);
     $check = new FormButtonSubmitCssImg($this->lang['db.config.check'], 'fa fa-refresh', 'database');
     $action_fieldset->add_element($check);
     $this->submit_button = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'database');
     $action_fieldset->add_element($this->submit_button);
     $this->form->add_fieldset($action_fieldset);
 }