本文整理汇总了PHP中Zend_Form_Element_Select::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Select::setValue方法的具体用法?PHP Zend_Form_Element_Select::setValue怎么用?PHP Zend_Form_Element_Select::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Select
的用法示例。
在下文中一共展示了Zend_Form_Element_Select::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))));
//enable soundcloud uploads
$this->addElement('checkbox', 'UseSoundCloud', array('label' => 'Upload Recorded Shows To SoundCloud', 'required' => false, 'value' => Application_Model_Preference::GetDoSoundCloudUpload(), 'decorators' => array('ViewHelper')));
//SoundCloud Username
$this->addElement('text', 'SoundCloudUser', array('class' => 'input_text', 'label' => 'SoundCloud Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudUser(), 'decorators' => array('ViewHelper')));
//SoundCloud Password
$this->addElement('password', 'SoundCloudPassword', array('class' => 'input_text', 'label' => 'SoundCloud Password:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudPassword(), 'decorators' => array('ViewHelper')));
// Add the description element
$this->addElement('textarea', 'SoundCloudTags', array('label' => 'SoundCloud Tags: (separate tags with spaces)', 'required' => false, 'class' => 'input_text_area', 'value' => Application_Model_Preference::GetSoundCloudTags(), 'decorators' => array('ViewHelper')));
//SoundCloud default genre
$this->addElement('text', 'SoundCloudGenre', array('class' => 'input_text', 'label' => 'Default Genre:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudGenre(), 'decorators' => array('ViewHelper')));
$select = new Zend_Form_Element_Select('SoundCloudTrackType');
$select->setLabel('Default Track Type:');
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array("" => "", "original" => "Original", "remix" => "Remix", "live" => "Live", "recording" => "Recording", "spoken" => "Spoken", "podcast" => "Podcast", "demo" => "Demo", "in progress" => "Work in progress", "stem" => "Stem", "loop" => "Loop", "sound effect" => "Sound Effect", "sample" => "One Shot Sample", "other" => "Other"));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudTrackType());
$select->setDecorators(array('ViewHelper'));
$this->addElement($select);
$select = new Zend_Form_Element_Select('SoundCloudLicense');
$select->setLabel('Default License:');
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array("" => "", "no-rights-reserved" => "The work is in the public domain", "all-rights-reserved" => "All rights are reserved", "cc-by" => "Creative Commons Attribution", "cc-by-nc" => "Creative Commons Attribution Noncommercial", "cc-by-nd" => "Creative Commons Attribution No Derivative Works", "cc-by-sa" => "Creative Commons Attribution Share Alike", "cc-by-nc-nd" => "Creative Commons Attribution Noncommercial Non Derivate Works", "cc-by-nc-sa" => "Creative Commons Attribution Noncommercial Share Alike"));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudLicense());
$select->setDecorators(array('ViewHelper'));
$this->addElement($select);
}
示例2: init
public function init()
{
$tr = Zend_Registry::get('tr');
$locale = Zend_Registry::get('Zend_Locale');
$available_languages = array (
'en' => 'English',
'fr' => 'Francais',
'it' => 'Italiano',
'ru' => 'Русский',
);
$this->setAction('/language');
$this->setAttrib('id', 'language-form');
$languages = new Zend_Form_Element_Select('languages');
$languages->setLabel($tr->_('LANGUAGE'));
$languages->addMultiOptions($available_languages);
$languages->setValue(isset($locale->value) ? $locale->value : 'en');
$this->addElement($languages);
$system_wide = new Zend_Form_Element_Checkbox('system_wide');
$system_wide->setLabel($tr->_('UPDATE_SYSTEM_WIDE') . '?');
$system_wide->setRequired(false);
$this->addElement($system_wide);
$this->addElement(new Zend_Form_Element_Submit($tr->_('SAVE')));
parent::init();
}
示例3: init
public function init()
{
$this->setName('f3')->setMethod('get');
$nams = Default_Model_Constraints::years();
$nams[''] = '';
ksort($nams);
$namOption = array("multiOptions" => $nams);
$nam = new Zend_Form_Element_Select('nam', $namOption);
$nam->setValue(date('Y'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'nam'));
$ho = new Zend_Form_Element_Text('ho');
$ho->setLabel('Họ')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('class' => 'text-input', 'style' => 'width: 100px'));
$ten = new Zend_Form_Element_Text('ten');
$ten->setLabel('Tên')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('class' => 'text-input', 'style' => 'width: 50px', 'id' => 'ten'));
$don_vi = new Default_Model_DonVi();
$dv = $don_vi->getDSDV();
$dv = array('0' => '=============== Tất cả ===============') + $dv;
$dvOptions = array("multiOptions" => $dv);
$don_vi_id = new Zend_Form_Element_Select('don_vi_id', $dvOptions);
$don_vi_id->setRequired(true)->setLabel('Đơn vị')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'don_vi_id'));
$submit = new Zend_Form_Element_Button('loc', array('type' => 'submit'));
$submit->setLabel('Lọc')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button'));
$url = new Zend_View_Helper_Url();
$link = $url->url(array('module' => 'admin', 'controller' => 'bai-bao', 'action' => 'index'), null, true);
$reset = new Zend_Form_Element_Button('reset');
$reset->setLabel('Làm mới')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_r'))))->setAttribs(array('class' => 'button', 'id' => 'reset', 'onclick' => 'window.location.href="' . $link . '"'));
$this->addElements(array($nam, $ho, $ten, $don_vi_id, $submit, $reset));
// Element: order
$this->addElement('Hidden', 'order', array('order' => 10004));
// Element: direction
$this->addElement('Hidden', 'direction', array('order' => 10005));
$this->addDisplayGroup(array('nam', 'ho', 'ten', 'don_vi_id', 'loc', 'reset'), 'filter', array('order' => '0', 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'align' => 'left', 'class' => 'text')))));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'filter_gv')), 'Form'));
}
示例4: init
public function init()
{
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))));
//enable soundcloud uploads
$this->addElement('checkbox', 'UseSoundCloud', array('label' => _('Automatically Upload Recorded Shows'), 'required' => false, 'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(), 'decorators' => array('ViewHelper')));
//enable soundcloud uploads option
$this->addElement('checkbox', 'UploadToSoundcloudOption', array('label' => _('Enable SoundCloud Upload'), 'required' => false, 'value' => Application_Model_Preference::GetUploadToSoundcloudOption(), 'decorators' => array('ViewHelper')));
//enable downloadable for soundcloud
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array('label' => _('Automatically Mark Files "Downloadable" on SoundCloud'), 'required' => false, 'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(), 'decorators' => array('ViewHelper')));
//SoundCloud Username
$this->addElement('text', 'SoundCloudUser', array('class' => 'input_text', 'label' => _('SoundCloud Email'), 'filters' => array('StringTrim'), 'autocomplete' => 'off', 'value' => Application_Model_Preference::GetSoundCloudUser(), 'decorators' => array('ViewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('UploadToSoundcloudOption' => '1')))));
//SoundCloud Password
$this->addElement('password', 'SoundCloudPassword', array('class' => 'input_text', 'label' => _('SoundCloud Password'), 'filters' => array('StringTrim'), 'autocomplete' => 'off', 'value' => Application_Model_Preference::GetSoundCloudPassword(), 'decorators' => array('ViewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('UploadToSoundcloudOption' => '1'))), 'renderPassword' => true));
// Add the description element
$this->addElement('textarea', 'SoundCloudTags', array('label' => _('SoundCloud Tags: (separate tags with spaces)'), 'required' => false, 'class' => 'input_text_area', 'value' => Application_Model_Preference::GetSoundCloudTags(), 'decorators' => array('ViewHelper')));
//SoundCloud default genre
$this->addElement('text', 'SoundCloudGenre', array('class' => 'input_text', 'label' => _('Default Genre:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudGenre(), 'decorators' => array('ViewHelper')));
$select = new Zend_Form_Element_Select('SoundCloudTrackType');
$select->setLabel(_('Default Track Type:'));
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array("" => "", "original" => _("Original"), "remix" => _("Remix"), "live" => _("Live"), "recording" => _("Recording"), "spoken" => _("Spoken"), "podcast" => _("Podcast"), "demo" => _("Demo"), "in progress" => _("Work in progress"), "stem" => _("Stem"), "loop" => _("Loop"), "sound effect" => _("Sound Effect"), "sample" => _("One Shot Sample"), "other" => _("Other")));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudTrackType());
$select->setDecorators(array('ViewHelper'));
$this->addElement($select);
$select = new Zend_Form_Element_Select('SoundCloudLicense');
$select->setLabel(_('Default License:'));
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array("" => "", "no-rights-reserved" => _("The work is in the public domain"), "all-rights-reserved" => _("All rights are reserved"), "cc-by" => _("Creative Commons Attribution"), "cc-by-nc" => _("Creative Commons Attribution Noncommercial"), "cc-by-nd" => _("Creative Commons Attribution No Derivative Works"), "cc-by-sa" => _("Creative Commons Attribution Share Alike"), "cc-by-nc-nd" => _("Creative Commons Attribution Noncommercial Non Derivate Works"), "cc-by-nc-sa" => _("Creative Commons Attribution Noncommercial Share Alike")));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudLicense());
$select->setDecorators(array('ViewHelper'));
$this->addElement($select);
}
示例5: init
public function init()
{
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true;
$this->isSaas = $isSaas;
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))));
$defaultFade = Application_Model_Preference::GetDefaultFade();
if ($defaultFade == "") {
$defaultFade = '0.500000';
}
//Station name
$this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
//Default station fade
$this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade (s):', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-9]{1,2}(\\.\\d{1,6})?$/', 'messages' => 'enter a time in seconds 0{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper')));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)');
$third_party_api->setMultiOptions(array("Disabled", "Enabled"));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
/* Form Element for setting the Timezone */
$timezone = new Zend_Form_Element_Select("timezone");
$timezone->setLabel("Timezone");
$timezone->setMultiOptions($this->getTimezones());
$timezone->setValue(Application_Model_Preference::GetTimezone());
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);
/* Form Element for setting which day is the start of the week */
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
$week_start_day->setLabel("Week Starts On");
$week_start_day->setMultiOptions($this->getWeekStartDays());
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day);
}
示例6: FrmProCate
public function FrmProCate($frm = null)
{
$db = new Application_Model_DbTable_DbGlobal();
$id_code = new Zend_Form_Element_Text('id_code');
$id_code->setAttribs(array('class' => 'form-control', "readonly" => ""));
$code = table_Model_DbTable_DbTable::getCallteralCode();
$id_code->setValue($code);
$cat_name_en = new Zend_Form_Element_Text("name_en");
$cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)"));
$cat_name_km = new Zend_Form_Element_Text("name_km");
$cat_name_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In Khmer', "OnChange" => "GetCatName(2)"));
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$icon = new Zend_Form_Element_File("icon");
$description = new Zend_Form_Element_Textarea("description");
$this->addElements(array($icon, $status, $cat_name_en, $cat_name_km, $id_code, $description));
if ($frm != "") {
$id_code->setValue($frm["code"]);
$cat_name_en->setValue($frm["name_en"]);
$cat_name_km->setValue($frm["name_km"]);
$status->setValue($frm["status"]);
$description->setValue($frm["description"]);
}
return $this;
}
示例7: FrmProCate
public function FrmProCate($frm = null)
{
$vendor_name = new Zend_Form_Element_Text("vendor_name");
$vendor_name->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'ឈ្មោះអ្នផ្ឌត់ផ្ឌង់'));
$phone = new Zend_Form_Element_Text("phone");
$phone->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
$contact = new Zend_Form_Element_Text("contact");
$contact->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
$email = new Zend_Form_Element_Text("email");
$email->setAttribs(array('class' => 'validate[required]', 'placeholder' => ''));
$address = new Zend_Form_Element_Textarea("address");
$address->setAttribs(array('class' => '', 'placeholder' => ''));
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$this->addElements(array($vendor_name, $phone, $contact, $email, $address, $status));
if ($frm != "") {
$vendor_name->setValue($frm["v_name"]);
$phone->setValue($frm["phone"]);
$contact->setValue($frm["contact_name"]);
$email->setValue($frm["email"]);
$address->setValue($frm["vendor_remark"]);
$status->setValue($frm["is_active"]);
}
return $this;
}
示例8: carregaOrdenacao
/**
* Carrega os valores de ordenação da consulta do relatório no elemento informado
*
* @param null $sValor
* @param Zend_Form_Element_Select $oElemento
* @return $this
*/
public function carregaOrdenacao($sValor = NULL, Zend_Form_Element_Select $oElemento)
{
$aValoresElemento = array('inscricao_municipal' => parent::$oTranslate->_('Inscrição Municipal'), 'nome' => parent::$oTranslate->_('Nome'));
$oElemento->addMultiOptions($aValoresElemento);
$oElemento->setValue($sValor);
return $this;
}
示例9: __construct
public function __construct($options = null)
{
parent::__construct();
$this->setName('layout_form');
$this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
$this->removeDecorator('Errors');
$this->removeDecorator('HtmlTag');
$this->removeDecorator('Label');
//$this->setAction($this->_generateActionUrl());
$layout_select = new Zend_Form_Element_Select('layout_select');
$layout_select->setAttrib('onchange', '$("#submitLayoutSelection").click();');
$layout_select->removeDecorator('Errors');
$layout_select->removeDecorator('Label');
$layout_select->removeDecorator('HtmlTag');
/*foreach($options as $language)
$translation_select->addMultiOption($language['iso6391_lng'], $language['name_lng']);
*/
$layout_select->addMultiOption('default', 'Default');
$layout_select->addMultiOption('custom', 'Custom');
//$layout_select->setValue($this->_getCurrentLayoutSelect());
$layout_select->setValue('default');
$submit = new Zend_Form_Element_Submit('submitLayoutSelection');
$submit->removeDecorator('DtDdWrapper');
$submit->setAttrib('style', 'display: none;');
$this->addElements(array($layout_select, $submit));
}
示例10: load_resources
public function load_resources()
{
$res_selects = array();
foreach (Model_Resources::getInstance()->find_all(Model_Resources::getInstance()->table()->idField()) as $res) {
error_log(__METHOD__ . ': loading resource ' . $res->identity());
$spec = array('label' => $res->title);
$res_name = 'resource_' . $res->identity();
$res_selects[] = $res_name;
$spec['name'] = $res_name;
$spec['multiOptions'] = self::$res_options;
$select = new Zend_Form_Element_Select($spec);
$domain = $this->get_domain();
if ($domain && $domain->isSaved()) {
if ($value = Model_Acl::find_acl($res, $domain)) {
error_log(__METHOD__ . ': value = ' . $value);
$select->setValue($value);
} else {
error_log(__METHOD__ . ': no value for res = ' . $res->identity() . ', role = ' . $domain->identity());
}
} else {
error_log(__METHOD__ . ': domain not saved');
}
$this->addElement($select);
}
}
示例11: init
public function init()
{
$this->setName('f2')->setMethod('post');
$nams = Default_Model_Constraints::nam();
$namOption = array("multiOptions" => $nams);
$nam = new Zend_Form_Element_Select('nam', $namOption);
$nam->setValue(date('Y'))->setLabel('Năm (*)')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'nam'));
$bizHDD = new Default_Model_Hdd();
$hdds = $bizHDD->getDSHDByNam(date('Y'));
if ($hdds == null) {
$hdsOptions = array("multiOptions" => array('-1' => '== Chưa thành lập =='));
} else {
$hdds = array('0' => '== Tất cả ==') + $hdds;
$hddsOptions = array("multiOptions" => $hdds);
}
$noi_nhan = new Zend_Form_Element_Select('noi_nhan', $hddsOptions);
$noi_nhan->setRequired(true)->setLabel('Hội đồng')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_nhan'))->setRegisterInArrayValidator(false);
$tieu_de = new Zend_Form_Element_Text('tieu_de');
$tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
$noi_dung = new Zend_Form_Element_Textarea('noi_dung');
$noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
$url = new Zend_View_Helper_Url();
$link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'ds-mail-tb'), null, true);
$cancel = new Zend_Form_Element_Button('cancel');
$cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
$this->addElements(array($nam, $noi_nhan, $tieu_de, $noi_dung, $submit, $cancel));
$this->addDisplayGroup(array('submit', 'cancel'), 'btn_submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
}
示例12: setValue
public function setValue($value)
{
if (count($this->getMultiOptions()) == 0) {
$this->setMultiOptions();
}
parent::setValue($value);
}
示例13:
function __construct($user)
{
parent::__construct();
$this->setName('Registration');
$this->setMethod('POST');
$this->setAction('/user/update');
$gender = new Zend_Form_Element_Select('gender');
$gender->setLabel('Gender');
$gender->setMultiOptions(array('Male' => 'Male', 'Female' => 'Female'));
$gender->setValue($user->gender);
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email');
$email->setValue($user->email);
$email->setRequired(true);
$email->addValidator('NotEmpty', true);
$email->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
$paymentEmail = new Zend_Form_Element_Text('paymentEmail');
$paymentEmail->setLabel('Payment Email');
$paymentEmail->setRequired(true);
$paymentEmail->addValidator('NotEmpty', true);
$paymentEmail->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
$paymentEmail->setValue($user->paymentEmail);
$countries = new Zend_Form_Element_Select('country');
$countries->setMultiOptions(self::getCountries());
$countries->setLabel('Country');
$countries->addValidator('NotEmpty');
$countries->setValue($user->country);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Update');
$this->addElements(array($gender, $email, $paymentEmail, $countries, $submit));
}
示例14: FrmBrand
public function FrmBrand($frm = null)
{
$db = new Application_Model_DbTable_DbGlobal();
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$parent = new Zend_Form_Element_Select("parent_id");
$parent->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
$category = $db->getAllBrand();
if (empty($category)) {
$option_category = array('0' => 'No Brand To Select');
} else {
$option_category = array('0' => 'Choose Brand');
foreach ($category as $row_cat) {
$option_category[$row_cat["brand_id"]] = $row_cat["name_kh"];
}
}
$parent->setMultiOptions($option_category);
$brand_en = new Zend_Form_Element_Text("name_en");
$brand_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In English', "OnChange" => "GetBrandName(1)"));
$brand_km = new Zend_Form_Element_Text("name_km");
$brand_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In Khmer', "OnChange" => "GetBrandName(2)"));
$icon = new Zend_Form_Element_File("icon");
$this->addElements(array($icon, $status, $brand_en, $brand_km, $parent));
if ($frm != "") {
$parent->setValue($frm["parent_id"]);
$brand_en->setValue($frm["name_en"]);
$brand_km->setValue($frm["name_kh"]);
$status->setValue($frm["status"]);
}
return $this;
}
示例15: init
public function init()
{
$this->setMethod('POST');
$defaultArgs = array('disableLoadDefaultDecorators' => true, 'decorators' => array('ViewHelper'));
$identity = $this->getAttrib('user_id');
$user_object = Engine_Api::_()->user()->getUser($identity);
$user_id = new Zend_Form_Element_Hidden('user_id');
$user_id->setValue($identity);
$email = new Zend_Form_Element_Text('email', $defaultArgs);
$email->addValidator('emailAddress', true)->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'email'));
$email->setValue($user_object->email);
$password = new Zend_Form_Element_Password('password', $defaultArgs);
$password->addValidator('stringLength', false, array(6, 32));
$passconf = new User_Form_Element_PasswordConfirm('passconf', $defaultArgs);
//$passconf->addDecorator('ViewHelper');
if ($settings->getSetting('user.signup.username', 1) > 0) {
$username = new Zend_Form_Element_Text('username', $defaultArgs);
$username->setValue($user_object->username);
$username->addValidator('stringLength', true, array(6, 32))->addValidator(new Zend_Validate_Db_NoRecordExists(Engine_Db_Table::getTablePrefix() . 'users', 'username'));
}
$language = new Zend_Form_Element_Select('language', $defaultArgs);
$language->addMultiOptions(array('English', 'post-English'));
$language->setValue($user_object->language_id);
$level_id = new Zend_Form_Element_Select('level_id', $defaultArgs);
$level_id->setValue($user_object->level_id);
$levels = Engine_Api::_()->authorization()->getLevelInfo();
foreach ($levels as $level) {
$level_id->addMultiOption($level['level_id'], $level['title']);
}
$this->addElements(array($user_id, $email, $password, $passconf, $username, $level_id, $language));
}