private function build_form() { $form = new HTMLForm(__CLASS__); $fieldset = new FormFieldsetHTML('configuration', LangLoader::get_message('configuration', 'admin-common')); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldTextEditor('title', $this->lang['admin.config.title'], $this->config->get_title(), array('maxlength' => 255, 'required' => true))); $fieldset->add_field(new FormFieldCheckbox('informations_enabled', $this->lang['admin.config.informations_enabled'], $this->config->are_informations_enabled(), array('description' => $this->lang['admin.config.informations.explain'], 'events' => array('click' => ' if (HTMLForms.getField("informations_enabled").getValue()) { HTMLForms.getField("informations_position").enable(); HTMLForms.getField("informations").enable(); } else { HTMLForms.getField("informations_position").disable(); HTMLForms.getField("informations").disable(); }')))); $fieldset->add_field(new FormFieldSimpleSelectChoice('informations_position', $this->lang['admin.config.informations_position'], $this->config->get_informations_position(), array(new FormFieldSelectChoiceOption($this->lang['admin.config.informations.position_left'], ContactConfig::LEFT), new FormFieldSelectChoiceOption($this->lang['admin.config.informations.position_top'], ContactConfig::TOP), new FormFieldSelectChoiceOption($this->lang['admin.config.informations.position_right'], ContactConfig::RIGHT), new FormFieldSelectChoiceOption($this->lang['admin.config.informations.position_bottom'], ContactConfig::BOTTOM)), array('hidden' => !$this->config->are_informations_enabled()))); $fieldset->add_field(new FormFieldRichTextEditor('informations', $this->lang['admin.config.informations_content'], FormatingHelper::unparse($this->config->get_informations()), array('rows' => 8, 'cols' => 47, 'hidden' => !$this->config->are_informations_enabled()))); $fieldset->add_field(new FormFieldCheckbox('tracking_number_enabled', $this->lang['admin.config.tracking_number_enabled'], $this->config->is_tracking_number_enabled(), array('events' => array('click' => ' if (HTMLForms.getField("tracking_number_enabled").getValue()) { HTMLForms.getField("date_in_tracking_number_enabled").enable(); } else { HTMLForms.getField("date_in_tracking_number_enabled").disable(); }')))); $fieldset->add_field(new FormFieldCheckbox('date_in_tracking_number_enabled', $this->lang['admin.config.date_in_date_in_tracking_number_enabled'], $this->config->is_date_in_tracking_number_enabled(), array('description' => $this->lang['admin.config.date_in_date_in_tracking_number_enabled.explain'], 'hidden' => !$this->config->is_tracking_number_enabled()))); $fieldset->add_field(new FormFieldCheckbox('sender_acknowledgment_enabled', $this->lang['admin.config.sender_acknowledgment_enabled'], $this->config->is_sender_acknowledgment_enabled())); $fieldset_authorizations = new FormFieldsetHTML('authorizations', LangLoader::get_message('authorizations', 'common')); $form->add_fieldset($fieldset_authorizations); $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['admin.authorizations.read'], ContactAuthorizationsService::READ_AUTHORIZATIONS))); $auth_settings->build_from_auth_array($this->config->get_authorizations()); $fieldset_authorizations->add_field(new FormFieldAuthorizationsSetter('authorizations', $auth_settings)); $this->submit_button = new FormButtonDefaultSubmit(); $form->add_button($this->submit_button); $form->add_button(new FormButtonReset()); $this->form = $form; }