Esempio n. 1
0
 /**
  * @return Wax_Document_Element
  */
 public function setAttribute($name, $value)
 {
     if ($name == 'multiple' && $value == 'multiple') {
         $nameAttrib = $this->getAttribute('name');
         if (substr($nameAttrib, -2) != '[]') {
             $this->setAttribute('name', $nameAttrib . '[]');
         }
     }
     parent::setAttribute($name, $value);
 }
Esempio n. 2
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);
 }
Esempio n. 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);
 }
Esempio n. 4
0
 public function __construct($type, $name, $keys = null)
 {
     parent::__construct('Input', $name, $keys);
     $this->setAttribute('type', strtolower($type));
 }