예제 #1
0
 /**
  * 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;
 }
예제 #2
0
파일: Orm.php 프로젝트: ariol/adminshop
 protected function __construct(array $field = array())
 {
     $this->_model = Arr::get($field, 'model', $this->_model);
     $this->_key = Arr::get($field, 'key', $this->_key);
     $this->_view_value = Arr::get($field, 'view_value', $this->_view_value);
     $this->_rules = Arr::get($field, 'rules', $this->_rules);
     $this->_allow_empty = Arr::get($field, 'allow_empty', $this->_allow_empty);
     $this->_empty_value = Arr::get($field, 'empty_value', $this->_empty_value);
     parent::__construct($field);
 }
예제 #3
0
 /**
  * Get html string for this field
  *
  * @return string
  */
 public function getHtml()
 {
     $this->attr->add("multiple", "multiple");
     return parent::getHtml();
 }
예제 #4
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;
 }