public function startFrom() { $setting = $this->setting; if (Application_Model_Preference::GetPlanLevel() == 'disabled') { $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); $output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio"); $output_type = new Zend_Form_Element_Select('output_sound_device_type'); $output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $this->addElement($icecast_vorbis_metadata); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel('Stream Label:'); $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name")); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); }
public function init() { $this->setMethod('POST'); $this->setName("adminForm"); $element = new Zend_Form_Element_Hidden('id'); $element->setValue($this->advertisement->id); $this->addElement($element); $element = new Zend_Form_Element_Hidden('city'); $element->setValue($this->city); $this->addElement($element); $element = new Zend_Form_Element_Radio('action'); $element->setMultiOptions(array('0' => '已解决, 关闭帖子', '1' => '打错了些东东, 修改帖子', '2' => '我是管理员, 删除帖子')); $element->setValue(0); $this->addElement($element); $element = new Zend_Form_Element_Text('password'); $element->setLabel('密码'); $element->setDescription('忘记密码?'); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit('post'); $element->setLabel('提交')->removeDecorator('Label'); $this->addElement($element); $this->addDisplayGroup(array('password', 'captcha', 'post'), 'leftMargin'); $this->getDisplayGroup('leftMargin')->removeDecorator('DtDdWrapper'); }
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 renderFormElement() { $elm = new Zend_Form_Element_Radio($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setMultiOptions($this->_rankingOptions); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); $elm->setSeparator(''); return $elm; }
protected function buildCat1Element() { $cat1 = new Zend_Form_Element_Radio('cat1'); $cat1->setLabel($this->_business->getCat1Name()); $cat1->setMultiOptions($this->_business->getCat1Array()); //$cat1->setValue($this->_business->getFirstCat1()); logfire('FFFkey', $this->_business->getFirstCat1()); $cat1->setValue($this->_business->getFirstCat1()); $cat1->setAttrib('class', 'refineformselect'); $this->addElement($cat1); }
public function init() { // cliente_tipo $cliente_tipo = new Zend_Form_Element_Radio("cliente_tipo"); $cliente_tipo->setLabel("Tipo: "); $cliente_tipo->setRequired(); $cliente_tipo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $cliente_tipo->setMultiOptions(array('PF' => ' Pessoa Física', 'PJ' => ' Pessoa Jurídica')); // cliente_empresa $cliente_empresa = new Zend_Form_Element_Text("cliente_empresa"); $cliente_empresa->setLabel("Empresa:"); $cliente_empresa->setAttribs(array('class' => 'form-control')); // cliente_nome $cliente_nome = new Zend_Form_Element_Text("cliente_nome"); $cliente_nome->setLabel("Contato:"); $cliente_nome->setRequired(); $cliente_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $cliente_nome->setAttribs(array('class' => 'form-control')); // cliente_email $cliente_email = new Zend_Form_Element_Text("cliente_email"); $cliente_email->setLabel("E-mail:"); $cliente_email->setRequired(); $cliente_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $cliente_email->setAttribs(array('class' => 'form-control')); // cliente_telefone $cliente_telefone = new Zend_Form_Element_Text("cliente_telefone"); $cliente_telefone->setLabel("Telefone:"); $cliente_telefone->setAttribs(array('class' => 'form-control')); // cliente_celular $cliente_celular = new Zend_Form_Element_Text("cliente_celular"); $cliente_celular->setLabel("Celular:"); $cliente_celular->setAttribs(array('class' => 'form-control')); // cliente_cidade $cliente_cidade = new Zend_Form_Element_Text("cliente_cidade"); $cliente_cidade->setLabel("Cidade:"); $cliente_cidade->setAttribs(array('class' => 'form-control')); // cliente_estado $cliente_estado = new Zend_Form_Element_Select("cliente_estado"); $cliente_estado->setLabel("Estado:"); $cliente_estado->setAttribs(array('class' => 'form-control')); $cliente_estado->setMultiOptions($this->getEstados()); /** * Add elements */ $this->addElements(array($cliente_tipo, $cliente_empresa, $cliente_nome, $cliente_email, $cliente_telefone, $cliente_celular, $cliente_cidade, $cliente_estado)); parent::init(); }
public function init() { // profissional_beleza_nome $profissional_beleza_nome = new Zend_Form_Element_Text("profissional_beleza_nome"); $profissional_beleza_nome->setLabel("Nome: "); $profissional_beleza_nome->setAttribs(array('class' => 'form-control')); $profissional_beleza_nome->setRequired(); $profissional_beleza_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // profissional_beleza_email $profissional_beleza_email = new Zend_Form_Element_Text("profissional_beleza_email"); $profissional_beleza_email->setLabel("E-mail: "); $profissional_beleza_email->setValidators(array('EmailAddress')); $profissional_beleza_email->addValidator(new App_Validate_ProfissionalBeleza()); $profissional_beleza_email->setAttribs(array('class' => 'form-control')); $profissional_beleza_email->setRequired(); $profissional_beleza_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * profisional_beleza_sexo */ $profissional_beleza_sexo = new Zend_Form_Element_Radio("profissional_beleza_sexo"); $profissional_beleza_sexo->setLabel("Sexo:"); $profissional_beleza_sexo->setRequired(); $profissional_beleza_sexo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $profissional_beleza_sexo->setMultiOptions(array('M' => ' Masculino', 'F' => ' Feminino')); // profissional_beleza_avatar $profissional_beleza_avatar = new Zend_Form_Element_File("profissional_beleza_avatar"); $profissional_beleza_avatar->setLabel(" \n Foto: \n "); $profissional_beleza_avatar->addDecorators(App_Forms_Decorators::$ElementDecoratorFile); $profissional_beleza_avatar->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a foto', 'data-iconName' => 'fa fa-user')); $profissional_beleza_avatar->setRequired(); $profissional_beleza_avatar->setDestination(Zend_Registry::get('config')->profissional->avatar->path); $profissional_beleza_avatar->addValidators(array(array('Extension', false, 'jpg,jpeg,png'))); $profissional_beleza_avatar->addFilter(new Skoch_Filter_File_Resize(array('width' => 160, 'keepRatio' => true))); // especialidade_id $especialidade_id = new Zend_Form_Element_MultiCheckbox("especialidade_id"); $especialidade_id->setLabel("Selecione as especialidades: "); $especialidade_id->setAttribs(array('class' => '')); $especialidade_id->setRequired(); $especialidade_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $especialidade_id->setSeparator(' '); $especialidade_id->setMultiOptions($this->getEspecialidades()); // addElements $this->addElements(array($profissional_beleza_nome, $profissional_beleza_email, $profissional_beleza_sexo, $profissional_beleza_avatar, $especialidade_id)); parent::init(); }
public function init() { $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); $rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')))); $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn(); $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut(); //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 in $this->addElement('text', 'stationDefaultCrossfadeDuration', array('class' => 'input_text', 'label' => _('Default Crossfade Duration (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(), 'decorators' => array('ViewHelper'))); //Default station fade in $this->addElement('text', 'stationDefaultFadeIn', array('class' => 'input_text', 'label' => _('Default Fade In (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFadeIn, 'decorators' => array('ViewHelper'))); //Default station fade out $this->addElement('text', 'stationDefaultFadeOut', array('class' => 'input_text', 'label' => _('Default Fade Out (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFadeOut, 'decorators' => array('ViewHelper'))); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api->setLabel(sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>')); $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); $locale = new Zend_Form_Element_Select("locale"); $locale->setLabel(_("Default Interface Language")); $locale->setMultiOptions(Application_Model_Locale::getLocales()); $locale->setValue(Application_Model_Preference::GetDefaultLocale()); $locale->setDecorators(array('ViewHelper')); $this->addElement($locale); /* Form Element for setting the Timezone */ $timezone = new Zend_Form_Element_Select("timezone"); $timezone->setLabel(_("Station Timezone")); $timezone->setMultiOptions(Application_Common_Timezone::getTimezones()); $timezone->setValue(Application_Model_Preference::GetDefaultTimezone()); $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 init() { $oServerCron = new \Zend_Form_Element_Radio('radioServerCron'); $oServerCron->setLabel('Select cronjob handler'); $oServerCron->setMultiOptions(array('true' => 'Server', 'false' => 'WP cron')); $oEmail = new \Zend_Form_Element_Text('textEmail'); $oEmail->setLabel('Debug email'); $oSubmit = new \Zend_Form_Element_Button('submitSubmit'); $oSubmit->setLabel('Submit')->setAttrib('type', 'submit')->setDecorators(array('ViewHelper')); switch ($this->_sContext) { case self::CONTEXT_CREATE: $oSubmit->setLabel('<i class="icon icon-save"></i> Save')->setAttrib('escape', false)->setAttrib('class', 'btn btn-success'); $aCreateElements = array($oServerCron, $oEmail, $oSubmit); $this->addElements($aCreateElements); break; } $this->_sViewScript = '/forms/settings.phtml'; // $this->_sViewScript = '/forms/generic_two_column.phtml'; $this->setDecorators(array(array('ViewScript', array('viewScript' => $this->_sViewScript)))); }
public function startFrom() { $setting = $this->setting; if (Application_Model_Preference::GetPlanLevel() == 'disabled') { $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); $output_sound_device->setLabel(_('Hardware Audio Output'))->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio"); $output_type = new Zend_Form_Element_Select('output_sound_device_type'); $output_type->setLabel(_("Output Type"))->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $this->addElement($icecast_vorbis_metadata); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel(_('Stream Label:')); $stream_format->setMultiOptions(array(_("Artist - Title"), _("Show - Artist - Title"), _("Station name - Show name"))); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); $offAirMeta = new Zend_Form_Element_Text('offAirMeta'); $offAirMeta->setLabel(_('Off Air Metadata'))->setValue(Application_Model_StreamSetting::getOffAirMeta())->setDecorators(array('ViewHelper')); $this->addElement($offAirMeta); $enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain"); $enable_replay_gain->setLabel(_("Enable Replay Gain"))->setValue(Application_Model_Preference::GetEnableReplayGain())->setDecorators(array('ViewHelper')); $this->addElement($enable_replay_gain); $replay_gain = new Zend_Form_Element_Hidden("replayGainModifier"); $replay_gain->setLabel(_("Replay Gain Modifier"))->setValue(Application_Model_Preference::getReplayGainModifier())->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))->setDecorators(array('ViewHelper')); $this->addElement($replay_gain); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')))); $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade == "") { $defaultFade = '00:00:00.000000'; } //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetValue("station_name"), 'decorators' => array('ViewHelper'))); //Default station fade $this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\\.\\d{1,6})?$/', 'messages' => 'enter a time 00:00:00{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper'))); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel('Stream Label:'); $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name")); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); $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); }
public function init() { $this->setMethod('post')->setAttrib('id', 'frmTest')->setAttrib('enctype', 'multipart/form-data'); // Elemento: Nombre $e = new Zend_Form_Element_Text('nombre'); $e->setLabel('Nombre'); $e->setFilters(array('StringToLower')); $this->addElement($e); // Elemento: activo $e = new Zend_Form_Element_Checkbox('activo'); $e->setLabel('Activo'); $this->addElement($e); // Elemento: activo2 $e = new Zend_Form_Element_Radio('activo2'); $e->setLabel('Activo2'); $_cat = new Application_Model_Categoria(); $values = $_cat->getComboValues(); $e->setMultiOptions($values); $e->setValue(array_rand($values)); $v = new Zend_Validate_InArray(array_keys($values)); $this->addElement($e); $e = new Zend_Form_Element_File('imagen'); $e->setLabel('Upload an image:'); $e->setDestination(APPLICATION_PATH . '/../public/uploads/'); $f = new Zend_Filter_File_Rename(array('target' => '123.jpg')); // Renombrar archivo $e->addFilter($f); $e->addValidator('Count', false, 1); // Solo 1 archivo $e->addValidator('Size', false, 102400); // limite de 100K $e->addValidator('Extension', false, 'jpg,png,gif'); // solo JPEG, PNG, and GIFs $this->addElement($e); $this->addElement('submit', 'Enviar'); }
public function init() { $this->setAttribs(array('id' => 'formSiteCadastro')); // empresa_tipo $empresa_tipo = new Zend_Form_Element_Radio("empresa_tipo"); $empresa_tipo->setLabel("Tipo: "); $empresa_tipo->setMultiOptions(array(1 => ' Pessoa Física', 2 => ' Pessoa Jurídica')); $empresa_tipo->setRequired(); // empresa_cpf_cnpj $empresa_cpf_cnpj = new Zend_Form_Element_Text("empresa_cpf_cnpj"); $empresa_cpf_cnpj->setLabel("CPF/CNPJ: "); $empresa_cpf_cnpj->setAttribs(array('class' => 'form-control')); // empresa_nome $empresa_nome = new Zend_Form_Element_Text("empresa_nome"); $empresa_nome->setLabel("Empresa: "); $empresa_nome->setAttribs(array('class' => 'form-control')); // empresa_responsavel $empresa_responsavel = new Zend_Form_Element_Text("empresa_responsavel"); $empresa_responsavel->setLabel("Responsável: "); $empresa_responsavel->setAttribs(array('class' => 'form-control')); // empresa_email $empresa_email = new Zend_Form_Element_Text("empresa_email"); $empresa_email->setLabel("E-mail: "); $empresa_email->setAttribs(array('class' => 'form-control')); // empresa_telefone $empresa_telefone = new Zend_Form_Element_Text("empresa_telefone"); $empresa_telefone->setLabel("Telefone: "); $empresa_telefone->setAttribs(array('class' => 'form-control')); // empresa_celular $empresa_celular = new Zend_Form_Element_Text("empresa_celular"); $empresa_celular->setLabel("Celular: "); $empresa_celular->setAttribs(array('class' => 'form-control')); // empresa_endereco $empresa_endereco = new Zend_Form_Element_Text("empresa_endereco"); $empresa_endereco->setLabel("Endereco: "); $empresa_endereco->setAttribs(array('class' => 'form-control')); // empresa_numero $empresa_numero = new Zend_Form_Element_Text("empresa_numero"); $empresa_numero->setLabel("Número: "); $empresa_numero->setAttribs(array('class' => 'form-control')); // empresa_complemento $empresa_complemento = new Zend_Form_Element_Text("empresa_complemento"); $empresa_complemento->setLabel("Compelmento: "); $empresa_complemento->setAttribs(array('class' => 'form-control')); // empresa_bairro $empresa_bairro = new Zend_Form_Element_Text("empresa_bairro"); $empresa_bairro->setLabel("Bairro: "); $empresa_bairro->setAttribs(array('class' => 'form-control')); // empresa_cidade // empresa_estado // empresa_servico $empresa_servico = new Zend_Form_Element_Text("empresa_servico"); $empresa_servico->setLabel("Cadastre os serviços que oferece:"); $empresa_servico->isArray(true); $empresa_servico->setAttribs(array('class' => 'form-control')); // submit $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", 'btn btn-default'); $submit->setLabel("Cadastrar"); $this->addElements(array($empresa_tipo, $empresa_cpf_cnpj, $empresa_nome, $empresa_responsavel, $empresa_email, $empresa_endereco, $empresa_numero, $empresa_complemento, $empresa_bairro, $empresa_telefone, $empresa_celular, $empresa_servico, $submit)); }
public function AddProductForm($data = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $user_info = new Application_Model_DbTable_DbGetUserInfo(); $result = $user_info->getUserInfo(); $db = new Application_Model_DbTable_DbGlobal(); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $nameElement = new Zend_Form_Element_Text('txt_name'); $nameElement->setAttribs(array('class' => 'validate[required]', 'placeholder' => $tr->translate('ENTER_ITEM'))); $this->addElement($nameElement); $product_size = new Zend_Form_Element_Text('product_size'); $product_size->setAttribs(array('placeholder' => $tr->translate('ENTER_ITME_SIZE'))); $this->addElement($product_size); $codeElement = new Zend_Form_Element_Text('txt_code'); $codeElement->setAttribs(array('placeholder' => $tr->translate("ENTER_ITEM_CODE"), 'class' => 'validate[required]', 'Onblur' => 'CheckPCode()')); $this->addElement($codeElement); $rowsBranch = $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category WHERE Name!="" AND IsActive=1 ORDER BY CategoryId DESC '); $options = ""; if ($result["level"] == 1 or $result["level"] == 2) { $options = array("" => $tr->translate("SELECT_CATEGORY"), "-1" => $tr->translate("ADD_NEW")); } if ($rowsBranch) { foreach ($rowsBranch as $readCategory) { $options[$readCategory['CategoryId']] = $readCategory['Name']; } } $categoryElement = new Zend_Form_Element_Select('category'); $categoryElement->setAttribs(array('class' => 'validate[required]', "Onchange" => "showPopupCategory()")); $categoryElement->setMultiOptions($options); $this->addElement($categoryElement); $rowsBranch = $db->getGlobalDb('SELECT branch_id, Name FROM tb_branch WHERE Name!="" AND IsActive=1 ORDER BY Name DESC '); $options = ""; if ($result["level"] == 1 or $result["level"] == 2) { $options = array("" => $tr->translate("SELECT_BRAND"), "-1" => $tr->translate("ADD_NEW")); } if ($rowsBranch) { foreach ($rowsBranch as $readBranch) { $options[$readBranch['branch_id']] = $readBranch['Name']; } } $branchElement = new Zend_Form_Element_Select('branch_id'); $branchElement->setAttribs(array('class' => 'validate[required]', "Onchange" => "showPopupBranch()")); $branchElement->setMultiOptions($options); $this->addElement($branchElement); $typeElement = new Zend_Form_Element_Select('stock_type'); $typeElement->setAttribs(array('id' => 'single')); $typeElement->setMultiOptions(array(1 => $tr->translate("STOCKABLE"), 2 => $tr->translate("NON_STOCKED"), 3 => $tr->translate("SERVICE"))); $this->addElement($typeElement); $rowsmeasures = $db->getGlobalDb("SELECT id,measure_name FROM `tb_measure` WHERE measure_name!='' AND public =1"); $options = array("" => $tr->translate("SELECT_MEASURE"), "-1" => $tr->translate("ADD_NEW")); if ($rowsmeasures) { foreach ($rowsmeasures as $readmeasure) { $options[$readmeasure['id']] = $readmeasure['measure_name']; } } $measure_unit = new Zend_Form_Element_Select('measure_unit'); $measure_unit->setMultiOptions($options); $measure_unit->setAttribs(array('class' => 'validate[required]', "Onchange" => "showPopupMeasure()")); $measure_unit->setMultiOptions($options); $this->addElement($measure_unit); $uom = new Zend_Form_Element_Text('uom'); //uom = unit of measure $uom->setAttribs(array('class' => 'validate[custom[number]', "style" => "width:initial;", "size" => "4", 'readonly' => 'readonly')); $uom->setValue(1); $this->addElement($uom); $qty_perunit = new Zend_Form_Element_Text('qty_perunit'); //uom = unit of measure $qty_perunit->setAttribs(array('class' => 'validate[required[custom[number]]]', 'placeholder' => $tr->translate("QTY_PERUNIT"), "style" => "width:initial;", "size" => "4")); $this->addElement($qty_perunit); $label_perunit = new Zend_Form_Element_Text('label_perunit'); //uom = unit of measure $label_perunit->setAttribs(array('class' => 'validate[required]', 'placeholder' => $tr->translate("LABEL_UNIT"), "style" => "width:initial;", "size" => "10")); $this->addElement($label_perunit); $itemImageElement = new Zend_Form_Element_File('photo'); $this->addElement($itemImageElement); // $costingMethodElement = new Zend_Form_Element_Select('costingmethod'); // $costingMethodElement->setMultiOptions(array(1=>$tr->translate("Manual"), 2=>$tr->translate("Moving Average"),3=>$tr->translate("Last Purchase"))); // $this->addElement($costingMethodElement); $remarkElement = new Zend_Form_Element_Textarea('remark'); $this->addElement($remarkElement); $status = new Zend_Form_Element_Radio('status'); $status->setMultiOptions(array(1 => $tr->translate("ALL"), 2 => $tr->translate("IS_PURCHASE"), 3 => $tr->translate("IS_SALES"), 4 => $tr->translate("ALL_NONE"))); $status->setValue(1); $this->addElement($status); $rssetting = $db->getSetting(); $unit_sale_price = new Zend_Form_Element_Text('unit_sale_price'); if ($rssetting[0]['key_value'] == 1) { //if set default salse price $unit_sale_price = new Zend_Form_Element_Text('unit_sale_price'); $unit_sale_price->setLabel("Unit Sale Price"); $unit_sale_price->setAttribs(array('class' => 'validate[required[custom[number]]]')); } else { $unit_sale_price = new Zend_Form_Element_Hidden('unit_sale_price'); $unit_sale_price->setLabel(""); } $this->addElement($unit_sale_price); //echo $rs['key_valu']; if (!$data == null) { $idElement = new Zend_Form_Element_Hidden('id'); $this->addElement($idElement); $idElement->setValue($data['pro_id']); $itemImageElement->setValue($data['photo']); $codeElement->setValue($data['item_code']); $categoryElement->setValue($data['cate_id']); $branchElement->setValue($data['brand_id']); $measure_unit->setValue($data['measure_id']); $qty_perunit->setValue($data['qty_perunit']); $label_perunit->setValue($data['label']); $nameElement->setValue($data['item_name']); $typeElement->setValue($data['stock_type']); $remarkElement->setValue($data['remark']); $unit_sale_price->setValue($data['unit_sale_price']); } return $this; }
/** * @group ZF-9689 */ public function testRenderWithListSeparatorForRadio() { require_once 'Zend/Form/Element/Radio.php'; $element = new Zend_Form_Element_Radio('foo'); $options = array('foo' => 'Foo', 'bar' => 'Bar'); $element->setMultiOptions($options); $element->setSeparator('</p><p>'); $element->setDecorators(array(array('ViewHelper', array('separator' => '')), array('HtmlTag', array('tag' => 'p')))); $expected = '<p><label><input type="radio" name="foo" id="foo-foo" value="foo">Foo</label></p>' . '<p><label><input type="radio" name="foo" id="foo-bar" value="bar">Bar</label></p>'; $actual = $element->render($this->getView()); $this->assertEquals($expected, $actual); }
public function PurchaseOrder($data = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $request = Zend_Controller_Front::getInstance()->getRequest(); $db = new Application_Model_DbTable_DbGlobal(); $paymentElement = new Zend_Form_Element_Submit('payment'); $paymentElement->setAttribs(array('Phone' => 'Phone')); $this->addElement($paymentElement); $rs = $db->getGlobalDb('SELECT customer_id, cust_name FROM tb_customer WHERE cust_name!="" AND is_active=1 '); $customerValue = $request->getParam('users'); $options = ""; $options = array('' => $tr->translate('Please_Select'), '-1' => $tr->translate('ADD_CUSTOMER_ORDER')); if (!empty($rs)) { foreach ($rs as $read) { $options[$read['customer_id']] = $read['cust_name']; } } $customerID = new Zend_Form_Element_Select('customer_id'); $customerID->setAttribs(array('id' => 'customer_id', 'Onchange' => 'getCustomerInfo()', 'class' => 'validate[required]')); $customerID->setMultiOptions($options); //$customerID->setattribs(array(id'=>'customer_id','onchange'=>'this.form.submit()',)); $customerID->setValue($customerValue); $this->addElement($customerID); $orderElement = new Zend_Form_Element_Text('order'); $orderElement->setAttribs(array('placeholder' => 'Optional')); $this->addElement($orderElement); $phoneElement = new Zend_Form_Element_Text('txt_phone'); $phoneElement->setAttribs(array('placeholder' => 'Enter Contact Number')); $this->addElement($phoneElement); $user = $this->GetuserInfo(); $options = ""; $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' AND status = 1 "; if ($user["level"] == 1 or $user["level"] == 2) { $options = array("1" => $tr->translate("Please_Select"), "-1" => $tr->translate("ADD_NEW_LOCATION")); } else { $sql .= " ANd LocationId = " . $user["location_id"]; } $sql .= " ORDER BY LocationId DESC"; $rs = $db->getGlobalDb($sql); $productValue = $request->getParam('LocationId'); if (!empty($rs)) { foreach ($rs as $read) { $options[$read['LocationId']] = $read['Name']; } } $locationID = new Zend_Form_Element_Select('LocationId'); $locationID->setAttribs(array('id' => 'LocationId', 'Onchange' => 'AddLocation()', 'class' => 'validate[required]')); $locationID->setMultiOptions($options); $locationID->setValue($productValue); $this->addElement($locationID); $rowsmethodpay = $db->getGlobalDb('SELECT * FROM tb_paymentmethod'); if ($rowsmethodpay) { foreach ($rowsmethodpay as $readCategory) { $option_method[$readCategory['payment_typeId']] = $readCategory['payment_name']; } } $paymentmethodElement = new Zend_Form_Element_Select('payment_name'); $paymentmethodElement->setMultiOptions($option_method); $this->addElement($paymentmethodElement); $rowsPayment = $db->getGlobalDb('SELECT CurrencyId, Description,Symbol FROM tb_currency'); if ($rowsPayment) { foreach ($rowsPayment as $readPayment) { $options_curr[$readPayment['CurrencyId']] = $readPayment['Description'] . $readPayment['Symbol']; } } $currencyElement = new Zend_Form_Element_Select('currency'); $currencyElement->setMultiOptions($options_curr); $this->addElement($currencyElement); $descriptionElement = new Zend_Form_Element_Textarea('remark'); $this->addElement($descriptionElement); $remarkaddElement = new Zend_Form_Element_Textarea('remark_add'); $this->addElement($remarkaddElement); $allTotalElement = new Zend_Form_Element_Text('all_total'); $allTotalElement->setAttribs(array('readonly' => 'readonly')); $this->addElement($allTotalElement); $discountTypeElement = new Zend_Form_Element_Radio('discount_type'); $discountTypeElement->setMultiOptions(array(1 => '%', 2 => 'Fix Value')); $discountTypeElement->setAttribs(array('checked' => 'checked')); $discountTypeElement->setAttribs(array('onChange' => 'doTotal()')); $this->addElement($discountTypeElement); $netTotalElement = new Zend_Form_Element_Text('net_total'); $netTotalElement->setAttribs(array('readonly' => 'readonly')); $this->addElement($netTotalElement); $discountValueElement = new Zend_Form_Element_Text('discount_value'); $discountValueElement->setAttribs(array('class' => 'input100px', 'onChange' => 'doTotal()')); $this->addElement($discountValueElement); $discountRealElement = new Zend_Form_Element_Text('discount_real'); $discountRealElement->setAttribs(array('readonly' => 'readonly', 'class' => 'input100px')); $this->addElement($discountRealElement); $discountValueElement = new Zend_Form_Element_Text('discount_value'); $discountValueElement->setAttribs(array('class' => 'input100px', 'onChange' => 'doTotal()')); $this->addElement($discountValueElement); $paidRealElement = new Zend_Form_Element_Text('paid'); $paidRealElement->setAttribs(array('class' => 'input100px', 'onChange' => 'Total1()')); $this->addElement($paidRealElement); $remainlElement = new Zend_Form_Element_Text('remain'); $remainlElement->setAttribs(array('readonly' => 'readonly')); $this->addElement($remainlElement); $statusElement = new Zend_Form_Element_Select('status'); //$statusElement->setAttribs(array('readonly'=>'readonly',)); //$statusElement->setValue("Open"); $opt = array("" => $tr->translate('Please_Select'), 1 => $tr->translate("Qoute"), 2 => $tr->translate("Open"), 3 => $tr->translate("In Progress"), 5 => $tr->translate("Paid"), 6 => $tr->translate("Cancell")); $statusElement->setMultiOptions($opt); $this->addElement($statusElement); $statusquoteElement = new Zend_Form_Element_Text('quote'); $statusquoteElement->setAttribs(array('readonly' => 'readonly')); $statusquoteElement->setValue("Quote"); $this->addElement($statusquoteElement); $date = new Zend_Date(); $dateOrderElement = new Zend_Form_Element_Text('order_date'); $dateOrderElement->setAttribs(array('placeholder' => 'Click To Choose Date', 'class' => 'validate[required]')); $dateOrderElement->setValue($date->get('YYYY-MM-dd')); $this->addElement($dateOrderElement); $contactElement = new Zend_Form_Element_Text('contact'); $contactElement->setAttribs(array('placeholder' => 'Enter Contace Name')); $this->addElement($contactElement); $addressElement = new Zend_Form_Element_Text('address'); $this->addElement($addressElement); $termElement = new Zend_Form_Element_Text('term'); $termElement->setAttribs(array('class' => 'validate[required]')); $this->addElement($termElement); $branchElement = new Zend_Form_Element_Text('branch'); $branchElement->setAttribs(array('class' => 'validate[required]')); $this->addElement($branchElement); $orderidElement = new Zend_Form_Element_Text('orderid'); $this->addElement($orderidElement); $dateElement = new Zend_Form_Element_Text('date'); $this->addElement($dateElement); // $salesElement = new Zend_Form_Element_Text('sales_ref'); // $this->addElement($salesElement); // $rowsagent= $db->getGlobalDb('SELECT agent_id,name FROM tb_sale_agent ORDER BY agent_id DESC'); // $option_agent=array(''=>'Please Select','-1'=>'Add New Sale Agent'); // if($rowsagent) { // foreach($rowsagent as $read_agent) $option_agent[$read_agent['agent_id']]=$read_agent['name']; // } // $sales_agentElement = new Zend_Form_Element_Select('sales_ref'); // $sales_agentElement->setMultiOptions($option_agent); // $sales_agentElement->setAttribs(array('Onchange'=>'showAgentPopup()')); // $this->addElement($sales_agentElement); $option = ""; $sql = "SELECT agent_id,name FROM tb_sale_agent WHERE name!='' "; $option = array("" => $tr->translate("Please_Select"), "-1" => $tr->translate("Add_New_Sale_Agent")); if ($user["level"] == 1 or $user["level"] == 2) { //$option=array(""=>"Please Select","-1"=>"Add New Sale Agent"); } else { //$option=array(""=>"Please Select"); //$sql.=" AND agent_id =".$user["location_id"]; } $sql .= " ORDER BY agent_id DESC"; $rs = $db->getGlobalDb($sql); $agent_value = $request->getParam('sales_ref'); if (!empty($rs)) { foreach ($rs as $read) { $option[$read['agent_id']] = $read['name']; } } $sales_agentId = new Zend_Form_Element_Select('sales_ref'); $sales_agentId->setAttribs(array('class' => 'validate[required]', 'id' => 'sales_ref', 'Onchange' => 'showAgentPopup()')); $sales_agentId->setMultiOptions($option); $sales_agentId->setValue($agent_value); $this->addElement($sales_agentId); $reqDateElement = new Zend_Form_Element_Text('rs-date'); $this->addElement($reqDateElement); $remarkElement = new Zend_Form_Element_Textarea('remark'); $this->addElement($remarkElement); $type_tax1Element = new Zend_Form_Element_Text('type-tax1'); $this->addElement($type_tax1Element); $type_tax2Element = new Zend_Form_Element_Text('type-tax2'); $this->addElement($type_tax2Element); $totalElement = new Zend_Form_Element_Text('total'); $this->addElement($totalElement); $paidElement = new Zend_Form_Element_Text('paid'); $paidElement->setAttribs(array('onChange' => 'doRemain()')); $this->addElement($paidElement); $historyElement = new Zend_Form_Element_Text('history_id'); $this->addElement($historyElement); Application_Form_DateTimePicker::addDateField(array('order_date', 'offer_date', 'paid_date')); if ($data != null) { $idElement = new Zend_Form_Element_Hidden('id'); $this->addElement($idElement); $idElement->setValue($data["order_id"]); $oldlocationIdElement = new Zend_Form_Element_Hidden('old_location'); $this->addElement($oldlocationIdElement); $oldStatusElement = new Zend_Form_Element_Hidden('oldStatus'); $this->addElement($oldStatusElement); $customerID->setValue($data["customer_id"]); $contactElement->setValue($data['contact_name']); $phoneElement->setValue($data['phone']); $remarkaddElement->setValue($data['add_name']); if ($data["status"] == 1) { $statusElement->setValue("Quote"); } elseif ($data["status"] == 2) { $statusElement->setValue("Open"); } elseif ($data["status"] == 3) { $statusElement->setValue("In Progress"); } elseif ($data["status"] == 4) { $statusElement->setValue("Paid"); } else { $statusElement->setValue("Cancel"); } //$idElement->setValue($data['id']); $oldStatusElement->setValue($data['status']); $sales_agentId->setValue($data['sales_ref']); $locationID->setvalue($data['LocationId']); $oldlocationIdElement->setvalue($data['LocationId']); $dateOrderElement->setValue($data["date_order"]); $orderElement->setAttribs(array("readonly" => "readonly")); $orderElement->setValue($data['order']); $paymentmethodElement->setValue($data['payment_method']); $currencyElement->setValue($data['currency_id']); $remarkElement->setValue($data["remark"]); $paidElement->setValue($data['paid']); $remainlElement->setvalue($data['balance']); $allTotalElement->setValue($data['all_total']); $discountValueElement->setValue($data['discount_value']); $netTotalElement->setValue($data['net_total']); } else { $discountTypeElement->setValue(1); } return $this; }
public function init() { $this->setMethod("post"); // produto_nome $produto_nome = new Zend_Form_Element_Text("produto_nome"); $produto_nome->setLabel("Nome"); $produto_nome->setRequired(); $produto_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do produto')); $produto_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // produto_id $produto_id = new Zend_Form_Element_Hidden("produto_id"); // fabricante_nome $fabricante_nome = new Zend_Form_Element_Text("fabricante_nome"); $fabricante_nome->setLabel("Fabricante"); //$fabricante_nome->setRequired(); $fabricante_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do fabricante')); $fabricante_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // fabricante_id $fabricante_id = new Zend_Form_Element_Hidden("fabricante_id"); // marca_nome $marca_nome = new Zend_Form_Element_Text("marca_nome"); $marca_nome->setLabel("Marca"); $marca_nome->setRequired(); $marca_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome da marca')); $marca_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // marca_id $marca_id = new Zend_Form_Element_Hidden("marca_id"); // reclamacao_nome $reclamacao_nome = new Zend_Form_Element_Text("reclamacao_nome"); $reclamacao_nome->setLabel("Nome"); $reclamacao_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu nome')); // reclamacap_email $reclamacao_email = new Zend_Form_Element_Text("reclamacao_email"); $reclamacao_email->setLabel("E-mail"); $reclamacao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); // reclamacao_empresa $reclamacao_empresa = new Zend_Form_Element_Text("reclamacao_empresa"); $reclamacao_empresa->setLabel("Empresa onde comprou o produto"); $reclamacao_empresa->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); // reclamacao_cidade $reclamacao_cidade = new Zend_Form_Element_Text("reclamacao_cidade"); $reclamacao_cidade->setLabel("Cidade"); $reclamacao_cidade->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua cidade')); // reclamacao_estado $reclamacao_estado = new Zend_Form_Element_Select("reclamacao_estado"); $reclamacao_estado->setLabel("Estado"); $reclamacao_estado->setAttribs(array('class' => 'form-control')); $reclamacao_estado->setMultiOptions($this->getEstados()); // reclamacao_descricao $reclamacao_descricao = new Zend_Form_Element_Textarea("reclamacao_descricao"); $reclamacao_descricao->setLabel("Descreva sua reclamação"); $reclamacao_descricao->setRequired(); $reclamacao_descricao->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $reclamacao_descricao->setAttribs(array('class' => 'form-control', 'rows' => 5, 'placeholder' => 'Informe porque você está insatisfeito com o produto', 'maxlenght' => 500)); $reclamacao_descricao->addValidator(new App_Validate_Reclamacao()); // reclamacao_nota $reclamacao_nota = new Zend_Form_Element_Radio("reclamacao_nota"); $reclamacao_nota->setLabel("Dê sua nota para o produto"); $reclamacao_nota->setRequired(); $reclamacao_nota->setAttribs(array('class' => '')); $reclamacao_nota->setMultiOptions($this->getNotasHtml()); $reclamacao_nota->setOptions(array('escape' => false)); $reclamacao_nota->setSeparator(" "); $reclamacao_nota->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // submit $submit = new Zend_Form_Element_Submit("submit"); $submit->setLabel("Registrar Reclamação"); $submit->setAttrib("class", 'form-control btn btn-success'); $this->addElements(array($produto_nome, $fabricante_nome, $marca_nome, $reclamacao_descricao, $reclamacao_nome, $reclamacao_email, $reclamacao_cidade, $reclamacao_estado, $reclamacao_nota, $submit, $produto_id, $marca_id, $fabricante_id)); }