コード例 #1
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Firstname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Lastname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'gender', array('label' => $translate->_('Gender'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('gender')->setAllowEmpty(true)->setMultiOptions(array('M' => $translate->translate('Man'), 'F' => $translate->translate('Female')));
     $this->addElement('text', 'birthdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth place'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthdistrict', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth district'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthcountry', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthnationality', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth nationality'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('type_id')->setAllowEmpty(true)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform_id', array('label' => 'Legal form', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('legalform_id')->setAllowEmpty(true)->setMultiOptions(Legalforms::getList());
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Taxpayer Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'zip', array('filters' => array('StringTrim'), 'label' => $translate->_('Zip code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'label' => $translate->_('City'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'onchange' => 'onChangeCountry( this );'));
     $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList(true));
     $this->addElement('text', 'phone', array('filters' => array('StringTrim'), 'label' => $translate->_('Phone'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'fax', array('filters' => array('StringTrim'), 'label' => $translate->_('Fax'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'class' => 'form-control'));
     $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('customers'));
     $this->addElement('submit', 'submit', array('label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
     $this->addElement('hidden', 'profile_id');
 }
コード例 #2
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Firstname'), 'description' => $translate->_('Write here your firstname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Lastname'), 'description' => $translate->_('Write here your lastname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('select', 'company_type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the company type'), 'class' => 'form-control large-input'));
     $this->getElement('company_type_id')->setAllowEmpty(false)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform', array('label' => $translate->_('Legal form'), 'required' => true, 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the type of company.'), 'class' => 'form-control large-input'));
     $this->getElement('legalform')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList());
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here your company name.'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'description' => $translate->_('Write here the VAT number.')));
     $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input', 'description' => $translate->_('Write the area code')));
     $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Tax payer number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'description' => $translate->_('Write the tax payer number.')));
     $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write the address'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Zip'), 'description' => $translate->_('Write the zip code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('City'), 'description' => $translate->_('Write here your city name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'required' => true, 'description' => $translate->_('Select your own country'), 'decorators' => array('Bootstrap'), 'class' => "form-control"));
     $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList())->setRequired(true);
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'description' => $translate->_('Write here your email'), 'class' => 'form-control large-input'));
     $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => $translate->_('Write here your password. (min.6 chars - max.20 chars)'), 'label' => $translate->_('Password'), 'class' => 'form-control large-input'));
     $this->addElement('submit', 'save', array('required' => false, 'label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary'));
     $this->addElement('hidden', 'customer_id');
 }
