本文整理汇总了PHP中Zend_Form_Element_Xhtml::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Xhtml::setValue方法的具体用法?PHP Zend_Form_Element_Xhtml::setValue怎么用?PHP Zend_Form_Element_Xhtml::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Xhtml
的用法示例。
在下文中一共展示了Zend_Form_Element_Xhtml::setValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
public function setValue($value)
{
if (is_array($value)) {
if (isset($value['value'])) {
parent::setValue($value['value']);
}
if (isset($value['overwrite'])) {
if ($value['overwrite'] == '1' || $value['overwrite'] === true) {
$this->overwrite = true;
} else {
$this->overwrite = false;
}
}
} else {
parent::setValue($value);
}
}
示例2: setValue
/**
* Set value
*
* If value matches checked value, sets to that value, and sets the checked
* flag to true.
*
* Any other value causes the unchecked value to be set as the current
* value, and the checked flag to be set as false.
*
*
* @param mixed $value
* @return Zend_Form_Element_Checkbox
*/
public function setValue($value)
{
if ($value == $this->getCheckedValue()) {
parent::setValue($value);
$this->checked = true;
} else {
parent::setValue($this->getUncheckedValue());
$this->checked = false;
}
return $this;
}
示例3: setValue
public function setValue($value)
{
if (is_array($value)) {
$value = $value['year'] . '-' . $value['month'] . '-' . $value['day'];
if ($value == "0-0-0") {
return parent::setValue(NULL);
}
}
return parent::setValue($value);
}
示例4: setValue
public function setValue($value)
{
if (is_array($value)) {
// Process date
$year = null;
$month = null;
$day = null;
if (isset($value['date']) && preg_match('/^(\\d+)\\/(\\d+)\\/(\\d+)$/', $value['date'], $m)) {
array_shift($m);
$year = $m[stripos($this->dateFormat, 'y')];
$month = $m[stripos($this->dateFormat, 'm')];
$day = $m[stripos($this->dateFormat, 'd')];
} else {
if (isset($value['year']) && is_numeric($value['year'])) {
$year = $value['year'];
}
if (isset($value['month']) && is_numeric($value['month'])) {
$month = $value['month'];
}
if (isset($value['day']) && is_numeric($value['day'])) {
$day = $value['day'];
}
}
// Process time
$hour = null;
$minute = null;
$second = null;
if (isset($value['hour']) && is_numeric($value['hour']) && in_array($value['hour'], $this->getHourOptions())) {
$hour = $value['hour'];
}
if (isset($value['minute']) && is_numeric($value['minute']) && in_array($value['minute'], $this->getMinuteOptions())) {
$minute = $value['minute'];
}
if (isset($value['second']) && is_numeric($value['second'])) {
$second = $value['second'];
}
if (isset($value['ampm']) && in_array($value['ampm'], $this->getAMPMOptions())) {
if ($value['ampm'] == 'PM' && $hour < 12 && null !== $hour) {
$hour += 12;
} else {
if ($value['ampm'] == 'AM' && $hour == 12) {
$hour = 0;
}
}
}
// Get values
$formatString = '%1$04d-%2$02d-%3$02d';
if (null !== $hour && null !== $minute) {
$formatString .= ' %4$02d:%5$02d:%6$02d';
}
$valueString = sprintf($formatString, $year, $month, $day, $hour, $minute, $second);
$value = $valueString;
}
return parent::setValue($value);
}
示例5: setValue
/**
* Set value
*
* If non-null, sets checked flag to true
*
* @param mixed $value
* @return void
*/
public function setValue($value)
{
$value = ($value === null) ? 0 : 1;
$this->checked = ($value === 0) ? false : true;
return parent::setValue($value);
}
示例6: setValue
/**
* Set element value
*
* @param mixed $value
* @return \MUtil_Form_Element_Table (continuation pattern)
*/
public function setValue($value)
{
// $this->setElementsBelongTo($this->getName());
if ($this->_subForm && $value) {
$this->_subForm->setElementsBelongTo($this->getName());
foreach ($value as $id => $row) {
if (isset($this->_subForms[$id])) {
$this->_subForms[$id]->populate($row);
} else {
$subForm = clone $this->_subForm;
$name = $this->getName() . '[' . $id . ']';
$subForm->setElementsBelongTo($name);
$subForm->setName($name);
$subForm->populate($row);
$this->_subForms[$id] = $subForm;
}
}
}
return parent::setValue($value);
}
示例7: setValue
public function setValue($value)
{
if (is_array($value)) {
// Process date
$year = null;
$month = null;
$day = null;
$localeObject = Zend_Registry::get('Locale');
$dateLocaleString = $localeObject->getTranslation('long', 'Date', $localeObject);
// overwrite date format
if (isset($value['date']) && preg_match('/^(\\d+)-(\\d+)-(\\d+)$/', $value['date'], $m)) {
array_shift($m);
$year = $m[stripos($this->dateFormat, 'y')];
$month = $m[stripos($this->dateFormat, 'm')];
$day = $m[stripos($this->dateFormat, 'd')];
} else {
if (isset($value['year']) && is_numeric($value['year'])) {
$year = $value['year'];
}
if (isset($value['month']) && is_numeric($value['month'])) {
$month = $value['month'];
}
if (isset($value['day']) && is_numeric($value['day'])) {
$day = $value['day'];
}
}
// Get values
$formatString = '%1$04d-%2$02d-%3$02d';
$valueString = sprintf($formatString, $year, $month, $day);
$value = $valueString;
}
return parent::setValue($value);
}
示例8: setValue
public function setValue($value)
{
parent::setValue($value);
}