Пример #1
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);
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $radioKind = new Zend_Form_Element_Radio('kind');
     $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
     $radioKind->setValue('and');
     $radioKind->setLabel('Search field combination:');
     $radioKind->setRequired(true);
     $this->addElement($radioKind);
     $fishSampleCode = new Zend_Form_Element_Text(Fish::COL_SAMPLE_CODE);
     $fishSampleCode->setLabel('Fish Sample Code:');
     //---------------------------------------------------------
     //read the available image attributes from attribute descriptor+group image
     $metadata = new Default_MetaData();
     $fishRowSetArray = $metadata->getAttributesComplete('fish');
     //----------------------------------------------------------
     $this->addDynamicElements($fishRowSetArray, true);
     $this->addElement($fishSampleCode);
     $this->addElement('submit', 'submit', array('label' => 'search'));
     $this->addElement('hidden', 'Token');
     $this->setElementFilters(array('StringTrim'));
     //#####################new###################################
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'dynamic_form')), array('Description', array('placement' => 'prepend')), 'Form'));
     $this->setElementDecorators(array('ViewHelper', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
     $this->setSubFormDecorators(array('FormElements', array('HtmlTag', array('tag' => 'tr'))));
     foreach ($this->getSubForms() as $index => $subform) {
         $subform->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
     }
     $this->submit->setDecorators(array(array('decorator' => 'ViewHelper', 'options' => array('helper' => 'formSubmit')), array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td', 'colspan' => 2)), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
     //###########################################################
 }
Пример #3
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);
 }
Пример #4
0
 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');
 }
