本文整理汇总了PHP中HTML_QuickForm_group::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_group::setValue方法的具体用法?PHP HTML_QuickForm_group::setValue怎么用?PHP HTML_QuickForm_group::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm_group
的用法示例。
在下文中一共展示了HTML_QuickForm_group::setValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
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);
}
示例2: setValue
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);
}
示例3: setValue
/**
* 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();
}
示例4: setValue
/**
* 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();
}
示例5: setValue
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);
}
示例6: setValue
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);
}
示例7: setValue
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);
}