/** * Get form * * @return Form_Form */ public function getForm() { $form = new Form_Form("settings"); $field = new Form_Field_Hidden("save"); $field->setDefaultValue(1); $form->addField($field); $field = new Form_Field_Select("maxentrylifetime", t("admin.settings.2")); $field->attr->add("data-setting", 1); $field->addOption("", t("admin.settings.4")); $field->addOption("-1 month", "1 " . t("months")); $field->addOption("-2 month", "2 " . t("months")); $field->addOption("-3 month", "3 " . t("months")); $field->addOption("-6 month", "6 " . t("months")); $field->addOption("-1 year", "1 " . t("years")); $field->setDefaultValue(RDR_Setting::get($field->name)->value); $form->addField($field); $field = new Form_Field_Select("maxeventlifetime", t("admin.settings.3")); $field->attr->add("data-setting", 1); $field->addOption("", "1 " . t("days")); $field->addOption("-2 day", "2 " . t("days")); $field->addOption("-3 days", "3 " . t("days")); $field->addOption("-1 week", "1 " . t("weeks")); $field->setDefaultValue(RDR_Setting::get($field->name)->value); $form->addField($field); return $form; }
/** * Get form * * @return Form_Form */ public function getForm() { $form = new Form_Form("pwchange"); $field = new Form_Field_Hidden("save"); $field->setDefaultValue(1); $form->addField($field); $field = new Form_Field_Password("newpw", t("settings.2")); $form->addField($field); $field = new Form_Field_Password("newpw2", t("settings.3")); $form->addField($field); return $form; }
/** * Get form * * @return Form_Form */ public function getForm() { $form = new Form_Form("login"); $field = new Form_Field_Hidden("login"); $field->setDefaultValue(1); $form->addField($field); $field = new Form_Field_Text("username", t("username")); $form->addField($field); $field = new Form_Field_Password("password", t("password")); $form->addField($field); $field = new Form_Field_Checkbox("remember", t("login.2")); $form->addField($field); return $form; }
public function get_form() { if ($this->charge_status != null) { require_once plugin_dir_path(dirname(__FILE__)) . 'lib/form-helpers/post-show-receipt.php'; show_receipt($this->thank_you, $this->charge_status); } elseif ($this->page_status == "new") { require_once plugin_dir_path(dirname(__FILE__)) . 'lib/make-form.php'; $form = new Form_Form($this); echo $form->make(); } else { throw new Exception("Unexpected load scenario. Try reload the page."); } }
/** * 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; }
/** * Get form * * @return Form_Form */ public function getForm() { $form = new Form_Form("rss"); $form->attr->add("method", "get"); $validatorNumber = new Form_Validator_Regex(); $validatorNumber->setErrorMessage(t("rss.10")); $validatorNumber->setRegex("^[0-9]+\$", ""); $field = new Form_Field_Text("title", t("rss.4")); $field->setDefaultValue("nReeda RSS"); $field->attr->add("style", "width:95%;"); $form->addField($field); $validator = new Form_Validator_Required(); $validator->setErrorMessage(t("form.validator.required")); $field->addValidator($validator); $field = new Form_Field_Text("desc", t("rss.5")); $field->attr->add("style", "width:95%;"); $form->addField($field); $field = new Form_Field_Text("max", t("rss.6")); $field->setDefaultValue("50"); $field->attr->add("size", 6); $field->addValidator($validatorNumber); $form->addField($field); $field = new Form_Field_Text("catmax", t("rss.7")); $field->setDefaultValue("0"); $field->attr->add("size", 6); $field->addValidator($validatorNumber); $form->addField($field); $field = new Form_Field_Text("feedmax", t("rss.8")); $field->setDefaultValue("0"); $field->attr->add("size", 6); $field->addValidator($validatorNumber); $form->addField($field); return $form; }
/** * 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; }