Пример #5
0
 public function __construct($forSearch = false)
 {
     parent::__construct();
     if ($forSearch) {
         $radioKind = new Zend_Form_Element_Radio('kind');
         $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
         $radioKind->setValue('and');
         $radioKind->setLabel('Search field combination:');
         $radioKind->setRequired(true);
         $this->addElement($radioKind);
     }
     $this->addElement('hidden', CalibrationExercise::COL_ID, array('required' => true));
     $this->addElement('hidden', CalibrationExercise::COL_WORKSHOP_ID, array('required' => true));
     $valiAlphaWhiteSpace = new Zend_Validate_Alpha(true);
     $valiAlnumWhiteSpace = new Zend_Validate_Alnum(true);
     $this->addElement('text', CalibrationExercise::COL_NAME, array('label' => 'Calibration exercise name:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
     $this->addElement('text', CalibrationExercise::COL_DESCRIPTION, array('label' => 'Description:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
     $this->addElement(new Default_Form_Element_KeyTableSelect(CalibrationExercise::COL_KEY_TABLE_ID, array('label' => 'Protocol:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))));
     $this->addElement(new Default_Form_Element_ExpertiseSelect(CalibrationExercise::COL_EXPERTISE_ID, array('label' => 'Expertise:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))));
     $this->addElement('checkbox', CalibrationExercise::COL_COMPAREABLE, array('label' => 'Show comparable other user/group annotations/references:', 'required' => true));
     $this->addElement('checkbox', CalibrationExercise::COL_RANDOMIZED, array('label' => 'Allow adding images to image set at random:', 'required' => true));
     $this->addElement('submit', 'save', array('label' => 'Save'));
     $this->addElement('hidden', 'Token');
     $this->addElement('hidden', CalibrationExercise::COL_IS_STOPPED);
 }
 public function _initVOType()
 {
     $element = new Zend_Form_Element_Radio('vo_type');
     $element->addMultiOptions(array('MIXED' => 'Mixed', 'GROUP' => 'Group', 'STEM' => 'Stem', 'IDP' => 'IdP'));
     $element->setRequired(true);
     $element->setAllowEmpty(false);
     $element->setValue('MIXED');
     return $this->addElement($element);
 }
Пример #7
0
 protected function buildCat2Element()
 {
     $cat2 = new Zend_Form_Element_Radio('cat2');
     $cat2->setLabel($this->_business->getCat2Name());
     $cat2->addMultiOptions($this->_business->getCat2Array(null, false));
     $cat2->setValue($this->_business->getFirstCat2(null, false));
     $cat2->setAttrib('class', 'refineformselect');
     $cat2->setAttrib('onclick', "changeCat2(this.id,this.value, '/ajax/realestate/changecat2/')");
     $this->addElement($cat2);
 }
Пример #8
0
 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;
 }
Пример #9
0
 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);
 }
Пример #10
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #11
0
 public function __construct($forSearch = false)
 {
     parent::__construct();
     if ($forSearch) {
         $radioKind = new Zend_Form_Element_Radio('kind');
         $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
         $radioKind->setValue('and');
         $radioKind->setLabel('Search field combination:');
         $radioKind->setRequired(true);
         $this->addElement($radioKind);
     }
     $this->addElement('hidden', CalibrationExercise::COL_ID, array('required' => true));
     $valiAlphaWhiteSpace = new Zend_Validate_Alpha(true);
     $valiAlnumWhiteSpace = new Zend_Validate_Alnum(true);
     $this->addElement('text', CalibrationExercise::COL_NAME, array('label' => 'Calibration exercise name:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
     $this->addElement('text', CalibrationExercise::COL_DESCRIPTION, array('label' => 'Description:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
     $this->addElement('submit', 'save', array('label' => 'Save'));
     $this->addElement('hidden', 'Token');
 }
 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);
 }
Пример #13
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);
 }
Пример #14
0
 public function __construct($forSearch = false)
 {
     parent::__construct();
     if ($forSearch) {
         $radioKind = new Zend_Form_Element_Radio('kind');
         $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
         $radioKind->setValue('and');
         $radioKind->setLabel('Search field combination:');
         $radioKind->setRequired(true);
         $this->addElement($radioKind);
     }
     $valiAlphaWhiteSpace = new Zend_Validate_Alpha(true);
     $this->addElement('hidden', User::COL_ID, array('required' => true));
     $this->addElement('text', User::COL_USERNAME, array('label' => 'Username = e-mail adress:', 'required' => true, 'validators' => array('EmailAddress', array('StringLength', false, array(6, 40)))));
     $this->addElement('text', User::COL_FIRSTNAME, array('label' => 'First name:', 'required' => true, 'validators' => array($valiAlphaWhiteSpace)));
     $this->addElement('text', User::COL_LASTNAME, array('label' => 'Last name:', 'required' => true, 'validators' => array($valiAlphaWhiteSpace)));
     $this->addElement('password', User::COL_PASSWORD, array('label' => 'Password:'******'required' => true, 'validators' => array(array('StringLength', false, array(6, 20)))));
     $this->addElement('password', self::PASSWORD_CLONE, array('label' => 'Repeat Password:'******'required' => true));
     //due to the rule username=e-mail adress, this field is not viewed
     /*		$this->addElement('text', User::COL_EMAIL, array(	'label'=>'E-mail adress:',
     	     	'required'=>true,
     		 	'validators'=>array('EmailAddress')));*/
     $institutionSelect = new Default_Form_Element_ValuelistSelect(603, User::COL_INSTITUTION);
     $institutionSelect->setRequired(true);
     $institutionSelect->setLabel('Institution:');
     $this->addElement($institutionSelect);
     $this->addElement('text', User::COL_STREET, array('label' => 'Street:', 'validators' => array(new Zend_Validate_Alnum(true))));
     $this->addElement('text', User::COL_CITY, array('label' => 'City:', 'validators' => array($valiAlphaWhiteSpace)));
     $this->addElement('text', User::COL_PHONE, array('label' => 'Phone number:'));
     $this->addElement('text', User::COL_FAX, array('label' => 'Faxsimile number:'));
     $countrySelect = new Default_Form_Element_ValuelistSelect(602, User::COL_COUNTRY);
     $countrySelect->setRequired(true);
     $countrySelect->setLabel('Country:');
     $this->addElement($countrySelect);
     $this->addElement('checkbox', User::COL_ACTIVE, array('label' => 'Active:'));
     $this->addElement('hidden', User::COL_GUID);
     $this->addElement('submit', 'submit', array('label' => 'Submit'));
     $this->addElement('hidden', 'Token');
     $this->setElementFilters(array('StringTrim'));
 }
Пример #15
0
 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');
 }
Пример #16
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);
 }
 /**
  * Get Radio Option
  * @param string $id
  * @param array $option
  * @param string $value
  * @return Zend_Form_Element_Radio
  */
 public function getRadios($id, $option, $value = '', $elementequired = false)
 {
     $element = new Zend_Form_Element_Radio($id);
     $element->addMultiOptions($option);
     $element->removeDecorator('HtmlTag');
     $element->removeDecorator('DtDdWrapper');
     $element->removeDecorator('Label');
     $element->setSeparator('<br/>');
     if ($value !== '') {
         $element->setValue($value);
     }
     if ($elementequired) {
         $element->setAttribs(array('class' => 'validate[required] radio'));
     }
     return $element;
 }
Пример #18
0
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'servicedeskrequests');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $businessunit_id = new Zend_Form_Element_Select('businessunit_id');
     $businessunit_id->setLabel("Business Unit");
     $businessunit_id->setAttrib('class', 'selectoption');
     if ($postid == '') {
         $businessunit_id->setAttrib('onchange', 'displayemployees(this)');
         $bunitModel = new Default_Model_Businessunits();
         $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname');
         $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit'));
         foreach ($bunitdata->toArray() as $data) {
             $businessunit_id->addMultiOption($data['id'], $data['unitname']);
         }
     } else {
         $businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
     }
     $businessunit_id->setRegisterInArrayValidator(false);
     $businessunit_id->setRequired(true);
     $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $department_id = new Zend_Form_Element_Select('department_id');
     $department_id->setLabel("Department");
     $department_id->setAttrib('class', 'selectoption');
     $department_id->addMultiOption('', 'Select Department');
     if ($postid == '') {
         $department_id->setAttrib('onchange', 'displayemployees(this)');
     }
     $department_id->setRegisterInArrayValidator(false);
     $service_desk_flag = new Zend_Form_Element_Radio('service_desk_flag');
     $service_desk_flag->setLabel("Applicability");
     $service_desk_flag->setAttrib('onclick', 'changeimplementation(this)');
     $service_desk_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise'));
     $service_desk_flag->setSeparator('');
     $service_desk_flag->setValue(1);
     $service_desk_flag->setRegisterInArrayValidator(false);
     $service_desk_flag->setRequired(true);
     $service_desk_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.'));
     $service_desk_id = new Zend_Form_Element_Select('service_desk_id');
     $service_desk_id->setLabel("Category");
     $service_desk_id->setAttrib('class', 'selectoption');
     $service_desk_id->addMultiOption('', 'Select category');
     $service_desk_id->setRegisterInArrayValidator(false);
     $service_desk_id->setRequired(true);
     $service_desk_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.'));
     $request_recievers = new Zend_Form_Element_Multiselect('request_recievers');
     $request_recievers->setLabel("Executors");
     $request_recievers->setAttrib('class', 'selectoption');
     $request_recievers->setRegisterInArrayValidator(false);
     $request_recievers->setRequired(true);
     $request_recievers->addValidator('NotEmpty', false, array('messages' => 'Please select executor.'));
     $approvingauthority = new Zend_Form_Element_Select('approvingauthority');
     $approvingauthority->setLabel("No. of Approvers");
     $approvingauthority->setAttrib('class', 'selectoption');
     $approvingauthority->setAttrib('onchange', 'displayapprovingauthority(this)');
     $approvingauthority->addMultiOptions(array('' => 'Select no. of approvers', '1' => '1', '2' => '2', '3' => '3'));
     $approvingauthority->setRegisterInArrayValidator(false);
     $approvingauthority->setRequired(true);
     $approvingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select no. of approvers.'));
     $approver_1 = new Zend_Form_Element_Select('approver_1');
     $approver_1->setLabel("Approver 1");
     $approver_1->setAttrib('class', 'selectoption');
     $approver_1->addMultiOption('', 'Select Approver 1');
     $approver_1->setAttrib('onchange', 'displayapprovingauthority(this)');
     $approver_1->setRegisterInArrayValidator(false);
     $approver_2 = new Zend_Form_Element_Select('approver_2');
     $approver_2->setLabel("Approver 2");
     $approver_2->setAttrib('class', 'selectoption');
     $approver_2->addMultiOption('', 'Select Approver 2');
     $approver_2->setAttrib('onchange', 'displayapprovingauthority(this)');
     $approver_2->setRegisterInArrayValidator(false);
     $approver_3 = new Zend_Form_Element_Select('approver_3');
     $approver_3->setLabel("Approver 3");
     $approver_3->setAttrib('class', 'selectoption');
     $approver_3->addMultiOption('', 'Select Approver 3');
     $approver_3->setRegisterInArrayValidator(false);
     $cc_mail_recievers = new Zend_Form_Element_Multiselect('cc_mail_recievers');
     $cc_mail_recievers->setLabel("Request Viewers");
     $cc_mail_recievers->setAttrib('class', 'selectoption');
     $cc_mail_recievers->setRegisterInArrayValidator(false);
     $attachment = new Zend_Form_Element_Radio('attachment');
     $attachment->setLabel("Attachment");
     $attachment->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $attachment->setSeparator('');
     $attachment->setValue(0);
     $attachment->setRegisterInArrayValidator(false);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $businessunit_id, $department_id, $description, $service_desk_flag, $service_desk_id, $request_recievers, $approvingauthority, $approver_1, $approver_2, $approver_3, $cc_mail_recievers, $attachment, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #19
0
 /** account  form */
 public function createAccountForm($defaultValue = array())
 {
     $form = new Zend_Form();
     $form->setAction($this->webroot . '/user/settings')->setMethod('post');
     $email = new Zend_Form_Element_Text('email');
     $email->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255)->addValidator('EmailAddress');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255);
     $company = new Zend_Form_Element_Text('company');
     $company->setAttrib('maxLength', 255);
     $city = new Zend_Form_Element_Text('city');
     $city->setAttrib('maxLength', 100);
     $country = new Zend_Form_Element_Text('country');
     $country->setAttrib('maxLength', 100);
     $validator = new Zend_Validate_Callback(array('Zend_Uri', 'check'));
     $website = new Zend_Form_Element_Text('website');
     $website->setAttrib('maxLength', 255)->addValidator($validator);
     $biography = new Zend_Form_Element_Textarea('biography');
     $biography->addValidator(new Zend_Validate_Alnum());
     $submit = new Zend_Form_Element_Submit('modifyAccount');
     $submit->setLabel($this->t('Modify'));
     $privacy = new Zend_Form_Element_Radio('privacy');
     $privacy->addMultiOptions(array(MIDAS_USER_PUBLIC => $this->t('Public (Anyone can see my information, excluding email address)'), MIDAS_USER_PRIVATE => $this->t('Private (User information will be hidden)')))->setRequired(true)->setValue(MIDAS_COMMUNITY_PUBLIC);
     if (isset($defaultValue['email'])) {
         $email->setValue($defaultValue['email']);
     }
     if (isset($defaultValue['firstname'])) {
         $firstname->setValue($defaultValue['firstname']);
     }
     if (isset($defaultValue['lastname'])) {
         $lastname->setValue($defaultValue['lastname']);
     }
     if (isset($defaultValue['company'])) {
         $company->setValue($defaultValue['company']);
     }
     if (isset($defaultValue['privacy'])) {
         $privacy->setValue($defaultValue['privacy']);
     }
     if (isset($defaultValue['city'])) {
         $city->setValue($defaultValue['city']);
     }
     if (isset($defaultValue['country'])) {
         $country->setValue($defaultValue['country']);
     }
     if (isset($defaultValue['website'])) {
         $website->setValue($defaultValue['website']);
     }
     if (isset($defaultValue['biography'])) {
         $biography->setValue($defaultValue['biography']);
     }
     $form->addElements(array($email, $website, $city, $country, $biography, $firstname, $lastname, $company, $privacy, $submit));
     return $form;
 }
Пример #20
0
 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;
 }
