Пример #1
0
 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);
 }
Пример #2
0
 public function init()
 {
     // profissional_beleza_id
     $profissional_beleza_id = new Zend_Form_Element_Radio("profissional_beleza_id");
     $profissional_beleza_id->setLabel("Selecione o profissional desejado: ");
     $profissional_beleza_id->setRegisterInArrayValidator(false);
     $profissional_beleza_id->setRequired();
     $profissional_beleza_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     // agenda_data
     $agenda_data = new Zend_Form_Element_Text("agenda_data");
     $agenda_data->setLabel("Selecione a data: ");
     $agenda_data->setAttribs(array('class' => 'form-control', 'autocomplete' => 'off'));
     $agenda_data->setRequired();
     $agenda_data->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // agenda_hora
     $agenda_hora = new Zend_Form_Element_Select("agenda_hora");
     $agenda_hora->setLabel('Selecione a hora: ');
     $agenda_hora->setAttribs(array('class' => 'form-control'));
     $agenda_hora->setMultiOptions(array('' => 'Horários'));
     $agenda_hora->setRequired();
     $agenda_hora->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     $agenda_hora->setRegisterInArrayValidator(false);
     // agenda_observacao
     $agenda_observacao = new Zend_Form_Element_Textarea("agenda_observacao");
     $agenda_observacao->setLabel("Observações: ");
     $agenda_observacao->setAttribs(array('class' => 'form-control', 'rows' => 7, 'placeholder' => 'Informe alguma observação, por exemplo, alguma preferência de produto, etc.'));
     // salao_id
     $salao_id = new Zend_Form_Element_Hidden('salao_id');
     // especialidade_id
     $especialidade_id = new Zend_Form_Element_Hidden("especialidade_id");
     // usuario_id
     $usuario_id = new Zend_Form_Element_Hidden("usuario_id");
     $this->addElements(array($profissional_beleza_id, $agenda_data, $agenda_hora, $agenda_observacao, $salao_id, $especialidade_id, $usuario_id));
     parent::init();
 }
Пример #3
0
 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);
 }
Пример #4
0
 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 getForm()
 {
     $elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
     $form = new Zend_Form();
     $form->setAction('/student/profile/feedback/')->setMethod('post');
     $improvement = new Zend_Form_Element_Radio('improvement', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'Yes', 'No' => 'No')));
     $improvement->setDecorators($elementDecorators);
     $level = new Zend_Form_Element_Radio('level', array('label' => '', 'separator' => '', 'multiOptions' => array('Hard' => 'Hard', 'Suitable' => 'Suitable', 'Easy' => 'Easy')));
     $level->setAttrib('class', 'radio_new');
     $level->setDecorators($elementDecorators);
     $difficult = new Zend_Form_Element_Text('difficult', array('id' => 'difficult', 'maxLength' => '50'));
     $difficult->setDecorators($elementDecorators);
     $difficult->setAttrib('class', 'sub_text_input');
     $suggestions = new Zend_Form_Element_Textarea('suggestions', array('label' => '?האם חווית בעיה בתרגול', 'id' => 'suggestions'));
     $suggestions->setAttrib('class', 'sub_textarea');
     $sendFeedback = new Zend_Form_Element_Button('sendfeedback', array('id' => 'sendfeedback', 'label' => 'ds'));
     $sendFeedback->setAttrib('class', 'sub_button_input');
     $sendFeedback->setDecorators($elementDecorators);
     $form->addElements(array($improvement, $level, $difficult, $suggestions));
     return $form;
 }
Пример #8
0
 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);
 }
Пример #9
0
 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);
 }
