Пример #1
0
 /**
  * Create an <input type="text" /> field
  *
  * @param string $name	Field name
  * @param string $value Field value
  * @param bool $sticky If set to true, the last posted value will be used
  */
 public function __construct($name, $value = null, $sticky = true)
 {
     if ($sticky && isset($_POST[$name])) {
         $value = $_POST[$name];
     }
     parent::__construct('text', $name, $value);
 }
Пример #2
0
 public function help()
 {
     if ($this->suggestion and !$this->readonly) {
         $this->help = $this->suggestion();
     }
     return parent::help();
 }
Пример #3
0
 public function input()
 {
     $input = parent::input();
     $input->addClass('icon_text');
     $input->data('field', 'iconfield');
     return $input;
 }
 /**
  * Construct a radio button object
  * @param  mixed $value  the value of the field
  * @param  array $values  the array of values of radio buttons in the set
  */
 function __construct($value, $values) {
   parent::__construct($value, null);
   $this->values = $values;
   $this->ia = new IterableArray($values);
   if(!$value) {
     $this->setValue(array_shift($values));
   }
 }
Пример #5
0
 public function input()
 {
     $input = parent::input();
     $input->attr('step', $this->step);
     $input->attr('min', $this->min);
     $input->attr('max', $this->max);
     return $input;
 }
Пример #6
0
 protected function getHtmlAttributes($column, $value = null)
 {
     $result = parent::getHtmlAttributes($column, $value);
     if ($length = $column->getLength()) {
         $result .= "maxlength='{$length}' ";
     }
     return $result;
 }
Пример #7
0
 public function content()
 {
     $content = parent::content();
     if ($this->buttons) {
         $content->append($this->buttons());
     }
     return $content;
 }
Пример #8
0
 public function input()
 {
     $input = parent::input();
     if (!$this->readonly() && ($this->minLength() || $this->maxLength())) {
         $input->data('max', $this->maxLength())->data('min', $this->minLength());
     }
     return $input;
 }
Пример #9
0
 /**
  * Create an <input type="text" /> field
  *
  * @param string $name	Field name
  * @param string $value Field value
  * @param bool $sticky If set to true, the last posted value will be used
  */
 public function __construct($name, $value = null, $min = 0, $max = 100, $sticky = true)
 {
     if ($sticky && isset($_POST[$name])) {
         $value = $_POST[$name];
     }
     $this->addAttributes(array('min' => $min, 'max' => $max));
     parent::__construct('number', $name, $value);
 }
Пример #10
0
 public function __construct($name, $value = null, $sticky = true)
 {
     if ($sticky && isset($_POST[$name]) && isset($_POST[$name][$value]) && $_POST[$name][$value] == 'on') {
         $this->setChecked();
     }
     $name = $name . '[' . $value . ']';
     parent::__construct('checkbox', $name);
 }
Пример #11
0
 protected function getHtmlAttributes($column, $value = null)
 {
     $result = parent::getHtmlAttributes($column, $value);
     if ($value) {
         $result .= "checked ";
     }
     return $result;
 }
Пример #12
0
 public function input()
 {
     $input = parent::input();
     if ($this->autocomplete) {
         $input->attr('autocomplete', 'off');
         $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/emails'));
     }
     return $input;
 }
Пример #13
0
 public function input()
 {
     $input = parent::input();
     $input->data("field", "pikatime");
     if (isset($this->mode)) {
         $input->data("mode", $this->mode());
     } else {
         $input->data("mode", "24");
     }
     return $input;
 }
Пример #14
0
 public function input()
 {
     $input = parent::input();
     $input->removeAttr('name');
     $input->data(array('field' => 'date', 'format' => $this->format(), 'i18n' => html(json_encode(array('previousMonth' => '&lsaquo;', 'nextMonth' => '&rsaquo;', 'months' => l::get('fields.date.months'), 'weekdays' => l::get('fields.date.weekdays'), 'weekdaysShort' => l::get('fields.date.weekdays.short'))), false)));
     $hidden = new Brick('input', null);
     $hidden->type = 'hidden';
     $hidden->name = $this->name();
     $hidden->value = $this->value();
     return $input . $hidden;
 }
Пример #15
0
 public function validate()
 {
     if ($this->validate and is_array($this->validate)) {
         return parent::validate();
     } else {
         if ($this->min and !v::min($this->result(), $this->min)) {
             return false;
         }
         if ($this->max and !v::max($this->result(), $this->max)) {
             return false;
         }
     }
     return true;
 }
Пример #16
0
 protected function getHtmlAttributes($column, $value = null)
 {
     $result = parent::getHtmlAttributes($column, $value);
     if ($column->getUnsigned()) {
         $result .= "min='0' ";
     }
     if ($column->getType()->getName() == "float" || $column->getType()->getName() == "decimal") {
         $zeroDecimal = "";
         if ($precision = $column->getScale()) {
             for ($i = 1; $i < $precision; $i++) {
                 $zeroDecimal .= "0";
             }
         }
         $result .= "step='0." . $zeroDecimal . "1' ";
     }
     return $result;
 }
Пример #17
0
 public function result()
 {
     $result = parent::result();
     return v::accepted($result) ? true : false;
 }
Пример #18
0
 protected function getClass()
 {
     return parent::getClass() . ' date-time-field';
 }
Пример #19
0
 public function input()
 {
     $input = parent::input();
     $input->data(array('field' => 'autocomplete', 'url' => url('panel/api/autocomplete/usernames')));
     return $input;
 }
Пример #20
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     return parent::render(array_merge(array('type' => 'text', 'maxlength' => $this->getOption('max_length')), $attributes));
 }
Пример #21
0
 /**
  * {@inheritDoc}
  */
 public function __construct($key, array $options = array())
 {
     $options['type'] = 'hidden';
     parent::__construct($key, $options);
 }
Пример #22
0
 /**
  * Create outer field element.
  *
  * @since 1.0.0
  * @return \Brick
  */
 public function element()
 {
     $element = parent::element();
     $element->addClass('field-with-visualmarkdown');
     return $element;
 }
Пример #23
0
 public function input()
 {
     $input = parent::input();
     $input->data('field', 'urlfield');
     return $input;
 }
Пример #24
0
 /**
  * Add a field to this form
  *
  * @param  string $name  The name of the field to add
  * @param  InputField $field  The input field
  */ 
 function addField($name, InputField $field) {
   $field->setForm($this);
   $this->fields[$name] = $field;
 }
Пример #25
0
 /**
  * 
  * @see HTMLElement::getHTML()
  */
 public function getHTML()
 {
     // value of password is always cleared before printing
     $this->clear();
     return parent::getHTML();
 }
Пример #26
0
 public function result()
 {
     // Convert all line-endings to UNIX format
     return str_replace(array("\r\n", "\r"), "\n", parent::result());
 }
Пример #27
0
 public function input()
 {
     $input = parent::input();
     $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/uris'));
     return $input;
 }
 /**
  * Create outer field element.
  *
  * @since 1.0.0
  *
  * @return \Brick
  */
 public function element()
 {
     $element = parent::element();
     $element->addClass('field-with-codeeditor');
     return $element;
 }
Пример #29
0
 /**
  * {@inheritDoc}
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('maxlength' => $this->getOption('max_length')));
 }
Пример #30
0
 public function input()
 {
     $input = parent::input();
     $input->removeClass('input');
     return $input;
 }