示例#1
0
文件: Checkbox.php 项目: fem/spof
 /**
  * Create new instance.
  *
  * @param string $field
  * @param string $value (optional)
  * @param bool $required (optional)
  * @param string $class (optional)
  */
 public function __construct($field, $value = "1", $required = false, $class = '')
 {
     parent::__construct('checkbox', $field, $required);
     $this->addAttribute('value', $value);
     if (!empty($class)) {
         $this->appendAttribute('class', $class);
     }
 }
示例#2
0
文件: FileInput.php 项目: fem/spof
 /**
  * Create new instance.
  *
  * @param string $field
  * @param bool $required (optional)
  * @param int $maxlength (optional)
  */
 public function __construct($field, $required = true, $maxlength = 255)
 {
     parent::__construct('file', $field, $required);
     $this->addAttribute('maxlength', $maxlength);
     $this->appendAttribute('class', 'long');
     if (strpos($field, '[]') > 0) {
         $this->addAttribute('multiple', 'multiple');
     }
 }
示例#3
0
文件: OptionInput.php 项目: fem/spof
 /**
  * Create new instance.
  *
  * @param string $value
  * @param string $key (optional)
  * @param bool $selected (optional)
  */
 public function __construct($field, $id, $value, $selected)
 {
     parent::__construct('radio', $field, false);
     $this->addAttribute('id', $id);
     $this->setValue($value);
     if ($selected) {
         $this->addAttribute('checked', 'checked');
     }
     $this->resetValueBeforeRender = false;
 }
示例#4
0
文件: UrlInput.php 项目: fem/spof
 /**
  * Create new instance.
  *
  * @param $field
  * @param bool $required (optional)
  * @param int $maxlength (optional)
  * @param string $class (optional)
  */
 public function __construct($field, $required = true, $maxlength = 255, $class = '')
 {
     parent::__construct('url', $field, $required);
     $this->addAttribute('maxlength', $maxlength);
     $this->appendAttribute('class', $class);
 }
示例#5
0
文件: UserInput.php 项目: fem/spof
 /**
  * @param $field
  * @param bool $required
  * @param int $maxlength
  */
 public function __construct($field, $required = true, $maxlength = 255)
 {
     parent::__construct('text', $field, $required);
     $this->addAttribute('maxlength', $maxlength);
     $this->appendAttribute('class', 'username-suggest');
 }
示例#6
0
文件: DateInput.php 项目: fem/spof
 /**
  * Create new instance.
  *
  * @param string $field
  * @param bool $required (optional)
  */
 public function __construct($field, $required = true)
 {
     parent::__construct('text', $field, $required);
     $this->addAttribute('maxlength', '10');
     $this->appendAttribute('class', 'date');
 }