コード例 #1
0
 public function init()
 {
     $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
     /*********** To check for publisher session data *********************/
     $storage_publisher = new Zend_Auth_Storage_Session('publisher_type');
     $publisher_data = $storage_publisher->read();
     $storage_company = new Zend_Auth_Storage_Session('company_type');
     $company_data = $storage_company->read();
     if ($publisher_data && $publisher_data != null) {
         $this->modelPublisher = new Model_DbTable_Users();
         $this->sessPublisherInfo = $this->modelPublisher->getInfoByUserId($publisher_data->id);
         $this->view->sessPublisherInfo = $this->sessPublisherInfo;
     } elseif ($company_data && $company_data != null) {
         $this->modelCompany = new Model_DbTable_Companies();
         $this->sessCompanyInfo = $this->modelCompany->getInfoByUserId($company_data->id);
         $this->view->sessCompanyInfo = $this->sessCompanyInfo;
     }
     $this->modelPage = new Model_DbTable_Page();
     $this->modelEnquiry = new Admin_Model_DbTable_Enquirys();
     /************* To Set The active section and links *******************/
     $controller = $this->_getParam('controller');
     $action = $this->_getParam('action');
     $title = $this->_getParam('title');
     $this->view->currentController = $controller;
     $this->view->currentAction = $action;
     $this->view->currentTitle = $title;
     $this->view->class_active = 'class="active"';
     /************* To Set The active section and links *******************/
     if ($title == 'contact-us') {
         $captcha = new Zend_Captcha_Image();
         $captcha->setImgDir('public/css/captcha/images/');
         $captcha->setImgUrl($this->view->serverUrl . $this->view->baseUrl() . '/public/css/captcha/images/');
         $captcha->setFont('public/css/captcha/fonts/times_new_yorker.ttf');
         $captcha->setWordlen(5);
         $captcha->setFontSize(28);
         $captcha->setLineNoiseLevel(3);
         $captcha->setWidth(161);
         $captcha->setHeight(75);
         $captcha->generate();
         /*$captcha= new Zend_Form_Element_Captcha('captcha', array(
                             'label' => "Please verify you're a human",
         
                             'captcha' => array(
                                 'captcha' => 'image',
         
                                 'font'=>'public/css/captcha/fonts/times_new_yorker.ttf',
                                 'imgDir'=>'public/css/captcha/images/',
                                 'imgUrl'=>$this->view->serverUrl.$this->view->baseUrl().'/public/css/captcha/images/',
                                 'wordLen' => 4,
                                 'fsize'=>20,
                                 'height'=>60,
                                 'width'=>250,
                                 'gcFreq'=>50,
                                 'expiration' => 300
                             )
                         ));
         				*/
         $this->view->captcha = $captcha;
     }
 }
コード例 #2
0
 /**
  * @author   : PhongTX - 10/08/2012
  * @name : showAction
  * @copyright   : FPT Online
  * @todo    : Show Action
  */
 public function showAction()
 {
     //Disable layout
     $this->_helper->layout->disableLayout(true);
     //Set no render view
     $this->_helper->viewRenderer->setNoRender(true);
     $wordlen = $this->_request->getParam('wordlen', '4');
     $width = $this->_request->getParam('width', '60');
     $height = $this->_request->getParam('height', '40');
     $captcha_id = trim(strip_tags($this->_request->getParam('captcha_id')));
     $captcha_id = !empty($captcha_id) ? $captcha_id : 'captchaID';
     //captcha new object
     if (APPLICATION_ENV != 'development') {
         $captcha = new Fpt_Captcha_ImageMem();
     } else {
         $captcha = new Zend_Captcha_Image();
     }
     //Set lenght string captcha
     $captcha->setWordLen($wordlen);
     //Set time out
     $captcha->setTimeout('300');
     //Set height image captcha
     $captcha->setHeight($height);
     //Set width image captcha
     $captcha->setWidth($width);
     //Set font captcha
     $captcha->setFontSize(14);
     $captcha->setDotNoiseLevel(0);
     $captcha->setLineNoiseLevel(0);
     if (APPLICATION_ENV != 'development') {
         //set image captcha url
         $captcha->setImgUrl($this->view->configView['url'] . '/captcha/viewimg/id');
     } else {
         //Set dir folder image captcha
         $captcha->setImgDir(APPLICATION_PATH . '/../public/captcha');
         //set image captcha url
         $captcha->setImgUrl($this->view->configView['url'] . '/captcha');
     }
     //Set file font use captcha
     $captcha->setFont(APPLICATION_PATH . '/data/fonts/tahoma.ttf');
     //set image captcha alt
     $captcha->setImgAlt('Mã xác nhận gửi bài viết đến tòa soạn');
     //Generate captcha
     $captcha->generate();
     //Render image captcha
     $image = $captcha->render();
     // difine out captcha id
     $input = '<input type="hidden" name="' . $captcha_id . '" id="' . $captcha_id . '" value ="' . $captcha->getId() . '" />';
     //Get word captcha
     $word = $captcha->getWord();
     //set session word captcha
     $_SESSION['word'] = $word;
     //Define array response
     $arrResponse = array('html' => $image . $input);
     //Return data json
     echo Zend_Json::encode($arrResponse);
     exit;
 }
