public function init() { $stateMapper = new Application_Model_StateDataMapper(); $states = $stateMapper->fetchAll(); $stateList = array(); $stateList[] = array('key' => '', 'value' => 'Select State'); foreach ($states as $state) { $stateList[] = array('key' => $state->getId(), 'value' => $state->getDescription()); } $userId = $this->createElement('hidden', 'userid'); $userId->removeDecorator('Label')->removeDecorator('HtmlTag'); $firstName = $this->createElement('text', 'firstName'); $firstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter FirstName.')), array('StringLength', false, array(0, 30)), array('Alnum')))->setValue('')->setRequired(true); $lastName = $this->createElement('text', 'lastName'); $lastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter LastName.')), array('StringLength', false, array(0, 30)), array('Alnum')))->setValue('')->setRequired(false); $rescodetext = $this->createElement('text', 'rescodetext'); $rescodetext->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('style', 'width:50px;')->setAttrib('readonly', 'readonly')->setAttrib('placeholder', 'Country Code')->setAttrib('title', 'Country Code')->addFilters(array('StringTrim'))->setValue('')->setAttrib('maxlength', '3')->setRequired(true); $phone = $this->createElement('text', 'phone'); $phone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('style', 'width:105px;')->setAttrib('maxlength', '10')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter PhoneNumber.'))))->addValidator('regex', false, array('pattern' => '/^[0-9 ]+$/', 'messages' => 'Enter a valid Phone Number'))->setValue('')->setRequired(true); $rastaurantname = $this->createElement('text', 'restaurantName'); $rastaurantname->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '225')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter RestaurantName.'))))->setvalue('')->setrequired(true); $state = $this->createElement('select', 'state'); $state->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select State.'))))->addMultiOptions($stateList)->setRequired(true); $region = $this->createElement('select', 'region'); $region->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select Region.'))))->setRegisterInArrayValidator(false)->setRequired(true); $city = $this->createElement('select', 'city'); $city->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select City.'))))->setRegisterInArrayValidator(false)->setRequired(true); $description = $this->createElement('textarea', 'description'); $description->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '5000')->setAttrib('cols', '40')->setAttrib('rows', '4')->setAttrib('class', 'inp1')->setValue('')->addValidators(array(array('StringLength', false, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Description is too long(>5000).')))))->setRequired(false); $techfirstName = $this->createElement('text', 'techfirstName'); $techfirstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('placeholder', 'Firstname')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->setValue(''); $techlastName = $this->createElement('text', 'techlastName'); $techlastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('placeholder', 'Lastname')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->setValue(''); $techemail = $this->createElement('text', 'techemail'); $techemail->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('placeholder', 'Email')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->addValidator('regex', false, array('pattern' => '/^([a-zA-Z0-9_\\-\\.]+)@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', 'messages' => 'Enter a valid Email'))->setValue(''); $techphone = $this->createElement('text', 'techphone'); $techphone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Phone')->setAttrib('style', 'width:105px;')->setAttrib('maxlength', '10')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter PhoneNumber.'))))->addValidator('regex', false, array('pattern' => '/^[0-9 ]+$/', 'messages' => 'Enter a valid Phone Number'))->setValue(''); $techrescode = $this->createElement('text', 'techrescodetext'); $techrescode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Code')->setAttrib('style', 'width:50px;')->setAttrib('readonly', 'readonly')->setAttrib('placeholder', 'Country Code')->setAttrib('title', 'Country Code')->addFilters(array('StringTrim'))->setValue('')->setAttrib('maxlength', '3'); $bilfirstName = $this->createElement('text', 'bilfirstName'); $bilfirstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('placeholder', 'Firstname')->addFilters(array('StringTrim'))->setValue(''); $billastName = $this->createElement('text', 'billastName'); $billastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Lastname')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->setValue(''); $bilemail = $this->createElement('text', 'bilemail'); $bilemail->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Email')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->addValidator('regex', false, array('pattern' => '/^([a-zA-Z0-9_\\-\\.]+)@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', 'messages' => 'Enter a valid Email'))->setValue(''); $bilphone = $this->createElement('text', 'bilphone'); $bilphone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Phone')->setAttrib('style', 'width:105px;')->setAttrib('maxlength', '10')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter PhoneNumber.'))))->addValidator('regex', false, array('pattern' => '/^[0-9 ]+$/', 'messages' => 'Enter a valid Phone Number'))->setValue(''); $bilrescode = $this->createElement('text', 'bilrescodetext'); $bilrescode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Code')->setAttrib('style', 'width:50px;')->setAttrib('readonly', 'readonly')->setAttrib('placeholder', 'Country Code')->setAttrib('title', 'Country Code')->addFilters(array('StringTrim'))->setValue('')->setAttrib('maxlength', '3'); $register = $this->createElement('submit', 'register'); $register->setLabel("Update")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtn')->setIgnore(true); $this->addElements(array($userId, $firstName, $lastName, $rastaurantname, $phone, $state, $region, $city, $description, $register, $rescodetext, $techfirstName, $techlastName, $techemail, $techphone, $techrescode, $bilfirstName, $bilemail, $billastName, $bilphone, $bilrescode)); }
public function init() { $userId = $this->createElement('hidden', 'userid'); $userId->removeDecorator('HtmlTag'); $stateMapper = new Application_Model_StateDataMapper(); $states = $stateMapper->fetchAll(); $stateList = array(); $stateList[] = array('key' => '0', 'value' => 'Select State'); foreach ($states as $state) { $stateList[] = array('key' => $state->getId(), 'value' => $state->getDescription()); } $resTypeMapper = new Application_Model_RestaurantTypeDataMapper(); $resTypes = $resTypeMapper->getRestauranttypeBD(); $resTypeList = array(); $resTypeList[] = array('key' => '0', 'value' => 'Select Cuisine'); foreach ($resTypes as $resType) { $resTypeList[] = array('key' => $resType->getId(), 'value' => $resType->getDescription()); } /*$cityMapper = new Application_Model_CityDataMapper(); $citys = $cityMapper->fetchAll(); $cityList = array(); $cityList[] = array('key'=>'0','value'=>'Select City'); foreach($citys as $city){ $cityList[] = array('key'=>$city->getId(),'value'=>$city->getDescription()); } $neighborhoodMapper = new Application_Model_NeighborhoodDataMapper(); $neighborhoods = $neighborhoodMapper->fetchAll(); $neighborhoodList = array(); $neighborhoodList[] = array('key'=>'0','value'=>'Select Neighborhod'); foreach($neighborhoods as $neighborhood){ $neighborhoodList[] = array('key'=>$neighborhood->getId(),'value'=>$neighborhood->getDescription()); } */ $states = $this->createElement('select', 'state'); $states->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->addMultiOptions($stateList)->setRequired(false); $restaurantType = $this->createElement('select', 'restype'); $restaurantType->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->addMultiOptions($resTypeList)->setRegisterInArrayValidator(false)->setRequired(false); $regions = $this->createElement('select', 'region'); $regions->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1 drpDown')->setRegisterInArrayValidator(false)->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select Region.')))); $citys = $this->createElement('select', 'city'); $citys->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setRegisterInArrayValidator(false)->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select City.')))); $neighborhoods = $this->createElement('select', 'neighborhood'); $neighborhoods->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setRegisterInArrayValidator(false)->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select Neighborhood.')))); $resPostalCode = $this->createElement('text', 'postalCode'); $resPostalCode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->addValidator('StringLength', false, array(3, 15))->setValue('')->setAttrib('maxlength', '10')->addFilters(array('StringTrim'))->setRequired(false); $restaurantName = $this->createElement('text', 'restName'); $restaurantName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '240')->setAttrib('class', 'inp1 required')->addValidator('StringLength', false, array(0, 240))->setValue('')->addFilters(array('StringTrim'))->setRequired(false); $resSearch = $this->createElement('submit', 'Search'); $resSearch->removeDecorator('Label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setValue('Submit')->setAttrib('class', 'submitBtn')->setIgnore(true); $this->addElements(array($userId, $states, $regions, $neighborhoods, $restaurantType, $citys, $resPostalCode, $restaurantName, $resSearch)); }
public function init() { $salutionList = array(array('key' => 'Mr', 'value' => 'Mr'), array('key' => 'Ms', 'value' => 'Ms'), array('key' => 'Mrs', 'value' => 'Mrs')); $gengerList = array(array('key' => 'Male', 'value' => 'Male'), array('key' => 'Female', 'value' => 'Female')); /* Populating State Base Data */ /* $cityMapper = new Application_Model_CityDataMapper(); $citys = $cityMapper->fetchAll(); $cityList = array(); foreach($citys as $city){ $cityList[] = array('key'=>$city->getId(),'value'=>$city->getDescription()); }*/ $stateMapper = new Application_Model_StateDataMapper(); $states = $stateMapper->fetchAll(); $stateList = array(); $stateList[] = array('key' => '', 'value' => 'Select State'); foreach ($states as $state) { $stateList[] = array('key' => $state->getId(), 'value' => $state->getDescription()); } $timezoneMapper = new Application_Model_TimeZoneDataMapper(); $timezones = $timezoneMapper->fetchAll(); $timezoneList = array(); $timezoneList[] = array('key' => '', 'value' => 'Select TimeZone'); foreach ($timezones as $timezone) { $timezoneList[] = array('key' => $timezone->getCode(), 'value' => $timezone->getCode() . $timezone->getDescription()); } $userId = $this->createElement('hidden', 'userid'); $userId->removeDecorator('Label')->removeDecorator('HtmlTag'); $emailAddress = $this->createElement('text', 'emailAddress'); $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '40')->setAttrib('readonly', 'readonly')->setValue('')->setRequired(false); $salution = $this->createElement('select', 'salution'); $salution->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2')->addMultiOptions($salutionList)->setRequired(false); $firstName = $this->createElement('text', 'firstName'); $firstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->setAttrib('class', 'inp1')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter FirstName.')), array('StringLength', false, array(0, 30)), array('Alnum')))->setValue('')->setRequired(true); $lastName = $this->createElement('text', 'lastName'); $lastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->setAttrib('class', 'inp1')->addFilters(array('StringTrim'))->addValidators(array(array('StringLength', false, array(0, 30)), array('Alnum')))->setValue('')->setRequired(false); // $gender = $this->createElement('select','gender'); // $gender->removeDecorator('Label') // ->removeDecorator('HtmlTag') // ->setAttrib('class', 'sel2') // ->addMultiOptions($gengerList) // ->setRequired(false); $address = $this->createElement('textarea', 'address', array('rows' => '4', 'cols' => '40')); $address->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '200')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your Address.')), array('StringLength', false, array(1, 200, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'address should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'address is too long(>200).')))))->setValue('')->setRequired(false); // $city = $this->createElement('select', 'city'); // $city->removeDecorator('Label') // ->removeDecorator('HtmlTag') // ->setAttrib('class', 'sel1') // ->addValidators(array // (array('NotEmpty', true, array('messages' => 'Please select City.')))) // ->setRegisterInArrayValidator(false) // ->setRequired(true); // // $region = $this->createElement('select', 'region'); // $region->removeDecorator('Label') // ->removeDecorator('HtmlTag') // ->setAttrib('class', 'sel1') // ->addValidators(array // (array('NotEmpty', true, array('messages' => 'Please select Region.')))) // ->setRegisterInArrayValidator(false) // ->setRequired(true); // // $neighborhood = $this->createElement('select','neighborhood'); // $neighborhood->removeDecorator('Label') // ->removeDecorator('HtmlTag') // ->setAttrib('class','sel1') // ->addValidators(array // (array('NotEmpty', true, array('messages' => 'Please select Neighborhood.')))) // ->setRegisterInArrayValidator(false) // ->setRequired(true); // // $state = $this->createElement('select','state'); // $state->removeDecorator('Label') // ->removeDecorator('HtmlTag') // ->setAttrib('class', 'sel1') // ->addValidators(array // (array('NotEmpty', true, array('messages' => 'Please select State.')))) // ->addMultiOptions($stateList) // ->setRequired(true); // $timezone = $this->createElement('select','timezone'); // $timezone->removeDecorator('label') // ->removeDecorator('HtmlTag') // ->setAttrib('class','sel1') // ->addValidators(array // (array('NotEmpty', true, array('messages' => 'Please select TimeZone.')))) // ->addMultiOptions($timezoneList) // ->setRequired(true); $postalCode = $this->createElement('text', 'postalCode'); $postalCode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '10')->setAttrib('class', 'inp1')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Zip code.'))))->setValue('')->setRequired(false); $phone = $this->createElement('text', 'phone'); $phone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '15')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Your Phone Number.'))))->setValue('')->setRequired(true); $favoritefood = $this->createElement('textarea', 'favoritefood'); $favoritefood->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '1000')->addFilters(array('StringTrim'))->addValidator('StringLength', false, array(0, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'favoritefood should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'favoritefood is too long(>1000).')))->setAttrib('cols', '40')->setAttrib('rows', '4')->setValue(''); $favoritemusic = $this->createElement('textarea', 'favoritemusic', array('rows' => '4', 'cols' => '40')); $favoritemusic->removeDecorator('lable')->removeDecorator('HtmlTag')->setAttrib('maxlength', '1000')->addFilters(array('StringTrim'))->addValidator('StringLength', false, array(0, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'favoritemusic should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'favoritemusic is too long(>1000).')))->setvalue('')->setrequired(false); $update = $this->createElement('submit', 'update'); $update->setLabel("Update")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtn')->setIgnore(true); $this->addElements(array($userId, $emailAddress, $salution, $firstName, $lastName, $address, $postalCode, $phone, $favoritefood, $favoritemusic, $update)); }