コード例 #3
0
ファイル: CustomerForm.php プロジェクト: kokkez/shineisp
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Firstname', 'description' => 'Write here your firstname.', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Lastname', 'description' => 'Write here your lastname.', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $this->addElement('text', 'birthdate', array('filters' => array('StringTrim'), 'required' => true, 'validators' => array(new Zend_Validate_Date('dd/mm/yyyy', 'it')), 'label' => 'Birthdate', 'description' => 'Write here your birthday (eg. dd/mm/yyyy)', 'decorators' => array('Composite'), 'class' => 'text-input medium-input'));
     $this->addElement('select', 'company_type_id', array('label' => 'Company Type', 'decorators' => array('Composite'), 'description' => 'Select the company type', 'class' => 'text-input large-input'));
     $this->getElement('company_type_id')->setAllowEmpty(false)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform', array('label' => 'Legalform', 'required' => true, 'decorators' => array('Composite'), 'description' => 'Select the type of company.', 'class' => 'text-input large-input'));
     $this->getElement('legalform')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList(true))->addValidator(new Shineisp_Validate_Customer());
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => 'Company Name', 'decorators' => array('Composite'), 'description' => 'Write here your company name.', 'class' => 'text-input large-input'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => 'Birthplace', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $this->addElement('text', 'birthdistrict', array('filters' => array('StringTrim'), 'label' => 'Birth District', 'decorators' => array('Composite'), 'class' => 'text-input medium-input', 'maxlength' => 2));
     $this->addElement('text', 'birthcountry', array('filters' => array('StringTrim'), 'label' => 'Country of Birth', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $this->addElement('text', 'birthnationality', array('filters' => array('StringTrim'), 'label' => 'Birth Nationality', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $vatValidator = new Shineisp_Validate_Vat();
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => 'VAT Number', 'decorators' => array('Composite'), 'class' => 'text-input large-input', 'description' => 'Write here the VAT code. Eg: IT123456789'));
     $this->getElement('vat')->addValidator($vatValidator);
     $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'label' => 'Area', 'decorators' => array('Composite'), 'class' => 'text-input medium-input', 'description' => 'Write the area code'));
     $fiscalcodeValidator = new Shineisp_Validate_Fiscalcode();
     $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => 'Tax payer number', 'decorators' => array('Composite'), 'class' => 'text-input large-input', 'description' => 'Write the tax payer number.'));
     $this->getElement('taxpayernumber')->addValidator($fiscalcodeValidator);
     $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Address', 'decorators' => array('Composite'), 'description' => 'Write the address', 'class' => 'text-input large-input'));
     $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Zip', 'description' => 'Write the zip code', 'decorators' => array('Composite'), 'class' => 'text-input medium-input'));
     $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'City', 'description' => 'Write here your city name', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $this->addElement('select', 'country_id', array('label' => 'Country', 'decorators' => array('Composite'), 'class' => 'text-input large-input'));
     $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList())->setRequired(true);
     $this->addElement('select', 'gender', array('label' => 'Gender', 'required' => true, 'decorators' => array('Composite'), 'class' => 'text-input medium-input'));
     $this->getElement('gender')->setAllowEmpty(false)->setMultiOptions(array('M' => 'M', 'F' => 'F'))->setRequired(true);
     $this->addElement('text', 'telephone', array('filters' => array('StringTrim'), 'label' => 'Telephone', 'required' => true, 'decorators' => array('Composite'), 'description' => 'Write here the contact (eg. +39.98368276)', 'class' => 'text-input medium-input'));
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'decorators' => array('Composite'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => 'Email', 'description' => 'Write here your email', 'class' => 'text-input large-input'));
     $this->addElement('submit', 'submit', array('required' => false, 'label' => 'Save', 'decorators' => array('Composite'), 'class' => 'button'));
     $this->addElement('hidden', 'customer_id');
 }