Пример #21
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');
     }
 }
Пример #22
0
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'appraisalconfig');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $businessunit_id = new Zend_Form_Element_Select('businessunit_id');
     $businessunit_id->setLabel("Business Unit");
     $businessunit_id->setAttrib('class', 'selectoption');
     if ($postid == '') {
         $businessunit_id->setAttrib('onchange', 'displayDept(this)');
         $bunitdata = $this->bunitdata;
         if (!empty($bunitdata)) {
             $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit'));
             foreach ($bunitdata as $data) {
                 $businessunit_id->addMultiOption($data['id'], $data['unitname']);
             }
         } else {
             $businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
         }
     } else {
         $businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
     }
     $businessunit_id->setRegisterInArrayValidator(false);
     $businessunit_id->setRequired(true);
     $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $department_id = new Zend_Form_Element_Select('department_id');
     $department_id->setLabel("Department");
     $department_id->setAttrib('class', 'selectoption');
     $department_id->addMultiOption('', 'Select Department');
     if ($postid == '') {
         $department_id->setAttrib('onchange', 'displayDept(this)');
     }
     $department_id->setRegisterInArrayValidator(false);
     $performance_app_flag = new Zend_Form_Element_Radio('performance_app_flag');
     $performance_app_flag->setLabel("Applicability");
     $performance_app_flag->setAttrib('onclick', 'checkimplementfun(this)');
     $performance_app_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise'));
     $performance_app_flag->setSeparator('');
     $performance_app_flag->setValue(1);
     $performance_app_flag->setRegisterInArrayValidator(false);
     $performance_app_flag->setRequired(true);
     $performance_app_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.'));
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal Mode");
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half-yearly' => 'Half-yearly', 'Yearly' => 'Yearly'));
     $appraisal_mode->setRegisterInArrayValidator(false);
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode.'));
     $appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings');
     $appraisal_ratings->setLabel("Appraisal Ratings");
     $appraisal_ratings->setAttrib('class', 'selectoption');
     $appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10'));
     $appraisal_ratings->setRegisterInArrayValidator(false);
     $appraisal_ratings->setRequired(true);
     $appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings.'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $businessunit_id, $performance_app_flag, $department_id, $appraisal_mode, $appraisal_ratings, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #23
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timemanagement/expenses/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'expensecategory');
     $id = new Zend_Form_Element_Hidden('id');
     $client = new Zend_Form_Element_Select('client_id');
     $client->addMultiOption('', 'Select Client');
     $client->setRegisterInArrayValidator(false);
     $client->setAttrib('onchange', 'loadProjects(this)');
     $client->setRequired(true);
     $client->addValidator('NotEmpty', false, array('messages' => 'Please select Client.'));
     $client->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_clients', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $client->getValidator('Db_RecordExists')->setMessage('Selected Client is inactivated.');
     $project = new Zend_Form_Element_Select('project_id');
     $project->addMultiOption('', 'Select Project');
     $project->setRegisterInArrayValidator(false);
     $project->setRequired(true);
     $project->addValidator('NotEmpty', false, array('messages' => 'Please select Project.'));
     $project->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_projects', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $project->getValidator('Db_RecordExists')->setMessage('Selected Project is inactivated.');
     $category = new Zend_Form_Element_Select('expense_cat_id');
     $category->addMultiOption('', 'Select Category');
     $category->setRegisterInArrayValidator(false);
     $category->setRequired(true);
     $category->addValidator('NotEmpty', false, array('messages' => 'Please select Category.'));
     $category->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_expense_categories', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $category->getValidator('Db_RecordExists')->setMessage('Selected Category is inactivated.');
     $expenseDate = new ZendX_JQuery_Form_Element_DatePicker('expense_date');
     $expenseDate->setOptions(array('class' => 'brdr_none'));
     //$date_of_leaving->setAttrib('onchange', 'validatejoiningdate(this)');
     $expenseDate->setAttrib('readonly', 'true');
     $expenseDate->setAttrib('onfocus', 'this.blur()');
     $expenseAmount = new Zend_Form_Element_Text('expense_amount');
     $expenseAmount->setAttrib('maxLength', 8);
     $expenseAmount->setLabel("Unit Price");
     $expenseAmount->addValidator("regex", true, array('pattern' => '/^[1-9]\\d{1,4}(\\.\\d{1,2})?$/', 'messages' => array('regexNotMatch' => 'Please enter valid Amount.')));
     $note = new Zend_Form_Element_Text('note');
     $note->setAttrib('maxLength', 200);
     $note->setLabel("Note");
     $billable = new Zend_Form_Element_Radio('is_billable');
     $billable->setLabel("Type");
     $billable->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $billable->setSeparator('');
     $billable->setValue('billable');
     $billable->setRegisterInArrayValidator(false);
     $billable->setRequired(true);
     $billable->addValidator('NotEmpty', false, array('messages' => 'Please select Type.'));
     /*
     client_idbigint(20) unsigned NOT NULL
     project_idbigint(20) unsigned NOT NULL
     expense_cat_idint(10) unsigned NOT NULL
     expense_datetimestamp NOT NULL
     expense_amountdecimal(8,2) unsigned NOT NULL
     notevarchar(200) NULL
     is_billabletinyint(1) unsigned NOT NULL
     receipt_filevarchar(200) NULL
     expense_statusenum('saved','submitted','approved','rejected') NULL
     status_update_datetimestamp NOT NULL
     status_update_byint(11) NULL
     reject_notevarchar(200) NULL
     */
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $client, $project, $category, $expenseDate, $expenseAmount, $note, $billable, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('expense_date'));
 }
