Inheritance: extends Form_Field
Esempio n. 1
0
 /**
  * Get form
  *
  * @return Form_Form
  */
 private function getForm()
 {
     $form = new Form_Form("install");
     $validator = new Form_Validator_Required();
     $validator->setErrorMessage(t("form.validator.required"));
     $field = new Form_Field_Hidden("install", "");
     $field->setDefaultValue(1);
     $form->addField($field);
     $field = new Form_Field_Text("mysql-host", t("install.host"));
     $field->addValidator($validator);
     $field->setDefaultValue("localhost");
     $form->addField($field);
     $field = new Form_Field_Text("mysql-db", t("install.db"));
     $field->addValidator($validator);
     $field->setDefaultValue("nreeda");
     $form->addField($field);
     $field = new Form_Field_Text("mysql-user", t("install.user"));
     $field->addValidator($validator);
     $field->setDefaultValue("nreeda");
     $form->addField($field);
     $field = new Form_Field_Password("mysql-pass", t("install.pw"));
     $form->addField($field);
     $field = new Form_Field_Text("admin-user", t("install.admin.user"));
     $field->addValidator($validator);
     $form->addField($field);
     $field = new Form_Field_Password("admin-pass", t("install.admin.pw"));
     $field->addValidator($validator);
     $form->addField($field);
     return $form;
 }
Esempio n. 2
0
 /**
  * Get form
  *
  * @return Form_Form
  */
 public function getForm()
 {
     $form = new Form_Form("user");
     $field = new Form_Field_Hidden("save");
     $field->setDefaultValue(1);
     $form->addField($field);
     $field = new Form_Field_Text("username", t("username"));
     $field->setDefaultValue($this->user->username);
     $field->setDbObjectMember($this->user);
     $form->addField($field);
     $field = new Form_Field_Password("password", t("password"));
     if (!$this->user->getId()) {
         $field->setDbObjectMember($this->user);
     }
     $form->addField($field);
     $field = new Form_Field_Password("password2", t("settings.3"));
     if (!$this->user->getId()) {
         $field->setDbObjectMember($this->user, "password");
     }
     $form->addField($field);
     $field = new Form_Field_Select("role", t("admin.user.5"));
     $field->setDbObjectMember($this->user);
     $field->addOption(RDR_User::ROLE_USER, t("user." . RDR_User::ROLE_USER));
     $field->addOption(RDR_User::ROLE_ADMIN, t("user." . RDR_User::ROLE_ADMIN));
     $field->setDefaultValue($this->user->role);
     $form->addField($field);
     return $form;
 }