コード例 #4
0
ファイル: CompanyTypesForm.php プロジェクト: kokkez/shineisp
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Name'), 'class' => 'form-control'));
     $this->addElement('select', 'legalform_id', array('label' => $translate->_('Legal form'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('legalform_id')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList(true));
     $this->addElement('select', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control', 'multioptions' => array(0 => 'NO', 1 => 'YES')));
     $this->addElement('hidden', 'type_id');
 }
コード例 #5
0
ファイル: IndexController.php プロジェクト: kokkez/shineisp
 /**
  * Update the database item translation using the poedit!
  * This method creates a temporary file that helps you to parse the 
  * database table common contents.  
  */
 public function updatetranslationAction()
 {
     $content = "<?php\n ";
     $content .= "# WARNING: This file has been created only for the POEDIT software.\n";
     $content .= "#          You can delete it, if you don't use it! \n\n";
     // Setting Parameters
     $data = SettingsParameters::getAllInfo();
     foreach ($data as $item) {
         $content .= "echo _('" . $item['name'] . "');\n";
         $content .= "echo _('" . $item['description'] . "');\n";
     }
     // Server Types
     $data = Servers_Types::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Contact types
     $data = ContactsTypes::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Legal form
     $data = Legalforms::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Get the default navigation items
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/default/navigation.xml', 'nav');
     $navigation = new Zend_Navigation($config);
     // Iterate recursively using RecursiveIteratorIterator
     $pages = new RecursiveIteratorIterator($navigation, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($pages as $page) {
         $label = (string) $page->label;
         $content .= "echo _('{$label}');\n";
     }
     // Get the administration navigation items
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/navigation.xml', 'nav');
     $navigation = new Zend_Navigation($config);
     // Iterate recursively using RecursiveIteratorIterator
     $pages = new RecursiveIteratorIterator($navigation, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($pages as $page) {
         $label = $page->getLabel();
         $content .= "echo _('{$label}');\n";
     }
     $content .= "?>";
     Shineisp_Commons_Utilities::writefile($content, "tmp", "translations.php");
     die('Ok! Now update the default.po file by the poedit software');
 }
コード例 #6
0
ファイル: ProfileForm.php プロジェクト: kokkez/shineisp
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('First name'), 'description' => $translate->_('Write here your first name.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Last name'), 'description' => $translate->_('Write here your last name.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'birthdate', array('filters' => array('StringTrim'), 'validators' => array(new Zend_Validate_Date('dd/mm/yyyy', 'it')), 'label' => $translate->_('Birthdate'), 'description' => $translate->_('Write here your birthday (eg. dd/mm/yyyy)'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => $translate->_('Birthplace'), 'description' => $translate->_('Write here the birthplace.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('select', 'company_type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the company type'), 'class' => 'form-control large-input'));
     $this->getElement('company_type_id')->setAllowEmpty(false)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform', array('label' => $translate->_('Legal form'), 'required' => true, 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the type of company.'), 'class' => 'form-control large-input'));
     $this->getElement('legalform')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList());
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here your company name.'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth place'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'birthdistrict', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth District'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input', 'maxlength' => 2));
     $this->addElement('text', 'birthcountry', array('filters' => array('StringTrim'), 'label' => $translate->_('Country of Birth'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'birthnationality', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth Nationality'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     if (Settings::findbyParam('customer_vat')) {
         $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'description' => $translate->_('Write here the VAT number.')));
     }
     $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input', 'description' => 'Write the area code'));
     if (Settings::findbyParam('customer_taxpayernumber')) {
         $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Tax payer number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'description' => 'Write the tax payer number.'));
     }
     $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write the address'), 'class' => 'form-control large-input'));
     $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Zip'), 'description' => 'Write the zip code', 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('City'), 'description' => $translate->_('Write here your city name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'required' => true, 'description' => $translate->_('Select your own country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList())->setRequired(true);
     $this->addElement('select', 'gender', array('label' => $translate->_('Gender'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->getElement('gender')->setAllowEmpty(false)->setMultiOptions(array('M' => 'M', 'F' => 'F'))->setRequired(true);
     $this->addElement('select', 'newsletter', array('label' => $translate->_('Newsletter'), 'description' => $translate->_('Subscribe to our free content feeds and get all the news for your bought services and products.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->getElement('newsletter')->setAllowEmpty(false)->setMultiOptions(array('0' => $translate->_('No, I am not interested'), '1' => $translate->_('Yes, please send me your updates')))->setRequired(true);
     $this->addElement('select', 'contacttypes', array('label' => $translate->_('Contact Types'), 'required' => true, 'description' => $translate->_('Select the contact type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
     $this->getElement('contacttypes')->setAllowEmpty(false)->setMultiOptions(ContactsTypes::getList());
     $this->addElement('text', 'contact', array('filters' => array('StringTrim'), 'label' => $translate->_('Contact'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here the contact (eg. +39.98368276)'), 'class' => 'form-control medium-input'));
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'description' => $translate->_('Write here your email'), 'class' => 'form-control large-input'));
     $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => $translate->_('Write here your password. (min.6 chars - max.20 chars)'), 'label' => $translate->_('Password'), 'class' => 'form-control large-input'));
     $this->addElement('submit', 'submit', array('label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary'));
     $this->addElement('hidden', 'customer_id');
 }
コード例 #7
0
ファイル: CustomerForm.php プロジェクト: kokkez/shineisp
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('First name'), 'description' => $translate->_('Write here your firstname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Last name'), 'description' => $translate->_('Write here your lastname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthdate', array('filters' => array('StringTrim'), 'required' => true, 'validators' => array(new Zend_Validate_Date('dd/mm/yyyy', 'it')), 'label' => $translate->_('Birth date'), 'description' => $translate->_('Write here your birth date (eg. dd/mm/yyyy)'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth place'), 'required' => true, 'description' => $translate->_('Write here the birth place.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'company_type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the company type'), 'class' => 'form-control'));
     $this->getElement('company_type_id')->setAllowEmpty(false)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform', array('label' => $translate->_('Legal form'), 'required' => true, 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the type of company.'), 'class' => 'form-control'));
     $this->getElement('legalform')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList(true))->addValidator(new Shineisp_Validate_Customer());
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here your company name.'), 'class' => 'form-control'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Birth place'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthdistrict', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Birth District'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input', 'maxlength' => 2));
     $this->addElement('text', 'birthcountry', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Country of Birth'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthnationality', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Birth Nationality'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $vatValidator = new Shineisp_Validate_Vat();
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'description' => $translate->_('Write here the VAT code. Eg: IT123456789')));
     $this->getElement('vat')->addValidator($vatValidator);
     $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input', 'description' => $translate->_('Write the area code')));
     $fiscalcodeValidator = new Shineisp_Validate_Fiscalcode();
     $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Tax payer number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'description' => $translate->_('Write the tax payer number.')));
     $this->getElement('taxpayernumber')->addValidator($fiscalcodeValidator);
     $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write the address'), 'class' => 'form-control'));
     $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Zip'), 'description' => $translate->_('Write the zip code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('City'), 'description' => $translate->_('Write here your city name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'required' => true, 'description' => $translate->_('Select your own country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList())->setRequired(true);
     $this->addElement('select', 'gender', array('label' => $translate->_('Gender'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control medium-input'));
     $this->getElement('gender')->setAllowEmpty(false)->setMultiOptions(array('M' => 'M', 'F' => 'F'))->setRequired(true);
     $this->addElement('text', 'contact', array('filters' => array('StringTrim'), 'label' => $translate->_('Telephone'), 'required' => true, 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here the contact (eg. +39.98368276)'), 'class' => 'form-control medium-input'));
     $this->addElement('hidden', 'contacttypes', array('decorators' => array('Bootstrap')));
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'description' => $translate->_('Write here your email'), 'class' => 'form-control'));
     $mailValidator = new Shineisp_Validate_Email();
     $this->getElement('email')->addValidator($mailValidator);
     $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => $translate->_('Write here your password. (min.6 chars - max.20 chars)'), 'label' => $translate->_('Password'), 'class' => 'form-control'));
     $this->addElement('submit', 'submit', array('required' => false, 'label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-success btn-lg'));
     $this->addElement('hidden', 'customer_id');
 }
コード例 #8
0
ファイル: SignupForm.php プロジェクト: moay/shineisp
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElementPrefixPath('Default', APPLICATION_PATH . '/modules/default/forms/validate/', 'validate');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here your company name.'), 'class' => 'form-control'));
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('First name'), 'description' => $translate->_('Write here your first name.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Last name'), 'description' => $translate->_('Write here your lastname.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $email = $this->createElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'description' => $translate->_('Write here your email'), 'class' => 'form-control'));
     $email->addValidator('UniqueEmail', false, array(new Customers()));
     $this->addElement($email);
     // Password manager
     $passwordConfirmation = new Shineisp_Validate_PasswordConfirmation();
     $password = $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here your password. (min.8 chars - max.20 chars)'), 'validators' => array($passwordConfirmation, array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'class' => 'form-control', 'required' => true, 'label' => $translate->_('Password')));
     $password_confirm = $this->addElement('password', 'password_confirm', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Please repeat the password'), 'validators' => array($passwordConfirmation, array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'class' => 'form-control', 'required' => true, 'label' => 'Confirm Password'));
     if (Settings::findbyParam('customer_vat')) {
         #$vatValidator = new Shineisp_Validate_Vat();
         $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'description' => $translate->_('Write here the VAT code. Eg: IT123456789')));
         #$this->getElement('vat')->addValidator($vatValidator);
     }
     $this->addElement('select', 'company_type_id', array('label' => 'Company Type', 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the company type'), 'class' => 'form-control'));
     $this->getElement('company_type_id')->setAllowEmpty(false)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform', array('label' => $translate->_('Legal form'), 'required' => true, 'decorators' => array('Bootstrap'), 'description' => $translate->_('Select the type of company.'), 'class' => 'form-control'));
     $this->getElement('legalform')->setAllowEmpty(false)->setMultiOptions(Legalforms::getList(true))->addValidator(new Shineisp_Validate_Customer());
     if (Settings::findbyParam('customer_taxpayernumber')) {
         $fiscalcodeValidator = new Shineisp_Validate_Fiscalcode();
         $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Tax payer number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'description' => $translate->_('Write the tax payer number.')));
         # TODO: check both fiscalcode for generic person or giuridic person. (XYZYXZ88D22C123X and 1234567890)
         #$this->getElement('taxpayernumber')->addValidator($fiscalcodeValidator);
     }
     $this->addElement('submit', 'signup', array('label' => $translate->_('Create my account'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-success btn-lg'));
     $privKey = Settings::findbyParam('recaptcha_private_key');
     $pubKey = Settings::findbyParam('recaptcha_public_key');
     if (!empty($pubKey) && !empty($privKey)) {
         $recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
         $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $translate->_('Captcha Check'), 'description' => $translate->_('Type the characters you see in the picture below.'), 'captcha' => 'ReCaptcha', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'service' => $recaptcha)));
         $this->addElement($captcha);
     }
 }