Пример #10
0
 /**
  * @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);
 }
Пример #11
0
 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));
 }
 public function getForm($data, $protection = 0)
 {
     $elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
     $form = new Zend_Form();
     $form->setAction('/user/registration/first-form/')->setMethod('post');
     //firstname field
     $firstName = new Zend_Form_Element_Text('firstname', array('maxLength' => '30', 'id' => 'name', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
     if (isset($data['u_name'])) {
         $firstName->setValue($data['u_name']);
     }
     if ($protection) {
         $firstName->setAttrib('readonly', 'true');
     }
     $firstName->setDecorators($elementDecorators);
     //lastname field
     $lastName = new Zend_Form_Element_Text('lastname', array('maxLength' => '30', 'id' => 'lname', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
     $lastName->setDecorators($elementDecorators);
     if (isset($data['u_family_name'])) {
         $lastName->setValue($data['u_family_name']);
     }
     if ($protection) {
         $lastName->setAttrib('readonly', 'true');
     }
     //selecting gender: Male (1) or Female (0)
     $gender = new Zend_Form_Element_Radio('sex', array('separator' => '', 'multiOptions' => array('1' => 'זכר ', '0' => 'נקבה')));
     $gender->setDecorators($elementDecorators);
     $gender->setValue($data['u_sex_id']);
     if (isset($data['u_sex_id'])) {
         $gender->setValue($data['u_sex_id']);
     }
     if ($protection) {
         $gender->setAttrib('readonly', 'true');
     }
     //birthday field: validation for yyyy-mm-dd input
     $birthday = new Zend_Form_Element_Text('datepicker', array('size' => 10));
     $birthday->setDecorators($elementDecorators);
     if (isset($data['u_date_of_birth'])) {
         $birthday->setValue(date("d/m/Y", strtotime($data['u_date_of_birth'])));
     }
     if ($protection) {
         $birthday->setAttrib('readonly', 'true');
     }
     //heigth
     $heigth = new Zend_Form_Element_Select('heigth', array());
     for ($i = 120; $i <= 300; $i++) {
         $heigth->addMultiOption($i, $i);
     }
     $heigth->setDecorators($elementDecorators);
     if (isset($data['uht_height'])) {
         $heigth->setValue($data['uht_height']);
     }
     if ($protection) {
         $heigth->setAttrib('disabled', 'true');
     }
     //weight
     $weight = new Zend_Form_Element_Select('weight', array('label' => ''));
     for ($i = 20; $i <= 300; $i++) {
         $weight->addMultiOption($i, $i);
     }
     $weight->setDecorators($elementDecorators);
     if (isset($data['uht_weight'])) {
         $weight->setValue($data['uht_weight']);
     }
     //email field with validation
     $email = new Zend_Form_Element_Text('email', array());
     $email->addValidator(new Zend_Validate_EmailAddress());
     $email->setDecorators($elementDecorators);
     if (isset($data['u_email'])) {
         $email->setValue($data['u_email']);
     }
     if ($protection) {
         $email->setAttrib('readonly', 'true');
     }
     // password field
     $password1 = new Zend_Form_Element_Password('password1', array('id' => 'pass'));
     $password1->setDecorators($elementDecorators);
     // password confirmation field
     $password2 = new Zend_Form_Element_Password('password2', array('id' => 'c_pass'));
     $password2->addValidator(new User_Form_UserFirstFormPasswordValidator('password1'));
     $password2->setDecorators($elementDecorators);
     $state = new Zend_Form_Element_Select('state', array('requred' => true));
     $state->setMultiOptions(array('1' => 'מדינה:'));
     $state->setDecorators($elementDecorators);
     if (isset($data['u_state'])) {
         $state->setValue($data['u_state']);
     }
     $address = new Zend_Form_Element_Text('address', array('required' => false, 'id' => 'full_adr'));
     $address->setDecorators($elementDecorators);
     if (isset($data['u_address'])) {
         $address->setValue($data['u_address']);
     }
     $pregnant = new Zend_Form_Element_Radio('pregnant', array('separator' => '', 'multioptions' => array('Yes' => 'לא', 'No' => 'כן')));
     $pregnant->setDecorators($elementDecorators);
     if ($data['uht_pregnant']) {
         $pregnant->setValue($data['uht_pregnant']);
     }
     $pregnantSince = new Zend_Form_Element_Select('pregnantsince', array('id' => 'hz1'));
     $pregnantSince->setMultiOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9'));
     $pregnantSince->setDecorators($elementDecorators);
     if ($data['uht_pregnant']) {
         $pregnant->setValue($data['uht_pregnant']);
     }
     if ($data['uht_pregnant_since']) {
         $pregnantSince->setValue($data['uht_pregnant_since']);
     }
     $objectives = new Zend_Form_Element_Textarea('objectives', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     if ($data['u_objectives']) {
         $objectives->setValue($data['u_objectives']);
     }
     $terms = new Zend_Form_Element_Checkbox('terms', array('required' => 'true,'));
     $heartPressure = new Zend_Form_Element_Checkbox('heartpressure', array());
     $heartPressure->setDecorators($elementDecorators);
     if ($data['uht_heart_or_pb']) {
         $heartPressure->setChecked(true);
     }
     $diabetes = new Zend_Form_Element_Checkbox('diabetes', array());
     $diabetes->setDecorators($elementDecorators);
     if ($data['uht_diabetes']) {
         $diabetes->setChecked(true);
     }
     $migrene = new Zend_Form_Element_Checkbox('migrene', array());
     $migrene->setDecorators($elementDecorators);
     if ($data['uht_migrene']) {
         $migrene->setChecked(true);
     }
     $babies = new Zend_Form_Element_Checkbox('babies', array());
     $babies->setDecorators($elementDecorators);
     if ($data['uht_babies']) {
         $babies->setChecked(true);
     }
     $nosleep = new Zend_Form_Element_Checkbox('nosleep', array());
     $nosleep->setDecorators($elementDecorators);
     if ($data['uht_nosleep']) {
         $nosleep->setChecked(true);
     }
     $digestion = new Zend_Form_Element_Checkbox('digestion', array());
     $digestion->setDecorators($elementDecorators);
     if ($data['uht_digestion']) {
         $digestion->setChecked(true);
     }
     $menopause = new Zend_Form_Element_Checkbox('menopause', array());
     $menopause->setDecorators($elementDecorators);
     if ($data['uht_menopause']) {
         $menopause->setChecked(true);
     }
     $sclorosies = new Zend_Form_Element_Checkbox('sclorosies', array());
     $sclorosies->setDecorators($elementDecorators);
     if ($data['uht_sclorosies']) {
         $sclorosies->setChecked(true);
     }
     $epilepsy = new Zend_Form_Element_Checkbox('epilepsy', array());
     $epilepsy->setDecorators($elementDecorators);
     if ($data['uht_epilepsy']) {
         $epilepsy->setChecked(true);
     }
     $cancer = new Zend_Form_Element_Checkbox('cancer', array());
     $cancer->setDecorators($elementDecorators);
     if ($data['uht_cancer']) {
         $cancer->setChecked(true);
     }
     $asthma = new Zend_Form_Element_Checkbox('asthma', array());
     $asthma->setDecorators($elementDecorators);
     if ($data['uht_asthma']) {
         $asthma->setChecked(true);
     }
     $artritis = new Zend_Form_Element_Checkbox('artritis', array());
     $artritis->setDecorators($elementDecorators);
     if ($data['uht_Artritis']) {
         $artritis->setChecked(true);
     }
     $hernia = new Zend_Form_Element_Checkbox('hernia', array());
     $hernia->setDecorators($elementDecorators);
     if ($data['uht_hernia']) {
         $hernia->setChecked(true);
     }
     $depression = new Zend_Form_Element_Checkbox('depression', array());
     $depression->setDecorators($elementDecorators);
     if ($data['uht_depression_or_anxiety']) {
         $depression->setChecked(true);
     }
     $headaches = new Zend_Form_Element_Checkbox('headaches', array());
     $headaches->setDecorators($elementDecorators);
     if ($data['uht_headaches']) {
         $headaches->setChecked(true);
     }
     $fatigue = new Zend_Form_Element_Checkbox('fatigue', array());
     $fatigue->setDecorators($elementDecorators);
     if ($data['uht_fatigue']) {
         $fatigue->setChecked(true);
     }
     $injury = new Zend_Form_Element_Checkbox('injury', array());
     $injury->setDecorators($elementDecorators);
     if ($data['uht_injury']) {
         $injury->setChecked(true);
     }
     $injuryText = new Zend_Form_Element_Textarea('injurytext', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     if ($data['uht_injury_text']) {
         $injuryText->setValue($data['uht_injury_text']);
     }
     $medication = new Zend_Form_Element_Checkbox('medication', array());
     $medication->setDecorators($elementDecorators);
     if ($data['uht_medication']) {
         $medication->setChecked(true);
     }
     $medicationText = new Zend_Form_Element_Textarea('medicationtext', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     if ($data['uht_which_medication']) {
         $medicationText->setValue($data['uht_which_medication']);
     }
     $walk = new Zend_Form_Element_Radio('walk', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     if ($data['uht_walk']) {
         $walk->setValue($data['uht_walk']);
     }
     $walk->setDecorators($elementDecorators);
     $hands = new Zend_Form_Element_Radio('hands', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     if ($data['uht_hands']) {
         $hands->setValue($data['uht_hands']);
     }
     $hands->setDecorators($elementDecorators);
     $legs = new Zend_Form_Element_Radio('legs', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     if ($data['uht_sit']) {
         $legs->setValue($data['uht_sit']);
     }
     $legs->setDecorators($elementDecorators);
     $backashes = new Zend_Form_Element_Radio('backashes', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     if ($data['uht_backashes']) {
         $backashes->setValue($data['uht_backashes']);
     }
     $backashes->setDecorators($elementDecorators);
     if ($protection) {
         $backashes->setAttrib('disabled', 'true');
     }
     $slippedDisk = new Zend_Form_Element_Radio('disc', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     if ($protection) {
         $slippedDisk->setAttrib('disabled', 'true');
     }
     if ($data['uht_slipped_disk']) {
         $slippedDisk->setValue($data['uht_slipped_disk']);
     }
     $slippedDisk->setDecorators($elementDecorators);
     $generalQuestionsText1 = new Zend_Form_Element_Text('general1', array('id' => 'f_1'));
     $generalQuestionsText2 = new Zend_Form_Element_Text('general2', array('id' => 'f_2'));
     $generalQuestionsText3 = new Zend_Form_Element_Text('general3', array('id' => 'f_3'));
     $generalQuestionsText1->setDecorators($elementDecorators);
     if ($protection) {
         $generalQuestionsText1->setAttrib('readonly', 'true');
         $generalQuestionsText2->setAttrib('readonly', 'true');
         $generalQuestionsText3->setAttrib('readonly', 'true');
     }
     $generalQuestionsText2->setDecorators($elementDecorators);
     $generalQuestionsText3->setDecorators($elementDecorators);
     if (isset($data['uht_general1'])) {
         $generalQuestionsText1->setValue($data['uht_general1']);
     }
     if (isset($data['uht_general2'])) {
         $generalQuestionsText2->setValue($data['uht_general2']);
     }
     if (isset($data['uht_general3'])) {
         $generalQuestionsText3->setValue($data['uht_general3']);
     }
     $lowerback = new Zend_Form_Element_Checkbox('lowerback', array());
     $lowerback->setDecorators($elementDecorators);
     if ($data['uht_lower_back']) {
         $lowerback->setChecked(true);
     }
     $upperback = new Zend_Form_Element_Checkbox('upperback', array());
     $upperback->setDecorators($elementDecorators);
     if ($data['uht_upper_back']) {
         $upperback->setChecked(true);
     }
     $feet = new Zend_Form_Element_Checkbox('feet', array());
     $feet->setDecorators($elementDecorators);
     if ($data['uht_ankles_and_feet']) {
         $feet->setChecked(true);
     }
     $neck = new Zend_Form_Element_Checkbox('neck', array());
     $neck->setDecorators($elementDecorators);
     if ($data['uht_neck_and_shoulders']) {
         $neck->setChecked(true);
     }
     $breath = new Zend_Form_Element_Checkbox('breath', array());
     $breath->setDecorators($elementDecorators);
     if ($data['uht_breath']) {
         $breath->setChecked(true);
     }
     $pelvis = new Zend_Form_Element_Checkbox('pelvis', array());
     $pelvis->setDecorators($elementDecorators);
     if ($data['uht_thighs_or_pelvis']) {
         $pelvis->setChecked(true);
     }
     $knees = new Zend_Form_Element_Checkbox('knees', array());
     $knees->setDecorators($elementDecorators);
     if ($data['uht_thighs_or_pelvis']) {
         $knees->setChecked(true);
     }
     $wrists = new Zend_Form_Element_Checkbox('wrists', array());
     $wrists->setDecorators($elementDecorators);
     if ($data['uht_wrists']) {
         $wrists->setChecked(true);
     }
     $head = new Zend_Form_Element_Checkbox('head', array());
     $head->setDecorators($elementDecorators);
     if ($data['uht_head']) {
         $head->setChecked(true);
     }
     $ankles = new Zend_Form_Element_Checkbox('ankles', array());
     $ankles->setDecorators($elementDecorators);
     if ($data['uht_ankles']) {
         $ankles->setChecked(true);
     }
     $externalMails = new Zend_Form_Element_Checkbox('external', array());
     $externalMails->setDecorators($elementDecorators);
     if ($data['u_external_emails']) {
         $externalMails->setChecked(true);
     }
     $moreInfo = new Zend_Form_Element_Textarea('moreinfo', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     if ($data['uht_more_info']) {
         $moreInfo->setValue($data['uht_more_info']);
     }
     $form->addElements(array($firstName, $lastName, $gender, $birthday, $heigth, $weight, $email, $password1, $password2, $state, $address, $pregnant, $pregnantSince, $objectives, $terms, $heartPressure, $diabetes, $migrene, $babies, $nosleep, $digestion, $menopause, $sclorosies, $epilepsy, $cancer, $asthma, $artritis, $hernia, $depression, $fatigue, $headaches, $injury, $injuryText, $medication, $medicationText, $walk, $hands, $legs, $backashes, $slippedDisk, $generalQuestionsText1, $generalQuestionsText2, $generalQuestionsText3, $lowerback, $upperback, $feet, $neck, $breath, $pelvis, $knees, $wrists, $head, $ankles, $moreInfo, $externalMails));
     return $form;
 }
Пример #13
0
 public function init()
 {
     $elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
     //setting  method and action of the form
     $this->setAction('')->setMethod('post');
     $heartPressure = new Zend_Form_Element_Checkbox('heartpressure', array());
     $heartPressure->setDecorators($elementDecorators);
     $diabetes = new Zend_Form_Element_Checkbox('diabetes', array());
     $diabetes->setDecorators($elementDecorators);
     $migrene = new Zend_Form_Element_Checkbox('migrene', array());
     $migrene->setDecorators($elementDecorators);
     $babies = new Zend_Form_Element_Checkbox('babies', array());
     $babies->setDecorators($elementDecorators);
     $nosleep = new Zend_Form_Element_Checkbox('nosleep', array());
     $nosleep->setDecorators($elementDecorators);
     $digestion = new Zend_Form_Element_Checkbox('digestion', array());
     $digestion->setDecorators($elementDecorators);
     $menopause = new Zend_Form_Element_Checkbox('menopause', array());
     $menopause->setDecorators($elementDecorators);
     $sclorosies = new Zend_Form_Element_Checkbox('sclorosies', array());
     $sclorosies->setDecorators($elementDecorators);
     $epilepsy = new Zend_Form_Element_Checkbox('epilepsy', array());
     $epilepsy->setDecorators($elementDecorators);
     $cancer = new Zend_Form_Element_Checkbox('cancer', array());
     $cancer->setDecorators($elementDecorators);
     $asthma = new Zend_Form_Element_Checkbox('asthma', array());
     $asthma->setDecorators($elementDecorators);
     $artritis = new Zend_Form_Element_Checkbox('artritis', array());
     $artritis->setDecorators($elementDecorators);
     $hernia = new Zend_Form_Element_Checkbox('hernia', array());
     $hernia->setDecorators($elementDecorators);
     $depression = new Zend_Form_Element_Checkbox('depression', array());
     $depression->setDecorators($elementDecorators);
     $headaches = new Zend_Form_Element_Checkbox('headaches', array());
     $headaches->setDecorators($elementDecorators);
     $fatigue = new Zend_Form_Element_Checkbox('fatigue', array());
     $fatigue->setDecorators($elementDecorators);
     $injury = new Zend_Form_Element_Checkbox('injury', array());
     $injury->setDecorators($elementDecorators);
     $injuryText = new Zend_Form_Element_Textarea('injurytext', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     $medication = new Zend_Form_Element_Checkbox('medication', array());
     $medication->setDecorators($elementDecorators);
     $medicationText = new Zend_Form_Element_Textarea('medicationtext', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     $walk = new Zend_Form_Element_Radio('walk', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $walk->setDecorators($elementDecorators);
     $hands = new Zend_Form_Element_Radio('hands', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $hands->setDecorators($elementDecorators);
     $legs = new Zend_Form_Element_Radio('legs', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $legs->setDecorators($elementDecorators);
     $backashes = new Zend_Form_Element_Radio('backashes', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $backashes->setDecorators($elementDecorators);
     $slippedDisk = new Zend_Form_Element_Radio('disc', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $slippedDisk->setDecorators($elementDecorators);
     $generalQuestionsText1 = new Zend_Form_Element_Text('general1', array('id' => 'f_1'));
     $generalQuestionsText2 = new Zend_Form_Element_Text('general2', array('id' => 'f_2'));
     $generalQuestionsText3 = new Zend_Form_Element_Text('general3', array('id' => 'f_3'));
     $generalQuestionsText1->setDecorators($elementDecorators);
     $generalQuestionsText2->setDecorators($elementDecorators);
     $generalQuestionsText3->setDecorators($elementDecorators);
     $lowerback = new Zend_Form_Element_Checkbox('lowerback', array());
     $lowerback->setDecorators($elementDecorators);
     $upperback = new Zend_Form_Element_Checkbox('upperback', array());
     $upperback->setDecorators($elementDecorators);
     $feet = new Zend_Form_Element_Checkbox('feet', array());
     $feet->setDecorators($elementDecorators);
     $neck = new Zend_Form_Element_Checkbox('neck', array());
     $neck->setDecorators($elementDecorators);
     $breath = new Zend_Form_Element_Checkbox('breath', array());
     $breath->setDecorators($elementDecorators);
     $pelvis = new Zend_Form_Element_Checkbox('pelvis', array());
     $pelvis->setDecorators($elementDecorators);
     $knees = new Zend_Form_Element_Checkbox('knees', array());
     $knees->setDecorators($elementDecorators);
     $wrists = new Zend_Form_Element_Checkbox('wrists', array());
     $wrists->setDecorators($elementDecorators);
     $head = new Zend_Form_Element_Checkbox('head', array());
     $head->setDecorators($elementDecorators);
     $ankles = new Zend_Form_Element_Checkbox('ankles', array());
     $ankles->setDecorators($elementDecorators);
     $externalMails = new Zend_Form_Element_Checkbox('external', array());
     $externalMails->setDecorators($elementDecorators);
     $moreInfo = new Zend_Form_Element_Textarea('moreinfo', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     $terms = new Zend_Form_Element_Checkbox('terms', array('label' => '', 'multiOptions' => array('Yes' => 'Yes')));
     $terms->setDecorators($this->elementCheckboxes);
     $terms->addDecorator('Label', array('escape' => false));
     $terms->addValidator(new User_Form_UserTermsConditionsValidator());
     $this->addElements(array($heartPressure, $diabetes, $migrene, $babies, $nosleep, $digestion, $menopause, $sclorosies, $epilepsy, $cancer, $asthma, $artritis, $hernia, $depression, $fatigue, $headaches, $injury, $injuryText, $medication, $medicationText, $walk, $hands, $legs, $backashes, $slippedDisk, $generalQuestionsText1, $generalQuestionsText2, $generalQuestionsText3, $lowerback, $upperback, $feet, $neck, $breath, $pelvis, $knees, $wrists, $head, $ankles, $moreInfo, $externalMails, $terms));
 }
Пример #14
0
 /**
  * Insert radio buttons to activate data copy if checked. <br />
  * Depending on the radio checked, the address used will be extracted from
  * the profile or from a temporary table or empty.
  *
  * @param Zend_Form_SubForm $addressSubForm The subForm containing the
  *                                          address fields to duplicate.
  * @param Array             $options        Options to defined the radio buttons.
  *
  * @return void
  */
 public function addressSource($addressSubForm, $options = array())
 {
     if ($addressSubForm instanceof Zend_Form_SubForm || $addressSubForm instanceof Cible_Form_SubForm) {
         $name = $this->_parentForm . $addressSubForm->getName();
         if (empty($name)) {
             throw new Exception('Please, set this subform name in order to add the checkbox to duplicate address.');
         }
         $addrSource = new Zend_Form_Element_Radio('addrSource');
         $addrSource->addMultiOptions($options['choices']);
         $addrSource->setValue($options['default']);
         $addrSource->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'addrSource label_after_checkbox'))));
         $this->_form->addElement($addrSource);
         $this->_addJsActions($name . '-addrSource', 'addrSource');
     } else {
         throw new Exception('The parameter is not an instance of Zend_Form_SubForm or Cible_form_SubForm');
     }
 }