コード例 #3
0
ファイル: AdEditForm.php プロジェクト: Tony133/zf-web
 public function init()
 {
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend('adsFields');
     $validateNonZeroValue = new Zend_Validate_GreaterThan(0);
     $validateDate = new Zend_Validate_Date('Y-m-d');
     $elementUserId = new Zend_Form_Element_Hidden('user_id');
     $elementLanguageId = new Zend_Form_Element_Hidden('language_id');
     $elementActive = new Zend_Form_Element_Hidden('active');
     $elementActive->setValue(1);
     $elementAdsCategoryId = new Zend_Form_Element_Select('ads_category_id');
     $elementAdsCategoryId->setLabel('adsCategoryId');
     $elementAdsCategoryId->setMultiOptions(Ads_Categories::getSelectOptions());
     $elementAdsCategoryId->addValidator($validateNonZeroValue);
     $elementAdsCategoryId->setRequired(true);
     $elementAdsTypeId = new Zend_Form_Element_Select('ads_type_id');
     $elementAdsTypeId->setLabel('adsTypeId');
     $elementAdsTypeId->setMultiOptions(Ads_Types::getSelectOptions());
     $elementAdsTypeId->addValidator($validateNonZeroValue);
     $elementAdsTypeId->setRequired(true);
     $elementValidBefore = new Standart_Form_Element_Date('valid_until');
     $elementValidBefore->setLabel('adsValidUntil');
     $elementValidBefore->addValidator($validateDate);
     $elementValidBefore->setRequired(true);
     $elementTitle = new Zend_Form_Element_Text('title');
     $elementTitle->setLabel('adsTitle');
     $elementTitle->setAttrib('size', 75);
     $elementTitle->setRequired(true);
     $elementDescription = new Zend_Form_Element_Textarea('description');
     $elementDescription->setLabel('adsDescription');
     $elementDescription->setRequired(true);
     $captchaImage = new Zend_Captcha_Image();
     $captchaImage->setFont(Standart_Main::getDirs('fonts', 'arial.ttf'));
     $captchaImage->setFontSize(30);
     $captchaImage->setWordlen(6);
     $captchaImage->setImgDir(Standart_Main::getDirs('wwwStatic', array('images', 'captcha')));
     $captchaImage->setImgUrl(Zend_Registry::get('config')->host->static . '/images/captcha/');
     $captchaImage->setWidth(175);
     $captchaImage->setHeight(75);
     $captchaImage->setName('captcha');
     $elementCaptcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => $captchaImage));
     $elementDoSave = new Zend_Form_Element_Submit('doSave');
     $subForm->addElements(array($elementUserId, $elementLanguageId, $elementActive, $elementAdsCategoryId, $elementAdsTypeId, $elementValidBefore, $elementTitle, $elementDescription, $elementCaptcha));
     $this->addSubForm($subForm, 'ads');
     $this->addElement($elementDoSave);
 }
