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); }
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(); }
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')); }
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); }
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); }
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; }
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; }
/** * 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; }
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)); }
/** * 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('tomador_cnpjcpf' => parent::$oTranslate->_('CPF/CNPJ Tomador'), 'tomador_razao_social' => parent::$oTranslate->_('Nome/Razão Social Tomador')); $oElemento->addMultiOptions($aValoresElemento); $oElemento->setValue($sValor); return $this; }
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); } }
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')); }
public function setValue($value) { if (count($this->getMultiOptions()) == 0) { $this->setMultiOptions(); } parent::setValue($value); }
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)); }
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; }
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)); }
public function init() { $request = Zend_Controller_Front::getInstance()->getRequest(); $db = new Application_Model_DbTable_DbGlobal(); /////////////Filter stock///////////////// $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $nameElement = new Zend_Form_Element_Text('s_name'); $nameValue = $request->getParam('s_name'); $nameElement->setValue($nameValue); $this->addElement($nameElement); $phonevalue = $request->getParam('phone'); $phoneElement = new Zend_Form_Element_Text('phone'); $phoneElement->setValue($phonevalue); $this->addElement($phoneElement); $rs = $db->getGlobalDb('SELECT LocationId,Name FROM tb_sublocation ORDER BY LocationId DESC '); $options = array('' => $tr->translate('Please_Select')); $agentValue = $request->getParam('stock_location'); foreach ($rs as $read) { $options[$read['LocationId']] = $read['Name']; } $sale_agent = new Zend_Form_Element_Select('stock_location'); $sale_agent->setMultiOptions($options); $sale_agent->setAttribs(array('id' => 'LocationId', 'class' => 'demo-code-language')); $sale_agent->setValue($agentValue); $this->addElement($sale_agent); return $this; }
/** * Carrega os tipos que equivalem ao tipo da abrasf no elemento * * @param Zend_Form_Element_Select $oElemento * @param string $iValor * @return Administrativo_Form_ParametroPrefeituraRps */ public function setTiposEcidade(Zend_Form_Element_Select $oElemento, $iValor = '') { $aTiposNota = Contribuinte_Model_Nota::getTiposNota(Contribuinte_Model_Nota::GRUPO_NOTA_RPS); $tipoArrayBIzonho = array('' => 'Escolha') + $aTiposNota; $oElemento->addMultiOptions($tipoArrayBIzonho); $oElemento->setValue($iValor); return $this; }
protected function buildCat2Element() { $cat2 = new Zend_Form_Element_Select('cat2'); $cat2->setLabel($this->_business->getCat2Name()); $cat2->addMultiOptions($this->_business->getCat2Array(null, true)); $cat2->setValue($this->_business->getFirstCat2(null, true)); $cat2->setAttrib('class', 'refineformselect'); $this->addElement($cat2); }
protected function buildCat3Element() { $cat3 = new Zend_Form_Element_Select('cat3'); $cat3->setLabel($this->_business->getCat3Name()); $cat3->setAttrib('class', 'refineformselect'); $cat3->addMultiOptions($this->_business->getCat3Array(null, false)); $cat3->setValue(26); $this->addElement($cat3); }
public function renderFormElement() { $elm = new Zend_Form_Element_Select($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setMultiOptions(array_merge(array('' => '---- Select One ----'), $this->getOptions())); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); return $elm; }
protected function buildCat2Element() { $cat2 = new Zend_Form_Element_Select('cat2'); $cat2->setLabel($this->_business->getCat2Name()); $cat2->addMultiOptions($this->_business->getCat2Array(null, true)); $cat2->setValue($this->_business->getFirstCat2(null, true)); $cat2->setAttrib('class', 'refineformselect'); $cat2->setAttrib('onclick', "changeCat2(this.id,this.value, '/ajax/healthandfitness/changecat2/')"); $this->addElement($cat2); }
protected function buildCat2Element() { $cat2 = new Zend_Form_Element_Select('cat2'); $cat2->setLabel($this->_business->getCat2Name()); $cat2->addMultiOptions($this->_business->getCat2Array()); $cat2->setValue($this->_business->getFirstCat2()); $cat2->setAttrib('class', 'refineformselect'); $cat2->setAttrib('onchange', "changeCat2(this.id,this.options[this.selectedIndex].value, '/ajax/jobs/changecat2/')"); $this->addElement($cat2); }
public function setValue($value) { if (is_string($value) && preg_match('/^(\\d+)\\s+(\\w+)$/', $value, $matches)) { $value = array($matches[1], $matches[2]); } if (!is_array($value) || count($value) != 2 || '' === $value[0]) { $value = null; } return parent::setValue($value); }
public function populateShowInstances($possibleInstances, $default) { $possibleInstances["0"] = _("No Show"); $instance = new Zend_Form_Element_Select("his_instance_select"); //$instance->setLabel(_("Choose Show Instance")); $instance->setMultiOptions($possibleInstances); $instance->setValue($default); $instance->setDecorators(array('ViewHelper')); $this->addElement($instance); }
public function FrmMenu($data = null) { //$db = new menu_Model_DbTable_DbMenuGroup(); $menu_code = new Zend_Form_Element_Text('menu_code'); $menu_code->setAttribs(array('class' => 'form-control', "data-required" => "1", 'aria-describedby' => 'name-error name-error', 'aria-invalid' => 'true')); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', "data-required" => "1")); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', "data-required" => "1")); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control')); $description_opt = array(0 => $this->tr->translate("SELECT_DESCRIPTION"), 1 => $this->tr->translate("CODE"), 2 => $this->tr->translate("DESCRIPTION"), 3 => $this->tr->translate("LANG_ONE"), 4 => $this->tr->translate("LANG_TWO")); $show_description->setMultiOptions($description_opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $font_size = new Zend_Form_Element_Text('demo3'); $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '12')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $this->addElements(array($apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $show_description, $background, $font_color, $font_size, $format, $setting, $arrange, $resize, $note)); if ($data != "") { $menu_code->setValue($data['menu_group_code']); $description->setValue($data['menu_group']); $lang_1->setValue($data['menu_group2']); $lang_2->setValue($data['menu_group3']); $show_description->setValue($data['show_group']); } return $this; }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oRobots = new Zend_Form_Element_Select("site_seo_robots_id"); $oRobots->setLabel("Tryb indeksowania przez roboty:"); $oRobots->setRequired(FALSE); $oRobots->addMultiOptions($this->_aAllSiteSeoRobots); $oRobots->setValue(1); $this->addElement($oRobots); $oSeoTagTitle = new Zend_Form_Element_Textarea("head_title"); $oSeoTagTitle->setLabel("Tytuł strony (meta titile):")->setFilters($this->_aFilters); $oSeoTagTitle->setRequired(FALSE); $this->addElement($oSeoTagTitle); $oAdditionalSeoTagKeywords = new Zend_Form_Element_Text("additional_seo_tag_keywords"); $oAdditionalSeoTagKeywords->setLabel("Dodaj nowe słowo kluczowe:"); $oAdditionalSeoTagKeywords->setRequired(FALSE); $oAdditionalSeoTagKeywords->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45))); $oAdditionalSeoTagKeywords->setAttrib("class", "valid"); $this->addElement($oAdditionalSeoTagKeywords); $oAddAdditionalSeoTagKeywords = new Zend_Form_Element_Button("add_additional_seo_tag_keywords"); $oAddAdditionalSeoTagKeywords->setLabel("Dodaj"); $oAddAdditionalSeoTagKeywords->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oAddAdditionalSeoTagKeywords); $oSeoTagKeywords = new Zend_Form_Element_Multiselect("keywords"); $oSeoTagKeywords->addMultiOptions($this->_aAllSiteSeoKeywords); $oSeoTagKeywords->setRequired(FALSE); $oSeoTagKeywords->setLabel("Słowa kluczowe (meta keywords):"); $oSeoTagKeywords->setAttrib("class", "chosen"); $this->addElement($oSeoTagKeywords); $oSeoTagDescription = new Zend_Form_Element_Textarea("description"); $oSeoTagDescription->setLabel("Opis strony (meta description):")->setFilters($this->_aFilters); $oSeoTagDescription->setRequired(FALSE); $this->addElement($oSeoTagDescription); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/siteseo.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function renderFormElement() { $elm = new Zend_Form_Element_Select($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setRequired($this->getRequired()); $tr = new Ot_Layout_ThemeRegister(); $themes = $tr->getThemes(); foreach ($themes as $t) { $elm->addMultiOption($t->getName(), $t->getLabel() . ' - ' . $t->getDescription()); } $elm->setDescription($this->getDescription()); $elm->setValue($this->getValue()); return $elm; }
public function renderFormElement() { $elm = new Zend_Form_Element_Select($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setRequired($this->getRequired()); $acl = Zend_Registry::get('acl'); $roles = $acl->getAvailableRoles(); foreach ($roles as $r) { $elm->addMultiOption($r['roleId'], $r['name']); } $elm->setValue($this->getValue()); return $elm; }
public function FrmProCate($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]')); $id_code = new Zend_Form_Element_Text('id_code'); $id_code->setAttribs(array('class' => 'form-control', "readonly" => "")); $code = product_Model_DbTable_DbProduct::getCallteralCode(); $id_code->setValue($code); $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 => '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_name_en = new Zend_Form_Element_Text("name_en"); $cat_name_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Name In English', "OnChange" => "GetCatName(1)")); $currency = new Zend_Form_Element_Select("currency"); $currency->setAttribs(array('class' => 'form-control validate[required]')); $dbp = new product_Model_DbTable_DbProduct(); $currencys = $dbp->getAllPro(); $option_currency = array(0 => 'Choose Currency'); foreach ($currencys as $row_currency) { $option_currency[$row_currency["cu_id"]] = $row_currency["cu_name_km"] . " - " . $row_currency["cu_name_en"]; } $currency->setMultiOptions($option_currency); $price = new Zend_Form_Element_Text("price"); $price->setAttribs(array('class' => 'validate[required]')); $description = new Zend_Form_Element_Textarea("description"); $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)")); $icon = new Zend_Form_Element_File("icon"); $this->addElements(array($description, $price, $icon, $status, $cat_name_en, $cat_name_km, $cat_id, $id_code, $currency)); if ($frm != "") { $cat_id->setValue($frm["cat_id"]); $cat_name_en->setValue($frm["pro_name_en"]); $cat_name_km->setValue($frm["pro_name_km"]); $status->setValue($frm["status"]); $currency->setValue($frm["cu_id"]); $price->setValue($frm["price_out"]); $description->setValue($frm["description"]); } return $this; }