Пример #15
0
 public function init()
 {
     //setting  method and action of the form
     $this->setAction('/user/registration/first-form/')->setAttrib('enctype', 'multipart/form-data')->setDecorators($this->formDecorators)->setMethod('post');
     //firstname field
     $firstName = new Zend_Form_Element_Text('firstname', array('required' => true, 'label' => 'שם פרטי:', 'maxLength' => '30', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
     $firstName->setDecorators($this->elementDecorators);
     //last- or familyname field
     $familyName = new Zend_Form_Element_Text('familyname', array('required' => true, 'label' => 'שם משפחה:', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
     $familyName->setDecorators($this->elementDecorators);
     // status field goes here
     /*
      * TODO
      */
     //selecting gender: Male (1) or Female (0)
     $gender = new Zend_Form_Element_Radio('sex', array('required' => true, 'label' => 'מין:', 'separator' => '', 'multiOptions' => array('1' => 'זכר ', '0' => 'נקבה')));
     $gender->setDecorators($this->elementDecorators);
     //birthday field: validation for yyyy-mm-dd input
     $birthday = new Zend_Form_Element_Text('datepicker', array('required' => true, 'label' => 'שנת לידה:', 'size' => 10));
     $birthday->setDecorators($this->elementDecorators);
     $birthday->addValidator(new Zend_Validate_Date());
     $weight = new Zend_Form_Element_Select('weight', array('label' => 'שקל'));
     for ($i = 20; $i <= 300; $i++) {
         $weight->addMultiOption($i, $i);
     }
     $weight->setDecorators($this->elementDecorators);
     $heigth = new Zend_Form_Element_Select('heigth', array('label' => 'גובה:'));
     for ($i = 120; $i <= 300; $i++) {
         $heigth->addMultiOption($i, $i);
     }
     $heigth->setDecorators($this->elementDecorators);
     //email field with validation
     $email = new Zend_Form_Element_Text('email', array('required' => true, 'size' => 50, 'label' => 'אימייל: '));
     $email->addValidator(new Zend_Validate_EmailAddress());
     $email->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'users', 'field' => 'u_email')));
     $email->setDecorators($this->elementDecorators);
     // password field
     $password1 = new Zend_Form_Element_Password('password1', array('required' => true, 'size' => 50, 'label' => 'סיסמא'));
     $password1->setDecorators($this->elementDecorators);
     // password confirmation field
     $password2 = new Zend_Form_Element_Password('password2', array('required' => true, 'size' => 50, 'label' => 'אימות סיסמא'));
     $password2->addValidator(new User_Form_UserFirstFormPasswordValidator('password1'));
     $password2->setDecorators($this->elementDecorators);
     $country_list = $this->getCountriesList();
     $state = new Zend_Form_Element_Select('state', array('requred' => true, 'label' => 'מדינה:'));
     $state->setMultiOptions(array($country_list));
     $state->setDecorators($this->elementDecorators);
     $address = new Zend_Form_Element_Text('address', array('required' => false, 'size' => 50, 'label' => 'כתובת מלאה:'));
     $address->setDecorators($this->elementDecorators);
     //selecting gender: Male (1) or Female (0)
     $pregnant = new Zend_Form_Element_Radio('pregnant', array('label' => 'לנשים: האם את בהריון?', 'separator' => '', 'multiOptions' => array('Yes' => 'Yes', 'No' => 'No')));
     $pregnant->setDecorators($this->elementDecorators);
     $pregnantSince = new Zend_Form_Element_Select('pregnantsince', array('label' => 'מספר חודשים שעברו מהלידה האחרונה:'));
     $pregnantSince->setMultiOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9'));
     $pregnantSince->setDecorators($this->elementDecorators);
     $objectives = new Zend_Form_Element_Textarea('objectives', array('label' => 'מהן המטרות שלך בתרגול איתנו?'));
     $terms = new Zend_Form_Element_Checkbox('terms', array('label' => "<a target='new' href='http://lc.tipulitonline.co.il/pages/takanon.html'>אישור הסכמה לתנאים וההגבלות</a>", 'required' => 'true,'));
     $terms->setDecorators($this->elementDecorators);
     $terms->addDecorator('Label', array('escape' => false));
     $terms->addValidator(new User_Form_UserTermsConditionsValidator());
     //submit the form
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('שלח ');
     $this->addElements(array($firstName, $familyName, $gender, $weight, $heigth, $birthday, $email, $password1, $password2, $state, $address, $pregnant, $pregnantSince, $objectives, $terms, $submit));
 }