コード例 #9
0
ファイル: Legalforms.php プロジェクト: kokkez/shineisp
 /**
  * Save the record
  *
  * @param posted var from the form
  * @return Boolean
  */
 public static function saveData($record, $id = null)
 {
     // Set the new values
     if (is_numeric($id)) {
         $legalform = self::find($id);
     } else {
         $legalform = new Legalforms();
     }
     $legalform->name = $record['name'];
     if ($legalform->trySave()) {
         return $legalform->legalform_id;
     }
     return false;
 }
コード例 #10
0
ファイル: Domains.php プロジェクト: kokkez/shineisp
 /**
  * saveCustomer
  * Save the owner of the domain when we download the information using the Soap service
  * @param $domaininfo
  * @param $owner
  * @return [boolean, Doctrine_Record]
  */
 public static function saveCustomer($domaininfo, $owner)
 {
     // Check the existence of the record
     $arrCustomer = CustomersDomainsRegistrars::getAllInfo($domaininfo['nichandle'], "customer_id as customerid");
     if (!empty($arrCustomer) && count($arrCustomer) > 0) {
         $customer = Doctrine::getTable('Customers')->find($arrCustomer['customerid']);
     } else {
         $customer = new Customers();
     }
     // Add the Customer
     $customer->firstname = $owner['firstname'];
     $customer->lastname = $owner['lastname'];
     $customer->email = $owner['email'];
     $customer->vat = $owner['vat'];
     $customer->company = $owner['organisation'];
     $customer->legalform_id = !empty($owner['legalform']) ? Legalforms::getIDbyName($owner['legalform']) : null;
     $customer->getLast()->toArray();
     if ($customer->trySave()) {
         return $customer;
     } else {
         return false;
     }
 }