Пример #24
0
 /**
  * Faz o parse de um elemento <radio> para Zend_Form.
  * @param SimpleXMLElement $element
  */
 protected function parseRadio($element)
 {
     $form_element = new Zend_Form_Element_Radio((string) $element->id);
     $form_element->setSeparator("");
     $form_element->setLabel((string) $element->label);
     foreach ($element->option as $option) {
         $form_element->addMultiOption((string) $option->value, $option->label);
     }
     if (isset($element->value)) {
         $form_element->setValue($element->value);
     } else {
         if (isset($element->default)) {
             $form_element->setValue($element->default);
         }
     }
     return $form_element;
 }
 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;
 }
 public function init()
 {
     if (isset($this->advertisement)) {
         $user = Advertisement::getUser($this->advertisement->id);
         $element = new Zend_Form_Element_Hidden('id');
         $element->setValue($this->advertisement->id);
         $this->addElement($element);
         $element = new Zend_Form_Element_Hidden('password');
         $element->setValue($this->password);
         $this->addElement($element);
         $this->setAction('/' . strtolower($this->city->name) . '/bulletin/update');
     } else {
         $this->setAction('/' . strtolower($this->city->name) . '/bulletin/create');
     }
     $element = new Zend_Form_Element_Hidden('city');
     $element->setValue($this->city->id);
     $this->addElement($element);
     $this->setMethod('POST');
     $this->setName('createAdForm');
     $element = new Zend_Form_Element_Text('name');
     $element->setLabel('怎么称呼您');
     $element->setDescription('必填,中英文都可,2到30个字');
     $element->setRequired(true);
     //$element->addValidator(new Zend_Validate_StringLength(2,30));
     if (isset($user)) {
         $element->setValue($user->name);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('您的Email');
     $element->setRequired(true);
     $element->addValidator(new Zend_Validate_EmailAddress());
     $element->addValidator('NotEmpty');
     $element->setDescription('必填,将不会显示在您的帖子里');
     if (isset($user)) {
         $element->setValue($user->email);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('mobile');
     $element->setLabel('您的手机号');
     $element->addFilter(new Zend_Filter_HtmlEntities());
     $element->addFilter(new Zend_Filter_StripTags());
     $element->setDescription('方便其他用户联系您');
     if (isset($user)) {
         $element->setValue($user->mobile);
     }
     $this->addElement($element);
     $this->addDisplayGroup(array('name', 'email', 'mobile'), 'aboutYou');
     $this->getDisplayGroup('aboutYou')->removeDecorator('DtDdWrapper');
     // radio box
     $element = new Zend_Form_Element_Radio('type');
     $element->addMultiOptions(array('lease' => '供', 'want' => '求'))->removeDecorator('Label');
     $element->setSeparator('')->setValue(Advertisement::LEASE);
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->type);
     }
     $this->addElement($element);
     // category
     $element = new Zend_Form_Element_Checkbox("isBusiness");
     $element->setLabel('是商铺/店面吗?');
     if (isset($this->advertisement) && $this->advertisement->category_id == Category::SHOP) {
         $element->setValue(1);
     } else {
         $element->setValue(0);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('title');
     $element->setLabel('帖子标题');
     $element->setRequired(true);
     $element->addValidator('NotEmpty');
     //$element->addValidator(new Zend_Validate_StringLength(10,30));
     $element->setDescription('必填,5-100字,概括题目,突出重点');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->title);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('address');
     $element->setLabel('房子的住址');
     $element->setDescription('必填,以便用户在地图上方便的找到');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->address);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('rent');
     $element->setLabel('租金');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->rent);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Select('currency');
     //$element->setLabel("货币");
     $element->addMultiOptions(Currency::getAvailableCurrencyAsArray());
     if (isset($this->advertisement)) {
         $element->setValue(Advertisement::getCurrency($this->advertisement)->id);
     } else {
         $element->setValue(127);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Radio('rent_measurement');
     $element->addMultiOptions(array('month' => '每月', 'day' => '每日'))->setSeparator('')->setDescription('必填')->removeDecorator('Label');
     $element->setSeparator('')->setValue(Advertisement::RENT_MONTHLY);
     if (isset($this->advertisement)) {
         if ($this->advertisement->rent_measurement == Advertisement::RENT_MONTHLY) {
             $element->setValue('month');
         } else {
             if ($this->advertisement->rent_measurement == Advertisement::RENT_DAILY) {
                 $element->setValue('day');
             }
         }
     }
     $element->setRequired(true);
     $element->addValidator('NotEmpty');
     $element->addValidator(new Zend_Validate_Alnum());
     $this->addElement($element);
     // start date and stop date
     $element = new Zend_Form_Element_Text('start_date');
     $element->setRequired(true);
     $element->addValidator('NotEmpty');
     $element->setLabel('开始日期');
     $element->setDescription('必填,格式为2010-09-11');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->start_date);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('stop_date');
     $element->setLabel('结束日期');
     $element->setDescription('同上,留空则为长期');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->stop_date);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('area');
     $element->setLabel('面积(平方米)');
     $element->addValidator(new Zend_Validate_Alnum());
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->area);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('num_of_room');
     $element->setLabel('房间数');
     $element->addValidator(new Zend_Validate_Alnum());
     $element->setDescription('卧房数');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->num_of_room);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Textarea('description');
     $element->setLabel('其他描述');
     $element->setDescription('更多详细信息,例如: 交通是否方便? 是否有独立卫生间和厨房? 是否仅限女生? 是否有家具? 月租是否包括网费? 您的个人习惯等等。');
     $element->setAttrib('rows', 4);
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->description);
     }
     $this->addElement($element);
     $element = new Elements();
     $element->addReCaptcha($this);
     $element = new Zend_Form_Element_Submit('post');
     $element->setValue('提交')->removeDecorator('Label');
     $this->addElement($element);
     $this->addDisplayGroup(array('isBusiness', 'type', 'title', 'address', 'rent', 'currency', 'rent_measurement', 'start_date', 'stop_date', 'area', 'num_of_room', 'description', 'challenge', 'post'), 'aboutRoom');
     $this->getDisplayGroup('aboutRoom')->removeDecorator('DtDdWrapper');
 }