コード例 #4
0
ファイル: Signin.php プロジェクト: nightraiser/rdine
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $emailAddress = $this->createElement('text', 'emailAddress');
     $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '40')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your Email.'))))->addValidator('EmailAddress', false, array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'Please enter a valid Host Name')))->addErrorMessage('Pleaes Enter Valid Email Address')->setValue('')->addFilter('StringToLower')->setRequired(true);
     $password = $this->createElement('password', 'password');
     $password->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '20')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your Password.')), array('StringLength', false, array(6, 20, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Your password is too short(>6).', Zend_Validate_StringLength::TOO_LONG => 'Your password is too long(<20).')))))->setRequired(true)->setValue('');
     $imageCaptcha = new Zend_Captcha_Image();
     $imageCaptcha->setWidth(120)->setWordlen(4)->setHeight(50)->setTimeout(900)->setFontSize(20)->setGcFreq(5)->setFont('Fonts/tahoma.ttf')->setImgDir('images/captcha/')->setImgUrl('/images/captcha/')->setDotNoiseLevel(0)->setLineNoiseLevel(0);
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => $imageCaptcha));
     $captcha->removeDecorator('Label')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('style', 'position:relative;margin-top:20px')->setRequired(false);
     $login = $this->createElement('submit', 'login');
     $login->setLabel("")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtnLgn login')->setIgnore(true);
     $InvalidAttempts = $this->createElement('hidden', 'InvalidAttempts');
     $InvalidAttempts->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label');
     $this->addElements(array($emailAddress, $password, $captcha, $login, $InvalidAttempts));
 }
コード例 #5
0
ファイル: ContactUs.php プロジェクト: nightraiser/rdine
 public function init()
 {
     $contact = array();
     $contact[] = array('key' => 'email', 'value' => ' Email');
     $contact[] = array('key' => 'phone', 'value' => ' Phone');
     $this->setAttrib('enctype', 'multipart/form-data');
     $contactName = $this->createElement('text', 'contactName');
     $contactName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '100')->setAttrib('class', 'input w90 required')->setAttrib('placeholder', 'Contact Name')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->setValue('')->setRequired(true);
     $address = $this->createElement('text', 'address');
     $address->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '500')->setAttrib('class', 'input w90')->setAttrib('placeholder', 'Address')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields')), array('StringLength', false, array(1, 500, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'address is too long(>510).')))))->setValue('')->setRequired(false);
     $city = $this->createElement('text', 'city');
     $city->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'input w90')->setAttrib('placeholder', 'City')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->addValidator('StringLength', false, array(1, 100))->setValue('')->setAttrib('maxlength', '100')->setRequired(false);
     $state = $this->createElement('text', 'state');
     $state->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'uinp1')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->addValidator('StringLength', false, array(1, 200))->setValue('')->setAttrib('maxlength', '200')->setRequired(false);
     $country = $this->createElement('text', 'country');
     $country->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'uinp1')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->addValidator('StringLength', false, array(1, 100))->setValue('')->setAttrib('maxlength', '100')->setRequired(false);
     $postalCode = $this->createElement('text', 'postalCode');
     $postalCode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'uinp1')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->addValidator('StringLength', false, array(1, 10))->setValue('')->setAttrib('maxlength', '10')->setRequired(false);
     $phone = $this->createElement('text', 'phone');
     $phone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'input w90')->setAttrib('placeholder', 'Phone')->setAttrib('maxlength', '15')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->setValue('')->setRequired(false);
     $emailAddress = $this->createElement('text', 'emailAddress');
     $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '40')->setAttrib('class', 'input w90')->setAttrib('placeholder', 'Email')->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields')), array('StringLength', false, array(5, 40))))->addValidator('EmailAddress')->addFilters(array('StringTrim'))->setRequired(true);
     $fax = $this->createElement('text', 'fax');
     $fax->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'uinp1')->setAttrib('maxlength', '15')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->setValue('')->setRequired(false);
     $website = $this->createElement('text', 'website');
     $website->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'uinp1')->setAttrib('maxlength', '255')->addFilters(array('StringTrim'))->setValue('')->setRequired(false);
     $moreinfo = $this->createElement('checkbox', 'moreinfo');
     $moreinfo->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'addcontact')->setRequired(false)->setChecked(false);
     $comments = $this->createElement('textarea', 'comments');
     $comments->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '1000')->setAttrib('rows', '3')->setAttrib('cols', '25')->setAttrib('class', 'input w90 textarea')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => ' *Required fields'))))->setRequired(true);
     $imageCaptcha = new Zend_Captcha_Image();
     $imageCaptcha->setWidth(120)->setWordlen(4)->setHeight(50)->setTimeout(900)->setFontSize(20)->setGcFreq(5)->setFont('Fonts/tahoma.ttf')->setImgDir('images/captcha/')->setImgUrl('/images/captcha/')->setDotNoiseLevel(0)->setLineNoiseLevel(0);
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => $imageCaptcha));
     $captcha->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('style', 'position:relative;float:left; width:200px;');
     $contactType = new Zend_Form_Element_Radio('contactType');
     $contactType->removeDecorator('Label')->removeDecorator('HtmlTag')->setMultiOptions($contact)->setValue('email')->setSeparator('&nbsp;&nbsp;&nbsp;')->setRequired(false);
     $submit = $this->createElement('button', 'submit');
     $submit->removeDecorator('Label')->removeDecorator('DtDdWrapper')->setValue('Submit')->setAttrib('class', 'submitBtn')->setIgnore(true);
     $type = $this->createElement('hidden', 'type');
     $type->removeDecorator('HtmlTag')->removeDecorator('Label');
     $this->addElements(array($contactName, $address, $city, $state, $country, $postalCode, $phone, $emailAddress, $fax, $website, $moreinfo, $comments, $contactType, $type, $captcha, $submit));
 }
