Example #1
0
 function setValue($value)
 {
     if (empty($value)) {
         $value = array();
     } elseif (is_scalar($value)) {
         if (!is_numeric($value)) {
             $value = strtotime($value);
         }
         // might be a unix epoch, then we fill all possible values
         $arr = explode('-', date('w-d-n-Y-h-H-i-s-a-A', (int) $value));
         $value = array('D' => $arr[0], 'l' => $arr[0], 'd' => $arr[1], 'M' => $arr[2], 'm' => $arr[2], 'F' => $arr[2], 'Y' => $arr[3], 'y' => $arr[3], 'h' => $arr[4], 'H' => $arr[5], 'i' => $arr[6], 's' => $arr[7], 'a' => $arr[8], 'A' => $arr[9]);
     }
     parent::setValue($value);
 }
Example #2
0
 function setValue($value)
 {
     if (empty($value)) {
         $value = array();
     } elseif (is_scalar($value)) {
         if (!is_numeric($value)) {
             $value = strtotime($value);
         }
         // might be a unix epoch, then we fill all possible values
         $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int) $value));
         $value = array('D' => $arr[0], 'l' => $arr[0], 'd' => $arr[1], 'M' => $arr[2], 'm' => $arr[2], 'F' => $arr[2], 'Y' => $arr[3], 'y' => $arr[3], 'h' => $arr[4], 'g' => $arr[4], 'H' => $arr[5], 'i' => $this->_trimLeadingZeros($arr[6]), 's' => $this->_trimLeadingZeros($arr[7]), 'a' => $arr[8], 'A' => $arr[9], 'W' => $this->_trimLeadingZeros($arr[10]));
     } else {
         $value = array_map(array($this, '_trimLeadingZeros'), $value);
     }
     parent::setValue($value);
 }
 /**
  * Sets values for group's elements
  *
  * @param     array     $value    An array of 2 or more values, for the first,
  *                                the second, the third etc. select
  *
  * @access    public
  * @return    void
  */
 function setValue($value)
 {
     // fix for bug #6766. Hope this doesn't break anything more
     // after bug #7961. Forgot that _nbElements was used in
     // _createElements() called in several places...
     $this->_nbElements = max($this->_nbElements, count($value));
     parent::setValue($value);
     $this->_setOptions();
 }
 /**
  * Sets values for group's elements
  * 
  * @param     array     $value    An array of 2 or more values, for the first,
  *                                the second, the third etc. select
  *
  * @access    public
  * @return    void
  */
 function setValue($value)
 {
     $this->_nbElements = count($value);
     parent::setValue($value);
     $this->_setOptions();
 }
Example #5
0
 function setValue($value)
 {
     $trimLeadingZeros = create_function('$a', '$b = ltrim($a, \'0\'); return strlen($b)? $b: \'0\';');
     if (empty($value)) {
         $value = array();
     } elseif (is_scalar($value)) {
         if (!is_numeric($value)) {
             $value = strtotime($value);
         }
         // might be a unix epoch, then we fill all possible values
         $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int) $value));
         $value = array('D' => $arr[0], 'l' => $arr[0], 'd' => $arr[1], 'M' => $arr[2], 'm' => $arr[2], 'F' => $arr[2], 'Y' => $arr[3], 'y' => $arr[3], 'h' => $arr[4], 'g' => $arr[4], 'H' => $arr[5], 'i' => $trimLeadingZeros($arr[6]), 's' => $trimLeadingZeros($arr[7]), 'a' => $arr[8], 'A' => $arr[9], 'W' => $trimLeadingZeros($arr[10]));
     } else {
         $value = array_map($trimLeadingZeros, $value);
     }
     parent::setValue($value);
 }
Example #6
0
 function setValue($value)
 {
     if (!is_array($value)) {
         $value = array('firstselect' => '%-');
     } elseif (empty($value['firstselect'])) {
         $value['firstselect'] = '%-';
     } else {
         $value = array('firstselect' => $value['firstselect'], 'firstval' => $value['firstval'], 'secondval' => $value['secondval']);
     }
     switch ($value['firstselect']) {
         case 'betweeninc':
         case 'between':
             $this->_style[0] = $this->_style[2] = $this->_style[1] = $this->_style[3] = array('style' => 'display:inline');
             break;
         default:
             $this->_style[0] = $this->_style[1] = array('style' => 'display:inline');
             $this->_style[2] = $this->_style[3] = array('style' => 'display:none');
             break;
     }
     parent::setValue($value);
 }
Example #7
0
 function setValue($value)
 {
     if (empty($value)) {
         $value = array('firstselect' => 'none');
     } elseif (is_array($value) && key_exists('d', $value)) {
         // $value is a date array. Move it to the firstdate array. This needs to get better handled (TODO)
         $value = array('firstselect' => '', 'firstdate' => $value, 'seconddate' => $value);
     }
     switch ($value['firstselect']) {
         case 'is':
         case 'before':
         case 'after':
             $this->_style[0] = $this->_style[1] = array('style' => 'display:inline');
             $this->_style[3] = $this->_style[4] = $this->_style[5] = array('style' => 'display:none');
             $this->_style[2] = 'style="display:none"';
             break;
         case 'between':
             $this->_style[0] = $this->_style[1] = $this->_style[3] = array('style' => 'display:inline');
             $this->_style[2] = 'style="display:inline"';
             $this->_style[4] = $this->_style[5] = array('style' => 'display:none');
             break;
         case 'inthelast':
             $this->_style[0] = $this->_style[4] = $this->_style[5] = array('style' => 'display:inline');
             $this->_style[1] = $this->_style[3] = array('style' => 'display:none');
             $this->_style[2] = 'style="display:none"';
             break;
         default:
             $this->_style[1] = $this->_style[3] = $this->_style[4] = $this->_style[5] = array('style' => 'display:none');
             $this->_style[2] = 'style="display:none"';
             break;
     }
     parent::setValue($value);
 }