Пример #27
0
 public function init()
 {
     $myNamespace = new Zend_Session_Namespace(Constant::USER_DATA);
     $searchData = $myNamespace->searchData;
     $this->setMethod('POST');
     $this->setName('searchForm');
     $element = new Zend_Form_Element_Radio('type');
     $element->addMultiOptions(array('all' => '全部', 'lease' => '供', 'want' => '求'));
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_TYPE])) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_TYPE]);
     } else {
         $element->setValue('all');
     }
     $element->setSeparator('');
     $element->removeDecorator('Label');
     $this->addElement($element);
     //		$element = new Zend_Form_Element_Checkbox("search_business");
     //		$element->setValue(0);
     //		$this->addElement($element);
     $element = new Zend_Form_Element_Hidden('status');
     $element->setValue('active');
     $this->addElement($element);
     /*$element = new Zend_Form_Element_Text('rent');
     		$element->setLabel('租金');
     		$this->addElement($element);
     		
     		$element = new Zend_Form_Element_Radio('rent_measurement');
     		$element->setMultiOptions(
     			array(
     				'day' => '克朗每日',
     				'month' => '克朗每月'
     			)
     		);
     		$element->setSeparator('');
     		$element->removeDecorator('Label');
     		$element->setValue('month');
     		$this->addElement($element);*/
     $element = new Zend_Form_Element_Text(Constant::VAR_SEARCH_DATA_CHECKIN_DATE);
     $element->setLabel('入住日期');
     //$element->setDescription('例:2010-10-20');
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_CHECKIN_DATE])) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_CHECKIN_DATE]);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text(Constant::VAR_SEARCH_DATA_CHECKOUT_DATE);
     $element->setLabel('搬出日期(留空为长期)');
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_CHECKOUT_DATE]) && $searchData[Constant::VAR_SEARCH_DATA_CHECKOUT_DATE] != Constant::DEFAULT_CHECKOUT_DATE) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_CHECKOUT_DATE]);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text("keyword");
     $element->setLabel("关键字");
     //$element->setDescription("例:女生,lappis");
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_KEYWORD])) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_KEYWORD]);
     }
     $this->addElement($element);
     //		$element = new Zend_Form_Element_Radio('sortedBy');
     //		$element->setLabel('排序');
     //		$element->addMultiOptions(array(
     //			'created' => '发帖时间',
     //			'rent' => '房租'
     //		));
     //		$element->setSeparator('');
     //		$element->setValue('created');
     //		$this->addElement($element);
     //
     //		$element = new Zend_Form_Element_Hidden('city');
     //		$element->setValue($this->city);
     //		$element->removeDecorator('Label');
     //		$this->addElement($element);
     $element = new Zend_Form_Element_Submit('search');
     $element->setValue('搜索');
     $element->removeDecorator('Label');
     $this->addElement($element);
 }