コード例 #6
0
ファイル: Guest.php プロジェクト: nightraiser/rdine
 public function init()
 {
     $passwordConfirm = new Rdine_Validate_PasswordConfirmation();
     $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'));
     $emailAddress = $this->createElement('text', 'emailAddress');
     $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '40')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Email Address*')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your EmailAddress.'))))->addValidator('StringLength', false, array(5, 50))->addValidator('EmailAddress', false, array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'Please enter a valid Host Name')))->addErrorMessage('Pleaes Enter Valid Email Address')->addFilters(array('StringTrim'))->setValue('')->addFilter('StringToLower')->setRequired(true);
     $password = $this->createElement('password', 'password');
     $password->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '20')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Password*')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please enter your Password.')), array('StringLength', false, array(6, 20, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Your password is too short(>6).', Zend_Validate_StringLength::TOO_LONG => 'Your password is too long(<20).')))))->setRequired(true)->setValue('')->setIgnore(false);
     $confirmPassword = $this->createElement('password', 'password_confirm');
     $confirmPassword->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '20')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Confirm Password*')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please enter confirm Password.'))))->setRequired(true)->setValue('')->setIgnore(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')->setAttrib('placeholder', 'First Name*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter FirstName.')), array('Alnum')))->setValue('')->setRequired(true);
     $lastName = $this->createElement('text', 'lastName');
     $lastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Last Name')->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' => '1', 'cols' => '22'));
     $address->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '200')->setAttrib('class', 'inp1')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your Address.'))))->addValidator('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).')))->addFilters(array('StringTrim'))->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);
     //
     //
     //        $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);
     //
     //
     //		$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);
     //
     //        $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 Zipcode.'))))->setValue('')->setRequired(false);
     $countryCode = $this->createElement('text', 'countryCode');
     $countryCode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('style', 'width:116px; float:left')->setAttrib('placeholder', 'Code')->addFilters(array('StringTrim'))->setAttrib('placeholder', 'Code')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select country code.'))))->setValue('')->setAttrib('maxlength', '5')->setRequired(false);
     $phone = $this->createElement('text', 'phone');
     $phone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('style', 'float:right;')->setAttrib('placeholder', 'Phone*')->setAttrib('maxlength', '15')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Your Phone Number.'))))->addValidator('regex', false, array('pattern' => '/^[0-9 ]+$/', 'messages' => 'Enter a valid Phone Number'))->setValue('')->setRequired(false);
     $mobile = $this->createElement('text', 'mobile');
     $mobile->removeDecorator('Label')->removeDecorator('HtmlTag')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '15')->addFilters(array('StringTrim'))->setValue('');
     //        $favoritefood = $this->createElement('textArea', 'favoritefood');
     //        $favoritefood->removeDecorator('Label')
     //        		->removeDecorator('HtmlTag')
     //        		->setAttrib('maxlength', '1000')
     //        		->setAttrib('cols', '40')
     //			    ->setAttrib('rows', '4')
     //			    ->addFilters(array('StringTrim'))
     //        		->setValue('');
     //
     //        $favoritemusic =  $this->createElement('textArea', 'favoritemusic');
     //		$favoritemusic->removeDecorator('label')
     //					  ->removeDecorator('HtmlTag')
     //					  ->setAttrib('cols', '40')
     //			   		  ->setAttrib('rows', '4')
     //        			  ->setAttrib('maxlength', '1000')
     //        			  ->addFilters(array('StringTrim'))
     //        			  ->setvalue('')
     //        			  ->setrequired(false);
     $imageCaptcha = new Zend_Captcha_Image();
     $imageCaptcha->setWidth(120)->setWordlen(4)->setHeight(50)->setTimeout(900)->setFontSize(20)->setGcFreq(5)->setFont('Fonts/tahoma.ttf')->setImgDir('images/captcha/')->setImgUrl('/images/captcha/')->setDotNoiseLevel(0)->setLineNoiseLevel(0);
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => $imageCaptcha));
     $captcha->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('style', 'position:relative;margin-top:-10px;width:182px;');
     $register = $this->createElement('submit', 'register');
     $register->setLabel("Register")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtn')->setIgnore(true);
     $reset = $this->createElement('reset', 'reset');
     $reset->removeDecorator('Label')->removeDecorator('DtDdWrapper')->setLabel("Reset")->setAttrib('class', 'submitBtn')->setIgnore(true);
     $this->addElements(array($emailAddress, $password, $confirmPassword, $salution, $firstName, $lastName, $address, $postalCode, $phone, $countryCode, $mobile, $register, $reset, $captcha));
 }