コード例 #11
0
ファイル: Legalforms.php プロジェクト: kokkez/shineisp
 public function getAll()
 {
     $this->authenticate();
     return Legalforms::getList();
 }
コード例 #12
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/legalforms/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/legalforms/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/legalforms/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('list', 'legalforms', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         $params = $form->getValues();
         // Get the id
         $id = Legalforms::saveData($params, $params['legalform_id']);
         if (is_numeric($id)) {
             $this->_helper->redirector('edit', 'legalforms', 'admin', array('id' => $id, 'mex' => $this->translator->translate("The task requested has been executed successfully."), 'status' => 'success'));
         } else {
             $redirector->gotoUrl("/admin/legalforms/list/");
         }
     } else {
         $this->view->form = $form;
         $this->view->title = "Legal form edit";
         $this->view->description = "Here you can edit the customer legal form information.";
         return $this->render('applicantform');
     }
 }
コード例 #13
0
ファイル: CustomersForm.php プロジェクト: kokkez/shineisp
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Firstname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Lastname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'gender', array('label' => $translate->_('Gender'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('gender')->setAllowEmpty(true)->setMultiOptions(array('M' => 'Man', 'F' => 'Female'));
     $this->addElement('select', 'taxfree', array('label' => $translate->_('Tax free'), 'description' => $translate->_('If it is set as Yes all the taxes will be not added in the orders'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('taxfree')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'ignore_latefee', array('label' => $translate->_('Ignore late fee'), 'description' => $translate->_('If it is set as Yes this customers is not subject to late fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('ignore_latefee')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'language_id', array('label' => $translate->_('Default Language'), 'description' => $translate->_('All the messages sent to the customer will be send using the default language selected'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('language_id')->setAllowEmpty(true)->setMultiOptions(Languages::getList());
     $this->addElement('select', 'issubscriber', array('label' => $translate->_('Newsletter Subscription'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('issubscriber')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'isreseller', array('label' => $translate->_('Is Reseller'), 'description' => 'Set the user as reseller', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('isreseller')->setAllowEmpty(true)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('text', 'birthdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date'));
     $this->addElement('text', 'birthplace', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth place'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthdistrict', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth district'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthcountry', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'birthnationality', array('filters' => array('StringTrim'), 'label' => $translate->_('Birth nationality'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'group_id', array('label' => $translate->_('Group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('group_id')->setAllowEmpty(true)->setMultiOptions(CustomersGroups::getList());
     $this->addElement('select', 'type_id', array('label' => $translate->_('Company Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('type_id')->setAllowEmpty(true)->setMultiOptions(CompanyTypes::getList(true));
     $this->addElement('select', 'legalform_id', array('label' => 'Legal form', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('legalform_id')->setAllowEmpty(true)->setMultiOptions(Legalforms::getList());
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('button', 'customerupdate', array('label' => 'Customer Update', 'description' => 'Update the customer information retrieving the data from the registrar database.', 'decorators' => array('Bootstrap'), 'class' => 'button red customerupdate'));
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'taxpayernumber', array('filters' => array('StringTrim'), 'label' => $translate->_('Taxpayer Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('adminuploadlimit', 'admin', Isp::getActiveISPID());
         $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         if ($filetypes) {
             $file->addValidator('Extension', false, $filetypes);
         }
         if ($Byteslimit) {
             $file->addValidator('Size', false, $Byteslimit);
         }
         $file->addValidator('Count', false, 1);
         $this->addElement($file);
         $this->addElement('select', 'filecategory', array('label' => $translate->_('File Category'), 'decorators' => array('Bootstrap'), 'class' => 'text-input'));
         $this->getElement('filecategory')->setAllowEmpty(true)->setMultiOptions(FilesCategories::getList());
     }
     $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'label' => $translate->_('Zip code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'area', array('filters' => array('StringTrim'), 'label' => $translate->_('Area'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'label' => $translate->_('City'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'country_id', array('label' => $translate->_('Country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'onchange' => 'onChangeCountry( this );'));
     $this->getElement('country_id')->setAllowEmpty(false)->setMultiOptions(Countries::getList(true));
     $this->addElement('select', 'region_id', array('label' => $translate->_('Region'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'onchange' => 'onChangeRegions( this );'));
     $this->getElement('region_id')->setRegisterInArrayValidator(false)->addValidator(new Shineisp_Validate_Regions());
     $this->addElement('select', 'contacttypes', array('label' => $translate->_('Contact Types'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('contacttypes')->setAllowEmpty(false)->setMultiOptions(ContactsTypes::getList());
     $this->addElement('text', 'contact', array('filters' => array('StringTrim'), 'label' => $translate->_('Contact'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'class' => 'form-control'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Private Notes'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => 'Write here at least 6 characters.', 'label' => $translate->_('Password'), 'class' => 'form-control'));
     $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('customers'));
     $this->addElement('select', 'parent_id', array('label' => 'Reseller', 'decorators' => array('Bootstrap'), 'description' => 'Select the client who you want to join with the selected customer.', 'class' => 'form-control'));
     $criterias = array(array('where' => 'isreseller = ?', 'params' => '1'));
     $this->getElement('parent_id')->setAllowEmpty(true)->setMultiOptions(Customers::getList(true, $criterias));
     $this->addElement('submit', 'save', array('label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn'));
     $this->addElement('hidden', 'customer_id');
 }