Пример #28
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'identitydocuments');
     $id = new Zend_Form_Element_Hidden('id');
     /*$identitydocuments = new Zend_Form_Element_MultiCheckbox('identitydoc');
     		$identitydocuments->setLabel('Identity Documents');
     		$identitydocuments->setMultiOptions(array(
                                	'1'=>'Passport',
     							'2'=>'SSN',
     							'3'=>'Aadhaar',
                                 '4'=>'Pan Card',
                                 '5'=>'Driving License',
     							));
     		$identitydocuments->setRequired(true);
     		$identitydocuments->addValidator('NotEmpty', false, array('messages' => 'Please select at least one identity document type.'));
     		$identitydocuments->setSeparator(PHP_EOL);	
     		
     		$othercheck = new Zend_Form_Element_Checkbox('othercheck');
     		$othercheck->setLabel('Other Documents');
     		$othercheck->setAttrib('onclick', 'displayotherdocumentdiv(this)');
     	 
     		
     		$otherdocument = new Zend_Form_Element_Text('otherdocument');
     		$otherdocument->setAttrib('maxlength',50);
     		$otherdocument->setAttrib('onblur', 'validate_otherdocument(this)');
     		$otherdocument->setLabel('Document Name');
     		$otherdocument->addValidator("regex",true,array(
     							'pattern'=> '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\-\s]*)$/',
                                'messages'=>array(
                                    'regexNotMatch'=>'Please enter valid document name.'
                                )
             	));*/
     $documentname = new Zend_Form_Element_Text('document_name');
     $documentname->setAttrib('maxlength', 50);
     $documentname->setLabel('Document Name');
     $documentname->setRequired(true);
     $documentname->addValidator('NotEmpty', false, array('messages' => 'Please enter document name.'));
     $documentname->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document name.')));
     $documentname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_identitydocuments', 'field' => 'document_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     $documentname->getValidator('Db_NoRecordExists')->setMessage('Document name already exists.');
     $mandatory = new Zend_Form_Element_Radio('mandatory');
     $mandatory->setLabel("Mandatory");
     $mandatory->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $mandatory->setRequired(true);
     $mandatory->addValidator('NotEmpty', false, array('messages' => 'Please select mandatory.'));
     $mandatory->setSeparator('');
     $mandatory->setValue(0);
     $mandatory->setRegisterInArrayValidator(false);
     $expiry = new Zend_Form_Element_Radio('expiry');
     $expiry->setLabel("Expiry");
     $expiry->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $expiry->setRequired(true);
     $expiry->addValidator('NotEmpty', false, array('messages' => 'Please select expiry.'));
     $expiry->setSeparator('');
     $expiry->setValue(0);
     $expiry->setRegisterInArrayValidator(false);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $documentname, $mandatory, $expiry, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #29
0
 public function addOption($option)
 {
     $o = new Zend_Form_Element_Radio('submit');
     $o->class = 'formsubmit';
     $o->setValue('Submit')->setDecorators(array(array('ViewHelper', array('helper' => 'formSubmit'))));
 }