コード例 #7
0
ファイル: Manager.php プロジェクト: nightraiser/rdine
 public function init()
 {
     $stateMapper = new Application_Model_CountrybdMapper();
     $states = $stateMapper->fetchAll();
     $stateList = array();
     $stateList[] = array('key' => '', 'value' => 'Select Country');
     foreach ($states as $state) {
         $stateList[] = array('key' => $state->getId(), 'value' => $state->getDescription());
     }
     $stateList[] = array('key' => 'find', 'value' => 'cant find your Country');
     $sourceofrestaurantMapper = new Application_Model_SourceofRestaurantDataMapper();
     $sources = $sourceofrestaurantMapper->fetchAll();
     $sourceList = array();
     $sourceList[] = array('key' => '', 'value' => 'Select Source');
     foreach ($sources as $source) {
         $sourceList[] = array('key' => $source->getId(), 'value' => $source->getDescription());
     }
     $passwordConfirm = new Rdine_Validate_PasswordConfirmation();
     //  	$confirmEmail = new Rdine_Validate_EMailConfirmation();
     $emailAddress = $this->createElement('text', 'emailAddress');
     $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '40')->setAttrib('title', 'Email Address')->setAttrib('placeholder', 'Email Address*')->addValidator('NotEmpty', true, array('messages' => 'Please enter your EmailAddress.'))->addValidator('EmailAddress', false, array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'Please enter a valid Host Name')))->addErrorMessage('Pleaes Enter Valid Email Address')->addFilters(array('StringTrim'))->setValue('')->addFilter('StringToLower')->setRequired(true);
     //	   $confirmEmailAdd = $this->createElement('text', 'confirmEmailAddress');
     //       $confirmEmailAdd->removeDecorator('Label')
     //        			->removeDecorator('HtmlTag')
     //        			->setAttrib('class','inp1')
     //        			->setAttrib('maxlength', '40')
     //        			->setAttrib('title', 'Confirm Email Address')
     //        			->setAttrib('placeholder', 'Confirm Email Address*')
     //                	->addValidators(array($confirmEmail,
     //                						  array('NotEmpty', true, array('messages' => 'Please confirm your EmailAddress.'))
     //                				))
     //                	->setValue('')
     //                	->addFilters(array('StringTrim'))
     //                	->addFilter('StringToLower')
     //                	->setRequired(true);
     $password = $this->createElement('password', 'password');
     $password->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '20')->setAttrib('title', 'Password')->setAttrib('placeholder', 'Password*')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please enter your Password.')), array('StringLength', false, array(6, 20, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Your password is too short(>6).', Zend_Validate_StringLength::TOO_LONG => 'Your password is too long(<20).')))))->setRequired(true)->setValue('');
     $confirmPassword = $this->createElement('password', 'password_confirm');
     $confirmPassword->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '20')->setAttrib('title', 'Confirm Password')->setAttrib('placeholder', 'Confirm Password*')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please Confirm your password.'))))->setRequired(true)->setValue('');
     $firstName = $this->createElement('text', 'firstName');
     $firstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'First Name')->setAttrib('placeholder', 'First Name*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter FirstName.')), array('StringLength', false, array(0, 30))))->setValue('')->setRequired(true);
     $lastName = $this->createElement('text', 'lastName');
     $lastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->addFilters(array('StringTrim'))->setAttrib('title', 'Last Name')->setAttrib('placeholder', 'Last Name')->addValidators(array(array('StringLength', false, array(0, 30))))->setAttrib('class', 'inp1')->setValue('')->setRequired(false);
     $countryCode = $this->createElement('text', 'countryCode');
     $countryCode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('style', 'width:116px; float:left')->setAttrib('readonly', 'readonly')->setAttrib('placeholder', 'Code')->setAttrib('title', 'Country Code')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select country code.'))))->setValue('')->setAttrib('maxlength', '5')->setRequired(false);
     $phone = $this->createElement('text', 'phone');
     $phone->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '10')->setAttrib('title', 'Phone')->setAttrib('style', 'width:325px; float:right;')->setAttrib('placeholder', 'Phone*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Your Phone Number.'))))->addValidator('regex', false, array('pattern' => '/^[0-9 ]+$/', 'messages' => 'Enter a valid Phone Number'))->setValue('')->setRequired(false);
     $rastaurantname = $this->createElement('text', 'restaurantName');
     $rastaurantname->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '225')->setAttrib('title', 'Restaurant/Group')->setAttrib('placeholder', 'Restaurant/Group*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter RestaurantName.'))))->setvalue('')->setrequired(true);
     $resownercountry = $this->createElement('text', 'resownercountry');
     $resownercountry->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'Country')->setAttrib('placeholder', 'Country*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Country.')), array('StringLength', false, array(0, 30)), array('Alnum')))->setValue('')->setRequired(false);
     $resownercity = $this->createElement('text', 'resownercity');
     $resownercity->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'City')->setAttrib('placeholder', 'City*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter City.')), array('StringLength', false, array(0, 30))))->setValue('')->setRequired(false);
     $resownerzipcode = $this->createElement('text', 'resownerzipcode');
     $resownerzipcode->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '10')->setAttrib('title', 'Zipcode')->setAttrib('placeholder', 'Zipcode')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Zipcode.')), array('StringLength', false, array(0, 10)), array('Alnum')))->setValue('')->setRequired(false);
     $region = $this->createElement('select', 'region');
     $region->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'State')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select Region.'))))->setRegisterInArrayValidator(false)->setRequired(true);
     $state = $this->createElement('select', 'state');
     $state->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'Country')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select State.'))))->addMultiOptions($stateList)->setRequired(true);
     $source = $this->createElement('select', 'source');
     $source->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'How did you hear about us?')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select source.'))))->addMultiOptions($sourceList)->setRequired(false);
     $sourcedescription = $this->createElement('textarea', 'sourcedescription');
     $sourcedescription->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '5000')->setAttrib('cols', '40')->setAttrib('rows', '4')->setAttrib('class', 'inp1')->setAttrib('title', 'Source Description')->setAttrib('placeholder', 'Would you like to provide more information')->setValue('')->addValidators(array(array('StringLength', false, array(1, 200, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Description is too long(>5000).')))))->setRequired(false);
     $city = $this->createElement('select', 'city');
     $city->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'City')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select City.'))))->setRegisterInArrayValidator(false)->setRequired(true);
     $cantfind = $this->createElement('hidden', 'cantfind');
     $cantfind->removeDecorator('HtmlTag')->removeDecorator('Label');
     $cantfindcity = $this->createElement('text', 'cantfindcity');
     $cantfindcity->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'Cant Find City')->setAttrib('placeholder', 'Enter Your City')->addValidators(array(array('StringLength', false, array(0, 30))))->setValue('')->setRequired(false);
     $cantfindstate = $this->createElement('text', 'cantfindstate');
     $cantfindstate->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'Cant Find Country')->setAttrib('placeholder', 'Enter Your Country')->addValidators(array(array('StringLength', false, array(0, 30))))->setValue('')->setRequired(false);
     $cantfindregion = $this->createElement('text', 'cantfindregion');
     $cantfindregion->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'Cant Find State')->setAttrib('placeholder', 'Enter Your State')->addValidators(array(array('StringLength', false, array(0, 30))))->setValue('')->setRequired(false);
     $description = $this->createElement('textarea', 'description');
     $description->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '5000')->setAttrib('cols', '40')->setAttrib('rows', '4')->setAttrib('class', 'inp1')->setAttrib('title', 'Description')->setAttrib('placeholder', 'Enter your comments')->setValue('')->addValidators(array(array('StringLength', false, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Description is too long(>5000).')))))->setRequired(false);
     $website = $this->createElement('text', 'website');
     $website->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '30')->setAttrib('title', 'Website')->setAttrib('placeholder', 'Website')->addValidators(array(array('StringLength', false, array(0, 30))))->setValue('')->setRequired(false);
     $dateofbirth = $this->createElement('text', 'dateofbirth');
     $dateofbirth->removeDecorator('Label')->setAttrib('class', 'inp1 datepicker')->removeDecorator('HtmlTag')->setAttrib('title', 'Date of Birth')->setAttrib('placeholder', 'Date of Birth')->addFilters(array('StringTrim'))->setValue('');
     $imageCaptcha = new Zend_Captcha_Image();
     $imageCaptcha->setWidth(200)->setWordlen(4)->setHeight(50)->setTimeout(900)->setFontSize(20)->setGcFreq(5)->setFont('Fonts/tahoma.ttf')->setImgDir('images/captcha/')->setImgUrl('/images/captcha/')->setDotNoiseLevel(0)->setLineNoiseLevel(0);
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => $imageCaptcha));
     $captcha->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('title', 'Captcha')->setAttrib('placeholder', 'Enter characters as shown in box *')->setAttrib('style', 'position:relative;margin-top:-10px;width:182px;');
     $register = $this->createElement('submit', 'register');
     $register->setLabel("Register")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtn')->setIgnore(true);
     $reset = $this->createElement('reset', 'reset');
     $reset->removeDecorator('Label')->removeDecorator('DtDdWrapper')->setLabel("Reset")->setAttrib('class', 'submitBtn')->setIgnore(true);
     $comapnyid = $this->createElement('hidden', 'comapnyid');
     $comapnyid->removeDecorator('HtmlTag')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
     $this->addElements(array($firstName, $lastName, $emailAddress, $password, $confirmPassword, $rastaurantname, $description, $phone, $source, $sourcedescription, $website, $dateofbirth, $register, $reset, $captcha, $comapnyid, $countryCode, $resownercity, $resownerzipcode));
 }