Beispiel #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);
 }
Beispiel #2
0
 public function help()
 {
     if ($this->suggestion and !$this->readonly) {
         $this->help = $this->suggestion();
     }
     return parent::help();
 }
Beispiel #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));
   }
 }
Beispiel #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;
 }
Beispiel #6
0
 protected function getHtmlAttributes($column, $value = null)
 {
     $result = parent::getHtmlAttributes($column, $value);
     if ($length = $column->getLength()) {
         $result .= "maxlength='{$length}' ";
     }
     return $result;
 }
Beispiel #7
0
 public function content()
 {
     $content = parent::content();
     if ($this->buttons) {
         $content->append($this->buttons());
     }
     return $content;
 }
Beispiel #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;
 }
 /**
  * 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);
 }
Beispiel #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);
 }
 protected function getHtmlAttributes($column, $value = null)
 {
     $result = parent::getHtmlAttributes($column, $value);
     if ($value) {
         $result .= "checked ";
     }
     return $result;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
 }
 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;
 }
Beispiel #17
0
 public function result()
 {
     $result = parent::result();
     return v::accepted($result) ? true : false;
 }
Beispiel #18
0
 protected function getClass()
 {
     return parent::getClass() . ' date-time-field';
 }
Beispiel #19
0
 public function input()
 {
     $input = parent::input();
     $input->data(array('field' => 'autocomplete', 'url' => url('panel/api/autocomplete/usernames')));
     return $input;
 }
Beispiel #20
0
 /**
  * {@inheritDoc}
  */
 public function render(array $attributes = array())
 {
     return parent::render(array_merge(array('type' => 'text', 'maxlength' => $this->getOption('max_length')), $attributes));
 }
Beispiel #21
0
 /**
  * {@inheritDoc}
  */
 public function __construct($key, array $options = array())
 {
     $options['type'] = 'hidden';
     parent::__construct($key, $options);
 }
Beispiel #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;
 }
Beispiel #23
0
 public function input()
 {
     $input = parent::input();
     $input->data('field', 'urlfield');
     return $input;
 }
 /**
  * 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;
 }
 /**
  * 
  * @see HTMLElement::getHTML()
  */
 public function getHTML()
 {
     // value of password is always cleared before printing
     $this->clear();
     return parent::getHTML();
 }
 public function result()
 {
     // Convert all line-endings to UNIX format
     return str_replace(array("\r\n", "\r"), "\n", parent::result());
 }
Beispiel #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;
 }
Beispiel #29
0
 /**
  * {@inheritDoc}
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('maxlength' => $this->getOption('max_length')));
 }
Beispiel #30
0
 public function input()
 {
     $input = parent::input();
     $input->removeClass('input');
     return $input;
 }