Пример #1
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'))));
     //###########################################################
 }
Пример #2
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);
 }
Пример #3
0
 public function init()
 {
     global $mySession;
     $PathType = '1';
     if (isset($_REQUEST['path_type'])) {
         $PathType = $_REQUEST['path_type'];
     }
     $video_title = new Zend_Form_Element_Text('video_title');
     $video_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput");
     $pathtypeArr = array();
     $pathtypeArr[0]['key'] = "1";
     $pathtypeArr[0]['value'] = "Computer";
     $pathtypeArr[1]['key'] = "2";
     $pathtypeArr[1]['value'] = "You Tube Url";
     $path_type = new Zend_Form_Element_Radio('path_type');
     $path_type->addMultiOptions($pathtypeArr)->setAttrib("onclick", "setType(this.value);")->setValue(1);
     $video_path = new Zend_Form_Element_File('video_path');
     $video_path->setDestination(SITE_ROOT . 'images/videos/')->addValidator('Extension', false, 'flv');
     $you_tube_url = new Zend_Form_Element_Text('you_tube_url');
     $you_tube_url->setAttrib("class", "textInput");
     if ($PathType == '1') {
         $video_path->setRequired(true)->addDecorator('Errors', array('class' => 'error'));
     } else {
         $you_tube_url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'You tube url is required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $this->addElements(array($video_title, $video_path, $you_tube_url, $path_type));
 }
Пример #4
0
 /** helper method to create privacy related form elements */
 protected function _getPrivacyFormElements()
 {
     $privacy = new Zend_Form_Element_Radio('privacy');
     $privacy->addMultiOptions(array(MIDAS_COMMUNITY_PRIVATE => $this->t('Private, only members can see the community'), MIDAS_COMMUNITY_PUBLIC => $this->t('Public, everyone can see the community')))->setRequired(true)->setValue(MIDAS_COMMUNITY_PUBLIC);
     $canJoin = new Zend_Form_Element_Radio('canJoin');
     $canJoin->addMultiOptions(array(MIDAS_COMMUNITY_CAN_JOIN => $this->t('Everyone can join the community'), MIDAS_COMMUNITY_INVITATION_ONLY => $this->t('Only invited users can join the community')))->setValue(MIDAS_COMMUNITY_CAN_JOIN);
     return array($privacy, $canJoin);
 }
 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);
 }
Пример #6
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);
 }
Пример #7
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'));
 }
Пример #8
0
 public function init($val)
 {
     global $mySession;
     $db = new Db();
     # FORM ELEMENT:Email ID
     # TYPE : text
     $fname = new Zend_Form_Element_Text('fname');
     $fname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox');
     //if($val==1)
     //		{
     //			$fname->setValue($mySession->fname);
     //		}
     # FORM ELEMENT:Email ID
     # TYPE : text
     $lname = new Zend_Form_Element_Text('lname');
     $lname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Last name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox');
     $PaypalArr = array();
     $PaypalArr[0]['key'] = "1";
     $PaypalArr[0]['value'] = "PayPal";
     $PaypalArr[1]['key'] = "2";
     $PaypalArr[1]['value'] = "Credit Card";
     $paypalchk = new Zend_Form_Element_Radio('paypalchk');
     $paypalchk->addMultiOptions($PaypalArr)->addValidator('NotEmpty', true, array('messages' => 'Payment Mode is required.'))->addDecorator('Errors', array('class' => 'error'))->setRequired(true);
     //$paypalchk= new Zend_Form_Element_Checkbox('paypalchk');
     //		$paypalchk
     //		->setRequired(true)
     //		->addValidator('NotEmpty',true,array('messages' =>'Last name is required'))
     //		->addDecorator('Errors', array('class'=>'errmsg'));
     //
     //
     //		$creditchk= new Zend_Form_Element_Checkbox('creditchk');
     //		$creditchk
     //		->setRequired(true)
     //		->addValidator('NotEmpty',true,array('messages' =>'Last name is required'))
     //		->addDecorator('Errors', array('class'=>'errmsg'));
     # FORM ELEMENT:password
     # TYPE : text
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox');
     if (@$_REQUEST['emailid'] != "") {
         $emailid->addValidator('EmailAddress', true)->addDecorator('Errors', array('class' => 'errmsg'))->addErrorMessage('Please enter a valid email address');
     }
     $this->addElements(array($fname, $lname, $emailid, $paypalchk));
 }
Пример #9
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');
 }
