本文整理汇总了PHP中Zend_Form_Element::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element::setValue方法的具体用法?PHP Zend_Form_Element::setValue怎么用?PHP Zend_Form_Element::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element
的用法示例。
在下文中一共展示了Zend_Form_Element::setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
public function buildForm()
{
$this->clearElements();
$hourForm = new Zend_Form_SubForm();
foreach ($this->data as $record) {
$elm = new Zend_Form_Element((string) $record['id']);
$elm->setValue($record);
$hourForm->addElement($elm);
}
$this->addSubForm($hourForm, $this->key_existing);
// add template element
$newForm = new Zend_Form_SubForm();
$elm = new Zend_Form_Element('__unique__');
$newForm->addElement($elm);
// add elements based on $_POST, (this is crap but will do for now)
if (isset($_POST['hour_new'])) {
foreach ($_POST['hour_new'] as $idx => $values) {
if ($idx != '__unique__') {
$elm = new Zend_Form_Element($idx);
$elm->setValue($values);
$newForm->addElement($elm);
}
}
}
$this->addSubForm($newForm, $this->key_new);
}
示例2: setValue
public function setValue($value)
{
$tmp = array();
if (is_array($value)) {
foreach ($value as $val) {
if (empty($val['from']) && empty($val['to'])) {
continue;
} else {
if (empty($val['to']) && (!empty($val['from']) && preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $val['from']))) {
$val['to'] = $val['from'];
}
}
array_push($tmp, $val);
}
}
return parent::setValue($tmp);
}
示例3: frmSearch
public function frmSearch($data = null)
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$db = new Application_Model_DbTable_DbGlobal();
$search_text = new Zend_Form_Element("txt_search");
$search_text->setValue($request->getParam("txt_search"));
$cat_id = new Zend_Form_Element_Select("cat_id");
$cat_id->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
$category = $db->getAllProCategories();
$option_category = array(0 => $this->tr->translate("CHOOSE_CATEGORY"));
foreach ($category as $row_cat) {
$option_category[$row_cat["cat_id"]] = $row_cat["cat_name_km"] . " - " . $row_cat["cat_name_en"];
}
$cat_id->setMultiOptions($option_category);
$cat_id->setValue($request->getParam("cat_id"));
$brand = new Zend_Form_Element_Select("brand");
$brand->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
$row_brand = $db->getAllBrand();
$option_brand = array(0 => $this->tr->translate("CHOOSE_BRAND"));
foreach ($row_brand as $rs) {
$option_brand[$rs["brand_id"]] = $rs["name_kh"] . " - " . $rs["name_en"];
}
$brand->setMultiOptions($option_brand);
$brand->setValue($request->getParam("brand"));
if ($data != null) {
}
return $this->addElements(array($search_text, $cat_id, $brand));
}
示例4: setModelosImpressao
/**
* Carrega os modelos de impressao no elemento
*
* @param Zend_Form_Element $oElemento
* @param string $sValor
* @return $this
*/
public function setModelosImpressao(Zend_Form_Element $oElemento, $sValor = '')
{
$aValores = array('1' => 'Modelo 1', '2' => 'Modelo 2', '3' => 'Modelo 3', '4' => 'Modelo 4');
$oElemento->addMultiOptions($aValores);
$oElemento->setValue($sValor);
return $this;
}