Beispiel #1
0
 public function __construct($name, $value = null, $rows = null, $cols = null)
 {
     parent::__construct('Textarea', $name);
     if (empty($rows)) {
         $rows = $this->_rows;
     }
     if (empty($cols)) {
         $cols = $this->_cols;
     }
     $this->setAttribute('rows', $rows)->setAttribute('cols', $cols)->setTagType(Wax_Document_Element::TAG_OPEN)->innerHTML($value);
 }
Beispiel #2
0
 public function __construct($options, $name = null, $value = null)
 {
     parent::__construct('Select', $name);
     if (substr($name, -2) == '[]') {
         $this->setAttribute('multiple', 'multiple');
     }
     settype($value, 'array');
     foreach ((array) $options as $optionValue => $optionLabel) {
         if (is_array($optionLabel)) {
             $this->appendChild(self::createOptionGroup($optionLabel, $optionValue, $value));
         } else {
             $selected = in_array($optionValue, $value);
             $this->appendChild(self::createOption($optionValue, $optionLabel, $selected));
         }
     }
     $this->addClass('select');
     $this->_selectedValue = $value;
 }
Beispiel #3
0
 public function __construct($name, $value = null, $range = array())
 {
     Wax_Document::$head->importJavaScript($this);
     $step = 1;
     $low = null;
     $high = null;
     $maxlength = null;
     if (sizeof($range) > 0) {
         if (sizeof($range) == 3) {
             list($low, $high, $step) = array_values($range);
         } elseif (sizeof($range) == 2) {
             list($low, $high) = array_values($range);
             $step = 1;
         } elseif (sizeof($range) == 1) {
             list($high) = array_values($range);
             $low = 0;
             $step = 1;
         }
         if (strlen(strval($high)) > strlen(@strval($low))) {
             $maxlength = strlen(strval($high));
         } else {
             $maxlength = strlen(strval($low));
         }
     }
     if (is_null($value)) {
         if ($low && $high) {
             if ($low <= 0 && $high >= 0) {
                 $value = 0;
             } else {
                 $value = $low;
             }
         }
     }
     $this->_low = $low;
     $this->_high = $high;
     $this->_step = $step;
     parent::__construct('Input', $name);
     $this->addClass('spin')->setAttribute('value', $value)->setAttribute('maxlength', $maxlength)->setAttribute('size', $maxlength);
 }
Beispiel #4
0
 public function __construct($type, $name, $keys = null)
 {
     parent::__construct('Input', $name, $keys);
     $this->setAttribute('type', strtolower($type));
 }