Пример #10
0
 public function __construct($options = null)
 {
     //        $this->_disabledDefaultActions = true;
     //        $this->_object = $options['object'];
     unset($options['object']);
     parent::__construct($options);
     // Subform for the retailer status on website
     $retailerForm = new Cible_Form_SubForm();
     $retailerForm->setName('retailerForm')->removeDecorator('DtDdWrapper');
     //checkbox to set the retailers address as valid
     $isValid = new Zend_Form_Element_Checkbox('R_Active');
     $isValid->setLabel($this->getView()->getCibleText('form_label_approved_onweb'));
     $isValid->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $retailerForm->addElement($isValid);
     $isRetailer = new Zend_Form_Element_Radio('isDistributeur');
     $isRetailer->setLabel($this->getView()->getCibleText('form_label_Display_web'))->setOrder(0);
     $isRetailer->setSeparator('');
     $isRetailer->setAttrib('class', 'vertAlignRadio');
     $isRetailer->addMultiOptions(array(1 => $this->getView()->getCibleText('form_account_no'), 2 => $this->getView()->getCibleText('form_account_yes')))->setValue(1);
     $txtFr = new Cible_Form_Element_Html('lblFr', array('value' => $this->getView()->getCibleText('form_address_retailer_fr')));
     $txtFr->setOrder(1)->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage'))));
     $retailerForm->addElement($txtFr);
     $adressRetailer = new Cible_View_Helper_FormAddress($retailerForm);
     $adressRetailer->enableFields(array('name' => true, 'firstAddress' => false, 'secondAddress' => false, 'state' => false, 'cityTxt' => false, 'zipCode' => false, 'country' => false, 'firstTel' => false, 'secondTel' => false, 'fax' => false, 'email' => false, 'webSite' => false));
     $adressRetailer->formAddress();
     $retailerForm->addElement($isRetailer);
     $retailerForm->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree');
     // Subform for the retailer status on website
     $retailerFormEn = new Cible_Form_SubForm();
     $retailerFormEn->setName('retailerFormEn')->removeDecorator('DtDdWrapper');
     $txtEn = new Cible_Form_Element_Html('lblEn', array('value' => $this->getView()->getCibleText('form_address_retailer_en')));
     $txtEn->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage'))));
     $adressRetailerEn = new Cible_View_Helper_FormAddress($retailerFormEn);
     $adressRetailerEn->enableFields(array('name' => false, 'firstAddress' => false, 'secondAddress' => false, 'firstTel' => false, 'secondTel' => false, 'webSite' => false));
     $adressRetailerEn->formAddress();
     $retailerFormEn->addElement($txtEn);
     $retailerFormEn->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree');
     //*** Add subform to the form ***/
     $this->addSubForm($retailerForm, 'retailerForm');
     $this->addSubForm($retailerFormEn, 'retailerFormEn');
 }
Пример #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);
     }
     $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'));
 }
Пример #12
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'));
 }
 /**
  * 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;
 }
Пример #14
0
 /**
  * 以<radio>标签的形式输出
  * 
  * @param ZtChart_Model_DbTable_Role_Rowset $rowset
  * @param array $attributes
  */
 protected function _htmlRadio(ZtChart_Model_DbTable_Role_Rowset $rowset, $attributes = array())
 {
     if (isset($attributes['options'])) {
         $options = $attributes['options'];
         unset($attributes['options']);
     } else {
         $options = array();
     }
     $htmlRadio = new Zend_Form_Element_Radio(array_merge($this->_attributes['radio'], $attributes));
     $htmlRadio->clearDecorators()->addDecorator('ViewHelper');
     $htmlRadio->addMultiOptions($options);
     foreach ($rowset as $row) {
         $htmlRadio->addMultiOption($row->role_id, $row->role_name);
     }
     return $htmlRadio;
 }
Пример #15
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'));
 }
 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');
 }
Пример #17
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;
 }
Пример #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
 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);
 }
Пример #20
0
 public function createElement(array $attributes)
 {
     $name = $attributes['name'];
     $type = $attributes['type'];
     $length = $attributes['length'];
     $required = $attributes['required'];
     $default = $attributes['default'];
     $values = $attributes['values'];
     $email = $attributes['email'];
     $min = isset($attributes['min']) ? $attributes['min'] : 1;
     $max = isset($attributes['max']) ? $attributes['max'] : $attributes['length'];
     /* float, decimal, string and integer are fallthrough cases since all will render a text box */
     switch ($type) {
         case 'float':
         case 'decimal':
         case 'integer':
             if (preg_match('/_id$/i', $name)) {
                 $element = new Zend_Form_Element_Hidden($name);
             } else {
                 $element = new Zend_Form_Element_Text($name);
             }
             $element->addValidator(new Zend_Validate_Digits(true));
             $element->setAttrib('size', $length);
             break;
         case 'string':
             /* determine if it should be 'hidden' */
             if (preg_match('/_id$/i', $name)) {
                 $element = new Zend_Form_Element_Hidden($name);
             } else {
                 if ($length > 60) {
                     $element = new Zend_Form_Element_Textarea($name, array('rows' => 5, 'cols' => 54));
                 } else {
                     $element = new Zend_Form_Element_Text($name);
                     if ($email) {
                         $element->addValidator(new Zend_Validate_EmailAddress(true));
                     } else {
                         //$element->addValidator( new Zend_Validate_Alnum(true) );
                     }
                 }
             }
             $element->addValidator(new Zend_Validate_StringLength($min, $max));
             if ($length > $this->_input_length) {
                 $size = $this->_input_length;
             } else {
                 $size = $length;
             }
             $element->setAttrib('size', $size);
             $element->setAttrib('maxlength', $max);
             break;
         case 'boolean':
             $element = new Zend_Form_Element_Checkbox($name);
             break;
         case 'blob':
             $element = new Zend_Form_Element_File($name);
             break;
         case 'clob':
             $element = new Zend_Form_Element_Textarea($name, array('rows' => 12, 'cols' => 35));
             break;
         case 'timestamp':
             break;
         case 'time':
             $element = new Neo_Form_Element_Time($name);
             $element->setValue(date('H:i'));
             $element->setAttrib('size', 5);
             $element->setAttrib('maxlength', 5);
             break;
         case 'date':
             $jQueryParams = array('defaultDate' => date('yy-mm-dd'), 'dateFormat' => 'yy-mm-dd', 'firstDay' => 1, 'showOn' => 'button', 'buttonImageOnly' => false, 'minDate' => '-40Y', 'changeMonth' => true, 'changeYear' => true, 'monthNames' => array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'));
             $element = new ZendX_JQuery_Form_Element_DatePicker($name, $jQueryParams);
             $element->addValidator(new Zend_Validate_Date('yy-mm-dd'));
             $element->addValidator(new Zend_Validate_StringLength('10', '10'));
             $element->setAttrib('disabled', true);
             $element->setAttrib('size', 10);
             $element->setAttrib('maxlength', 10);
             break;
         case 'enum':
             $element = new Zend_Form_Element_Radio($name);
             if (!empty($values) and is_array($values)) {
                 $values = array_combine($values, $values);
                 $element->addMultiOptions($values);
             }
             break;
         case 'foreign':
             $element = new Zend_Form_Element_Select($name);
             /*if ( ! empty ( $values ) AND is_array( $values ) ) {
                   $element->addMultiOptions( $values );
               }*/
             break;
         case 'array':
             break;
         case 'object':
             //Doctrine auto-serializes...not sure how or why I would have this in a form
             //but its here for completeness.
             break;
         default:
             break;
     }
     if (!empty($default)) {
         $element->setValue($default);
     }
     if ($required) {
         $element->setRequired(TRUE);
     }
     return $element;
 }
Пример #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()
 {
     global $mySession;
     $db = new Db();
     # FORM ELEMENT:qty
     # TYPE : text
     $qty = new Zend_Form_Element_Text('qty');
     $qty->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onchange", "return calcurate(this.value);")->setAttrib("onkeypress", "return checknummsp(event,this.value);")->setAttrib("style", "width:50px; height:20px;")->setValue(1);
     $this->addElement($qty);
     # FORM ELEMENT: size
     # TYPE : Select
     $SizeArr = array();
     $sizes = $db->runQuery("select * from " . TSHIRT_SIZE);
     foreach ($sizes as $key => $size) {
         $SizeArr[$key] = array();
         $SizeArr[$key]['key'] = $size['size'];
         $SizeArr[$key]['value'] = $size['size'];
     }
     $size = new Zend_Form_Element_Select('size');
     $size->addMultiOptions($SizeArr)->addDecorator('Errors', array('class' => 'error'))->setAttrib("style", "width:50px; height:20px;");
     //->setValue($size_value);
     $this->addElement($size);
     $PaypalArr = array();
     $PaypalArr[0]['key'] = "1";
     $PaypalArr[0]['value'] = "PayPal";
     $PaypalArr[1]['key'] = "2";
     $PaypalArr[1]['value'] = "Credit Card";
     $paypalchk = new Zend_Form_Element_Radio('paypalchk');
     $paypalchk->addMultiOptions($PaypalArr)->addValidator('NotEmpty', true, array('messages' => 'Payment Mode is required.'))->addDecorator('Errors', array('class' => 'error'))->setRequired(true)->setValue(1);
     $this->addElement($paypalchk);
     # FORM ELEMENT:price
     # TYPE : text
     $price = new Zend_Form_Element_Text('price');
     $price->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:50px; height:20px;");
     $this->addElement($price);
     $cusemail = "";
     $cusfname = "";
     $cuslname = "";
     $street1Val = "";
     $street2Val = "";
     $cityVal = "";
     $stateVal = "";
     $zipcodeVal = "";
     if ($mySession->TeeLoggedID != "") {
         $chkQry = $db->runQuery("select * from " . USERS . " where  user_id='" . (int) $mySession->TeeLoggedID . "'");
         if ($chkQry && count($chkQry)) {
             $cusemail = $chkQry[0]['emailid'];
             $cusfname = $chkQry[0]['public_name'];
         }
         $address = $db->runQuery("select * from " . ADDRESS . " where user_id='" . (int) $mySession->TeeLoggedID . "'");
         if ($address && count($address)) {
             $streetArr = explode('||', $address[0]['address'], 2);
             if (count($streetArr) > 0) {
                 $street1Val = $streetArr[0];
             }
             if (count($streetArr) > 1) {
                 $street2Val = $streetArr[1];
             }
             $nameArr = explode(' ', $address[0]['public_name'], 2);
             if (count($nameArr) > 0) {
                 $cusfname = $nameArr[0];
             }
             if (count($nameArr) > 1) {
                 $cuslname = $nameArr[1];
             }
             $cityVal = $address[0]['city'];
             $stateVal = $address[0]['state'];
             $zipcodeVal = $address[0]['zipcode'];
         }
     }
     $cemail = new Zend_Form_Element_Text('cemail');
     $cemail->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($cusemail);
     $this->addElement($cemail);
     $cfname = new Zend_Form_Element_Text('cfname');
     $cfname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($cusfname);
     $this->addElement($cfname);
     $clname = new Zend_Form_Element_Text('clname');
     $clname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Last Name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($cuslname);
     $this->addElement($clname);
     $street1 = new Zend_Form_Element_Text('street1');
     $street1->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Street is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($street1Val);
     $this->addElement($street1);
     $street2 = new Zend_Form_Element_Text('street2');
     $street2->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($street2Val);
     $this->addElement($street2);
     $city = new Zend_Form_Element_Text('city');
     $city->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'City is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($cityVal);
     $this->addElement($city);
     $zipcode = new Zend_Form_Element_Text('zipcode');
     $zipcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Zip code is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:250px; height:25px;")->setValue($zipcodeVal);
     $this->addElement($zipcode);
     $StateArr = array();
     $StateArr[0]['key'] = "";
     $StateArr[0]['value'] = "- - Select  State- -";
     $StateData = $db->runQuery("select * from " . STATE . " order by state_name");
     if ($StateData && count($StateData)) {
         foreach ($StateData as $key => $StateValues) {
             $StateArr[$key + 1]['key'] = $StateValues['state_id'];
             $StateArr[$key + 1]['value'] = $StateValues['state_name'];
         }
     }
     $state = new Zend_Form_Element_Select('state');
     $state->setRequired(true)->addMultiOptions($StateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:100px; height:33px;")->setAttrib("onchange", "getneighborhoodcities(this.value);")->setValue($stateVal);
     $this->addElement($state);
 }
Пример #23
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod("POST");
     $id = new Zend_Form_Element_Hidden("id");
     //add firstname
     $f_name = new Zend_Form_Element_Text("f_name");
     $f_name->setRequired();
     $f_name->setLabel("First Name:");
     $f_name->setAttrib("placeholder", "Enter Your first Name");
     $f_name->addValidator(new Zend_Validate_Alnum("true"));
     $f_name->setAttrib("class", "form-control");
     $f_name->getDecorator("Label")->setOption("class", "control-label");
     $f_name->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $f_name->getDecorator("Errors")->setOption("style", " list-style-type:none");
     //add lastname
     $l_name = new Zend_Form_Element_Text("l_name");
     $l_name->setRequired();
     $l_name->setLabel("Last Name:");
     $l_name->setAttrib("placeholder", "Enter Your last Name");
     $l_name->addValidator(new Zend_Validate_Alnum("true"));
     $l_name->setAttrib("class", "form-control");
     $l_name->getDecorator("Label")->setOption("class", "control-label");
     $l_name->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $l_name->getDecorator("Errors")->setOption("style", " list-style-type:none");
     //add mail
     $username = new Zend_Form_Element_Text("username");
     $username->setRequired();
     $username->setLabel("Username:"******"placeholder", "Enter Your E-Mail");
     $username->addValidator(new Zend_Validate_EmailAddress());
     $username->setAttrib("class", "form-control");
     $username->getDecorator("Label")->setOption("class", "control-label");
     $username->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $username->getDecorator("Errors")->setOption("style", " list-style-type:none");
     //add address
     $address = new Zend_Form_Element_Text("address");
     $address->setLabel("Adress:");
     $address->setAttrib("placeholder", "Enter Your adress");
     $address->addValidator(new Zend_Validate_Alnum("true"));
     $address->setAttrib("class", "form-control");
     $address->getDecorator("Label")->setOption("class", "control-label");
     $address->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $address->getDecorator("Errors")->setOption("style", " list-style-type:none");
     //add mobile
     $mobile = new Zend_Form_Element_Text("mobile");
     $mobile->setLabel("Mobile:");
     $mobile->setAttrib("placeholder", "Enter Your mobile");
     $mobile->addValidator(new Zend_Validate_Alnum("true"));
     $mobile->setAttrib("class", "form-control");
     $mobile->getDecorator("Label")->setOption("class", "control-label");
     $mobile->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $mobile->getDecorator("Errors")->setOption("style", " list-style-type:none");
     //add phone
     $phone = new Zend_Form_Element_Text("phone");
     $phone->setLabel("Phone:");
     $phone->setAttrib("placeholder", "Enter Your phone");
     $phone->addValidator(new Zend_Validate_Alnum("true"));
     $phone->setAttrib("class", "form-control");
     $phone->getDecorator("Label")->setOption("class", "control-label");
     $phone->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $phone->getDecorator("Errors")->setOption("style", " list-style-type:none");
     //add checkbox
     $status = new Zend_Form_Element_Radio("active");
     $status->addMultiOptions(array('1' => 'Active', '0' => 'Notactive'));
     $status->setLabel('What is your status ?');
     $status->setAttrib("class", "form-control");
     $status->getDecorator("Label")->setOption("class", "control-label");
     $status->setRequired();
     $user_type = new Zend_Form_Element_Radio("user_type");
     $user_type->addMultiOptions(array('admin' => 'Admin', 'normal' => 'Normal'));
     $user_type->setLabel('User Type');
     $user_type->setAttrib("class", "form-control");
     $user_type->getDecorator("Label")->setOption("class", "control-label");
     $user_type->setRequired();
     $password = new Zend_Form_Element_Password("password");
     $password->setRequired();
     $password->setLabel("Password:"******"placeholder", "Enter Your Password");
     $password->setAttrib("class", "form-control");
     $password->getDecorator("Label")->setOption("class", "control-label");
     $password->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $password->getDecorator("Errors")->setOption("style", " list-style-type:none");
     $re_password = new Zend_Form_Element_Password("re_password");
     $re_password->setRequired();
     $re_password->setLabel("Retype Your Password:"******"placeholder", "Re-enter Your Password");
     $re_password->setAttrib("class", "form-control");
     $re_password->getDecorator("Label")->setOption("class", "control-label");
     $re_password->getDecorator("Errors")->setOption("class", "alert alert-danger");
     $re_password->getDecorator("Errors")->setOption("style", " list-style-type:none");
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->setAttrib("class", "btn btn-xl center-block");
     $this->addElements(array($id, $f_name, $l_name, $username, $address, $password, $re_password, $mobile, $phone, $status, $user_type, $submit));
     // Add a captcha
     /*$this->addElement('captcha', 'captcha', array(
           'label'      => 'Please enter the 5 letters displayed below:',
           'required'   => true,
           'captcha'    => array(
               'captcha' => 'Figlet',
               'wordLen' => 5,
               'timeout' => 300
           )
       ));*/
 }
Пример #24
0
 public function init($videoId)
 {
     global $mySession;
     $db = new Db();
     $path = "";
     $title = "";
     $date = "";
     $description = "";
     $status = "";
     $featuredstatus = "";
     $featurepath = "";
     $videotype = "";
     if ($videoId != "") {
         $videoData = $db->runQuery("select * from " . VIDEOGALLERY . " where \tvideo_id='" . $videoId . "'");
         $type = $videoData[0]['video_type'];
         $path = $videoData[0]['video_path'];
         $title = $videoData[0]['video_title'];
         $date = date('F d-Y, h:i:s a', strtotime($videoData[0]['date_uploaded']));
         $description = $videoData[0]['video_description'];
         $keyword = $videoData[0]['video_keyword'];
         $status = $videoData[0]['video_status'];
         $videotype = $photoData[0]['video_type'];
         /*$featuredstatus =$videoData[0]['featured_status'];*/
         $featurepath = $photoData[0]['featured_path'];
     }
     $Type[0]['key'] = "1";
     $Type[0]['value'] = "URL from YouTube";
     $Type[1]['key'] = "2";
     $Type[1]['value'] = "Upload from computer";
     $video_type = new Zend_Form_Element_Radio('video_type');
     $video_type->addMultiOptions($Type)->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video type required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib('onclick', 'changetype();');
     $video_path1 = new Zend_Form_Element_Text('video_path1');
     $video_path1->setAttrib("class", "textInput");
     if ($_REQUEST['video_type'] == 1) {
         $video_path1->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video path required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $video_path2 = new Zend_Form_Element_File('video_path2');
     $video_path2->setAttrib("class", "textInput")->setDestination(SITE_ROOT . 'images/videos/')->addValidator('Extension', false, 'flv');
     if ($_REQUEST['video_type'] == 2) {
         $video_path2->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video path required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $video_title = new Zend_Form_Element_Text('video_title');
     $video_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video Title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($title);
     $up_date = new Zend_Form_Element_Text('up_date');
     $up_date->setAttrib("class", "textInput")->setAttrib("disabled", "disabled")->setValue($date);
     $video_description = new Zend_Form_Element_Textarea('video_description');
     $video_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Video description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textarea_medium")->setValue($description);
     $Option[0]['key'] = "1";
     $Option[0]['value'] = "Active";
     $Option[1]['key'] = "0";
     $Option[1]['value'] = "Inactive";
     $video_status = new Zend_Form_Element_Radio('video_status');
     $video_status->setRequired(true)->addMultiOptions($Option)->addValidator('NotEmpty', true, array('messages' => 'Please select status of video.'))->addDecorator('Errors', array('class' => 'error'))->setValue($status);
     $Option1[1]['key'] = "1";
     $Option1[1]['value'] = "Featured";
     $Option1[2]['key'] = "2";
     $Option1[2]['value'] = "Not Featured";
     /*$featured_status= new Zend_Form_Element_Radio('featured_status');
     		$featured_status->setRequired(true)
     		->addMultiOptions($Option1)
     		->addValidator('NotEmpty',true,array('messages' =>'Please select status of featured.'))
     		->addDecorator('Errors', array('class'=>'error'))
     		->setValue($featuredstatus);*/
     $this->addElements(array($video_type, $video_path1, $video_path2, $video_title, $up_date, $video_description, $video_keyword, $video_status, $feature_path));
 }
Пример #25
0
 public function init($userId)
 {
     global $mySession;
     $db = new Db();
     if ($userId != "") {
         $adminData = $db->runQuery("select * from " . USERS . " where user_id='" . $userId . "'");
         $first_name_value = $adminData[0]['first_name'];
         $last_name_value = $adminData[0]['last_name'];
         $email_address_value = $adminData[0]['email_address'];
         $old_profile_image_value = $adminData[0]['image'];
         $gender_value = $adminData[0]['gender'];
         //$dob_value=$adminData[0]['dob'];
         $dob_value = changeDate($adminData[0]['dob'], 1);
         $location_value = $adminData[0]['location'];
         $country_value = $adminData[0]['country'];
         $blog_url_value = $adminData[0]['blog_url'];
         $website_url_value = $adminData[0]['website_url'];
         $about_me_value = $adminData[0]['about_me'];
         $occupation_value = $adminData[0]['occupation'];
         //$password_value=md5($adminData[0]['password']);
     }
     $first_name = new Zend_Form_Element_Text('first_name');
     $first_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($first_name_value);
     $this->addElement($first_name);
     $last_name = new Zend_Form_Element_Text('last_name');
     $last_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Last Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("onkeypress", "return checknummsp1(event);")->setValue($last_name_value);
     $this->addElement($last_name);
     $email_address = new Zend_Form_Element_Text('email_address');
     $email_address->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($email_address_value);
     $this->addElement($email_address);
     if (@$_REQUEST['email_address'] != "") {
         $email_address->addValidator('EmailAddress', true)->addErrorMessage('Please enter a valid email address');
     }
     $old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
     $old_profile_image->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($old_profile_image_value);
     $this->addElement($old_profile_image);
     $user_pic = new Zend_Form_Element_File('user_pic');
     $user_pic->setDestination(SITE_ROOT . 'images/profileimgs/');
     if ($userId == "") {
         $user_pic->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select a photo.'));
     }
     $user_pic->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'))->setValue($image_value);
     $this->addElement($user_pic);
     $GenderArr = array();
     $GenderArr[0]['key'] = "1";
     $GenderArr[0]['value'] = "Male";
     $GenderArr[1]['key'] = "2";
     $GenderArr[1]['value'] = "Female";
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->addMultiOptions($GenderArr)->setValue($gender_value);
     $this->addElement($gender);
     $countryArr = array();
     $sql = "select * from " . COUNTRIES;
     $countryData = $db->runQuery($sql);
     $countryArr[0]['key'] = 0;
     $countryArr[0]['value'] = "---Select Country---";
     $i = 1;
     foreach ($countryData as $key => $data) {
         $countryArr[$i]['key'] = $data['country_id'];
         $countryArr[$i]['value'] = $data['country_name'];
         $i++;
     }
     $country = new Zend_Form_Element_Select('country');
     $country->setRequired(true)->addMultiOptions($countryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setValue($country_value);
     $this->addElement($country);
     $password = new Zend_Form_Element_Text('password');
     $password->setAttrib("class", "textInput")->setValue($password_value);
     $this->addElement($password);
     $cpassword = new Zend_Form_Element_Password('cpassword');
     $cpassword->setAttrib("class", "textInput")->setValue($password_value);
     $this->addElement($cpassword);
     $npassword = new Zend_Form_Element_Password('npassword');
     $npassword->setAttrib("class", "textInput")->setValue($password_value);
     $this->addElement($npassword);
     if (isset($_REQUEST['changePass']) && $userId != "") {
         $npassword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Password is required.'))->addDecorator('Errors', array('class' => 'error'));
         $cpassword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Confirm password is required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $GenderArr = array();
     $GenderArr[0]['key'] = "1";
     $GenderArr[0]['value'] = "Male";
     $GenderArr[1]['key'] = "2";
     $GenderArr[1]['value'] = "Female";
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->addMultiOptions($GenderArr)->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Field is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($gender_value);
     $this->addElement($gender);
     $location = new Zend_Form_Element_Text('location');
     $location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Location is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($location_value);
     $this->addElement($location);
     $occupation = new Zend_Form_Element_Text('occupation');
     $occupation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Occupation is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($occupation_value);
     $this->addElement($occupation);
     $about_me = new Zend_Form_Element_Textarea('about_me');
     //$about_me->setRequired(true)
     //->addValidator('NotEmpty',true,array('messages' =>'Please enter this field.'))
     $about_me->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:150px; height:60px;")->setValue($about_me_value);
     $this->addElement($about_me);
     $blog_url = new Zend_Form_Element_Text('blog_url');
     //$blog_url->setRequired(true)
     //->addValidator('NotEmpty',true,array('messages' =>'Blog URL is required.'))
     $blog_url->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->addValidator('Hostname', true)->setAttrib("Placeholder", "http://")->setValue("{$website_url_value}");
     $this->addElement($blog_url);
     $website_url = new Zend_Form_Element_Text('website_url');
     //$website_url->setRequired(true)
     //->addValidator('NotEmpty',true,array('messages' =>'Website URL is required.'))
     $website_url->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->addValidator('Hostname', true)->setAttrib("Placeholder", "http://")->setValue("{$website_url_value}");
     $this->addElement($website_url);
 }
Пример #26
0
 public function init($planId)
 {
     global $mySession;
     $db = new Db();
     $plan_name_value = "";
     $old_plan_image_value = "";
     $nof_images_value = "0";
     $plan_price_value = "";
     $plan_validity_value = "";
     $Isfree_value = "0";
     $des_box_value = "1";
     $featured_business_value = "0";
     $offer_coupons_value = "0";
     if ($planId != "") {
         $planData = $db->runQuery("select * from " . SUBSCRIPTIONS . " where plan_id='" . $planId . "'");
         $plan_name_value = $planData[0]['plan_name'];
         $old_plan_image_value = $planData[0]['plan_image'];
         $nof_images_value = $planData[0]['nof_images'];
         $Isfree_value = $planData[0]['is_free'];
         $plan_price_value = $planData[0]['plan_price'];
         $plan_validity_value = $planData[0]['plan_validity'];
         $des_box_value = $planData[0]['des_box'];
         $featured_business_value = $planData[0]['featured_business'];
         $offer_coupons_value = $planData[0]['offer_coupons'];
     }
     $plan_name = new Zend_Form_Element_Text('plan_name');
     $plan_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Plan Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($plan_name_value);
     $this->addElement($plan_name);
     $plan_image = new Zend_Form_Element_File('plan_image');
     $plan_image->setDestination(SITE_ROOT . 'images/planimg/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'error'));
     $this->addElement($plan_image);
     $old_plan_image = new Zend_Form_Element_Hidden('old_plan_image');
     $old_plan_image->setValue($old_plan_image_value);
     $this->addElement($old_plan_image);
     $nof_images = new Zend_Form_Element_Text('nof_images');
     $nof_images->setAttrib("class", "textInput")->setAttrib("onkeypress", "return checknummsp(event);")->setValue($nof_images_value);
     $this->addElement($nof_images);
     $Isfree = new Zend_Form_Element_Checkbox('Isfree');
     $Isfree->setCheckedValue('1')->setUncheckedValue('0')->setAttrib("onclick", "SetFreeorPaid();")->setValue($Isfree_value);
     $this->addElement($Isfree);
     $plan_price = new Zend_Form_Element_Text('plan_price');
     $plan_price->setAttrib("class", "textInput")->setAttrib("onkeypress", "return checknummsp(event);")->setValue($plan_price_value);
     $this->addElement($plan_price);
     if ($_REQUEST['Isfree'] == '0') {
         $plan_price->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Plan price is required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $ValidityArr = array();
     for ($i = 0; $i <= 11; $i++) {
         $valueI = $i + 1;
         $ValidityArr[$i]['key'] = $valueI;
         $ValidityArr[$i]['value'] = $valueI . " Month";
     }
     $plan_validity = new Zend_Form_Element_Select('plan_validity');
     $plan_validity->addMultiOptions($ValidityArr)->setAttrib("class", "textInput")->setValue($plan_validity_value);
     $this->addElement($plan_validity);
     $desBoxArr = array();
     $desBoxArr[0]['key'] = "1";
     $desBoxArr[0]['value'] = "Textbox";
     $desBoxArr[1]['key'] = "2";
     $desBoxArr[1]['value'] = "HTML Editor";
     $des_box = new Zend_Form_Element_Radio('des_box');
     $des_box->addMultiOptions($desBoxArr)->setValue($des_box_value);
     $this->addElement($des_box);
     $featured_business = new Zend_Form_Element_Checkbox('featured_business');
     $featured_business->setCheckedValue('1')->setUncheckedValue('0')->setValue($featured_business_value);
     $this->addElement($featured_business);
     $offer_coupons = new Zend_Form_Element_Checkbox('offer_coupons');
     $offer_coupons->setCheckedValue('1')->setUncheckedValue('0')->setValue($offer_coupons_value);
     $this->addElement($offer_coupons);
 }
Пример #27
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'));
 }
Пример #28
0
 public function init($userId)
 {
     global $mySession;
     $db = new Db();
     $first_name_value = "";
     $last_name_value = "";
     $email_address_value = "";
     $password_o_value = "";
     $password_c_value = "";
     $user_status_value = "";
     $address_value = "";
     $country_id_value = "";
     $state_id_value = "";
     $city_id_value = "";
     $zipcode_value = "";
     $phone_number_value = "";
     $mobile_number_value = "";
     $subscribe_value = "1";
     $usertype_value = "1";
     if ($userId != "") {
         $adminData = $db->runQuery("select * from " . USERS . " where user_id='" . $userId . "'");
         $usertype_value = $adminData[0]['user_type'];
         $first_name_value = $adminData[0]['first_name'];
         $last_name_value = $adminData[0]['last_name'];
         $email_address_value = $adminData[0]['email_address'];
         $user_status_value = $adminData[0]['user_status'];
         $address_value = $adminData[0]['address'];
         $country_id_value = $adminData[0]['country_id'];
         $state_id_value = $adminData[0]['state_id'];
         $city_id_value = $adminData[0]['city_id'];
         $zipcode_value = $adminData[0]['zipcode'];
         $phone_number_value = $adminData[0]['phone_number'];
         $mobile_number_value = $adminData[0]['mobile_number'];
         $subscribe_value = $adminData[0]['newsletter_subscribe'];
     }
     $userTypeArr = array();
     $userTypeArr[0]['key'] = "1";
     $userTypeArr[0]['value'] = "Visitor";
     $userTypeArr[1]['key'] = "2";
     $userTypeArr[1]['value'] = "Service Provider";
     $usertype = new Zend_Form_Element_Radio('usertype');
     $usertype->addMultiOptions($userTypeArr)->setValue($usertype_value);
     $first_name = new Zend_Form_Element_Text('first_name');
     $first_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($first_name_value);
     $last_name = new Zend_Form_Element_Text('last_name');
     $last_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Last Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($last_name_value);
     $email_address = new Zend_Form_Element_Text('email_address');
     $email_address->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($email_address_value);
     $password_o = new Zend_Form_Element_Password('password_o');
     $password_o->setAttrib("class", "textInput");
     $password_c = new Zend_Form_Element_Password('password_c');
     $password_c->setAttrib("class", "textInput");
     if ($userId == "" || isset($_REQUEST['ChangePass']) && $userId != "") {
         $password_o->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Password is required.'))->addDecorator('Errors', array('class' => 'error'));
         $password_c->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Confirm password is required.'))->addDecorator('Errors', array('class' => 'error'));
     }
     $StatusArr = array();
     $StatusArr[0]['key'] = "1";
     $StatusArr[0]['value'] = "Active";
     $StatusArr[1]['key'] = "0";
     $StatusArr[1]['value'] = "Inactive";
     $user_status = new Zend_Form_Element_Select('user_status');
     $user_status->addMultiOptions($StatusArr)->setAttrib("class", "textInput")->setValue($user_status_value);
     $address = new Zend_Form_Element_Textarea('address');
     $address->setAttrib("class", "textInput")->setAttrib("rows", "3")->setValue($address_value);
     $CountryArr = array();
     $CountryArr[0]['key'] = "";
     $CountryArr[0]['value'] = "- - Country - -";
     $CountryData = $db->runQuery("select * from " . COUNTRIES . " order by country_name");
     if ($CountryData != "" and count($CountryData) > 0) {
         $i = 1;
         foreach ($CountryData as $key => $CountryValues) {
             $CountryArr[$i]['key'] = $CountryValues['country_id'];
             $CountryArr[$i]['value'] = $CountryValues['country_name'];
             $i++;
         }
     }
     $country_id = new Zend_Form_Element_Select('country_id');
     $country_id->setRequired(true)->addMultiOptions($CountryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("onchange", "getCountryState(this.value);")->setValue($country_id_value);
     $StateArr = array();
     $StateArr[0]['key'] = "";
     $StateArr[0]['value'] = "- - State - -";
     $chkCountryId = $country_id_value;
     if (isset($_REQUEST['country_id']) && $_REQUEST['country_id'] != "") {
         $chkCountryId = $_REQUEST['country_id'];
     }
     if ($chkCountryId != "") {
         $StateData = $db->runQuery("select * from " . STATE . " where country_id='" . $chkCountryId . "' order by state_name");
         if ($StateData != "" and count($StateData) > 0) {
             $i = 1;
             foreach ($StateData as $key => $StateValues) {
                 $StateArr[$i]['key'] = $StateValues['state_id'];
                 $StateArr[$i]['value'] = $StateValues['state_name'];
                 $i++;
             }
         }
     }
     $state_id = new Zend_Form_Element_Select('state_id');
     $state_id->setRequired(true)->addMultiOptions($StateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("onchange", "getStateCity(this.value);")->setValue($state_id_value);
     $CityArr = array();
     $CityArr[0]['key'] = "";
     $CityArr[0]['value'] = "- - City - -";
     $chkStateId = $state_id_value;
     if (isset($_REQUEST['state_id']) && $_REQUEST['state_id'] != "") {
         $chkStateId = $_REQUEST['state_id'];
     }
     if ($chkStateId != "") {
         $CityData = $db->runQuery("select * from " . CITIES . " where state_id='" . $chkStateId . "' order by city_name");
         if ($CityData != "" and count($CityData) > 0) {
             $i = 1;
             foreach ($CityData as $key => $CityValues) {
                 $CityArr[$i]['key'] = $CityValues['city_id'];
                 $CityArr[$i]['value'] = $CityValues['city_name'];
                 $i++;
             }
         }
     }
     $city_id = new Zend_Form_Element_Select('city_id');
     $city_id->setRequired(true)->addMultiOptions($CityArr)->addValidator('NotEmpty', true, array('messages' => 'City is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($city_id_value);
     $zipcode = new Zend_Form_Element_Text('zipcode');
     $zipcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Zipcode is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($zipcode_value);
     $phone_number = new Zend_Form_Element_Text('phone_number');
     $phone_number->setAttrib("class", "textInput")->setValue($phone_number_value);
     $mobile_number = new Zend_Form_Element_Text('mobile_number');
     $mobile_number->setAttrib("class", "textInput")->setValue($mobile_number_value);
     $SubscribeArr = array();
     $SubscribeArr[0]['key'] = "1";
     $SubscribeArr[0]['value'] = "Yes";
     $SubscribeArr[1]['key'] = "0";
     $SubscribeArr[1]['value'] = "No";
     $subscribe = new Zend_Form_Element_Radio('subscribe');
     $subscribe->addMultiOptions($SubscribeArr)->setValue($subscribe_value);
     $this->addElements(array($usertype, $first_name, $last_name, $email_address, $password_o, $password_c, $user_status, $address, $country_id, $state_id, $city_id, $zipcode, $phone_number, $mobile_number, $subscribe));
 }