Exemple #1
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $users = new Users();
     $users_options = $users->getOptions();
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $activities = new PrimaryActivities();
     $activities_options = $activities->getTerms();
     $organisations = new Organisations();
     $organisations_options = $organisations->getOrgs();
     parent::__construct($options);
     $this->setName('people');
     $title = new Zend_Form_Element_Select('title');
     $title->setLabel('Title: ')->addFilters(array('StripTags', 'StringTrim'))->setValue('Mr')->addErrorMessage('Choose title of person')->setAttrib('class', 'span2 selectpicker show-menu-arrow')->addMultiOptions(array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Ms' => 'Ms', 'Dr' => 'Dr.', 'Prof' => 'Prof.', 'Sir' => 'Sir', 'Lord' => 'Lord', 'Lady' => 'Lady', 'Other' => 'Other', 'Captain' => 'Captain', 'Master' => 'Master', 'Dame' => 'Dame', 'Duke' => 'Duke', 'Admiral' => 'Admiral', 'Baron' => 'Baron', 'Baroness' => 'Baroness', 'Brigadier' => 'Brigadier', 'Captain' => 'Captain', 'Colonel' => 'Colonel', 'Colonel Sir' => 'Colonel Sir', 'Commander' => 'Commander', 'Commodore' => 'Commodore', 'Countess' => 'Countess', 'Earl' => 'Earl', 'Field Marshal Lord' => 'Field Marshal Lord', 'General' => 'General', 'Group Captain' => 'Group Captain', 'Lieutenant' => 'Lieutenant', 'Lieutenant Commander' => 'Lieutenant Commander', 'Lt-Col' => 'Lt-Col', 'Lt-Gen Sir' => 'Lt-Gen Sir', 'Maj-Gen' => 'Maj-Gen', 'Major' => 'Major', 'Prince' => 'Prince', 'Princesss' => 'Princess', 'Rear Admiral' => 'Rear Admiral', 'Squadron Leader' => 'Squadron Leader', 'The Baroness' => 'The Baroness', 'The Countess' => 'The Countess', 'The Countess of' => 'The Countess of', 'The Duchess of' => 'The Duchess of', 'The Duke of' => 'The Duke of', 'The Earl of' => 'The Earl of', 'The Hon' => 'The Hon', 'His Honour Judge' => 'His Honour Judge', 'The Hon Mrs' => 'The Hon Mrs', 'The Marchioness of' => 'The Marchioness of', 'The Marquess of' => 'The Marquess of', 'The Viscount' => 'The Viscount', 'The Viscountess' => 'The Viscountess', 'Wing Commander' => 'Wing Commander', 'The Reverend' => 'The Reverend', 'Archbishop' => 'Archbishop', 'Canon' => 'Canon', 'Bishop' => 'Bishop'));
     $forename = new Zend_Form_Element_Text('forename');
     $forename->setLabel('Forename: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter person\'s forename')->addFilter(new Zend_Filter_Callback(array('callback' => 'ucfirst')));
     $surname = new Zend_Form_Element_Text('surname');
     $surname->setLabel('Surname: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addFilter(new Zend_Filter_Callback(array('callback' => 'ucfirst')))->addErrorMessage('Please enter person\'s surname');
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Fullname: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter person\'s fullname');
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->addFilters(array('StringTrim', 'StringToLower', 'StripTags'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false, array('mx' => true))->setAttrib('size', '60');
     $dbaseID = new Zend_Form_Element_Select('dbaseID');
     $dbaseID->setLabel('User account: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Int')->addValidator('InArray', false, array(array_keys($users_options), null))->addMultiOptions(array(null => 'Choose a user account', 'Existing accounts' => $users_options))->addErrorMessage('You must enter a database account.');
     $canRecord = $this->addElement('checkbox', 'canRecord', array('label' => 'Allowed to record: '))->canRecord;
     $address = new Zend_Form_Element_Text('address');
     $address->SetLabel('Address: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 500));
     $town_city = new Zend_Form_Element_Text('town_city');
     $town_city->SetLabel('Town: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 200));
     $countyID = new Zend_Form_Element_Select('countyID');
     $countyID->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Please choose a county', 'Valid counties' => $county_options));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper', 'Purifier'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions(array(null => 'Please choose a country of residence', 'Valid countries' => $countries_options))->setValue('GB');
     $hometel = new Zend_Form_Element_Text('hometel');
     $hometel->SetLabel('Home telephone number: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 30));
     $worktel = new Zend_Form_Element_Text('worktel');
     $worktel->SetLabel('Work telephone number: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 30));
     $fax = new Zend_Form_Element_Text('faxno');
     $fax->SetLabel('Fax number: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 30));
     $comments = new Pas_Form_Element_CKEditor('comments');
     $comments->SetLabel('Comments: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $organisationID = new Zend_Form_Element_Select('organisationID');
     $organisationID->SetLabel('Organisation attached to: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Please choose an organisation', 'Valid organisations' => $organisations_options))->addValidator('InArray', false, array(array_keys($organisations_options)));
     $primary_activity = new Zend_Form_Element_Select('primary_activity');
     $primary_activity->SetLabel('Person\'s primary activity: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Int')->addValidator('InArray', false, array(array_keys($activities_options)))->addMultiOptions(array(null => 'Choose a primary activity', 'Valid activities' => $activities_options))->addErrorMessage('You must enter an activity for this person.');
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($title, $forename, $surname, $fullname, $email, $address, $town_city, $countyID, $postcode, $country, $dbaseID, $canRecord, $hometel, $worktel, $fax, $comments, $organisationID, $primary_activity, $submit));
     $this->addDisplayGroup(array('title', 'forename', 'surname', 'fullname', 'email', 'address', 'town_city', 'countyID', 'postcode', 'country', 'dbaseID', 'canRecord', 'hometel', 'worktel', 'faxno', 'comments', 'organisationID', 'primary_activity'), 'details');
     $this->details->setLegend('Person details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 private function buildCountries($xml)
 {
     $countries = new Countries();
     $countryArray = array();
     foreach ($xml->Country as $country) {
         $tmpCountry = new Country();
         $tmpCountry->setCode((string) $country->Code);
         $tmpCountry->setGeoCoding((string) $country->Geocoding);
         $tmpCountry->setName((string) $country->Name);
         array_push($countryArray, $tmpCountry);
     }
     $countries->setCountry($countryArray);
     return $countries;
 }
 public function __construct($options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new Counties();
     $counties_options = $counties->getCountyname2();
     $peoples = new Peoples();
     $people_options = $peoples->getNames2();
     parent::__construct($options);
     $this->setName('organisation');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li')));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Organisation name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter an organisation name: ')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $website = new Zend_Form_Element_Text('website');
     $website->setLabel('Organisation website: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Pas_Validate_Url())->addErrorMessage('Please enter a valid URL')->setAttrib('size', 60)->setDecorators($decorators);
     $address1 = new Zend_Form_Element_Text('address1');
     $address1->setLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $address2 = new Zend_Form_Element_Text('address2');
     $address2->setLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $address3 = new Zend_Form_Element_Text('address3');
     $address3->setLabel('Address line three: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $address = new Zend_Form_Element_Text('address');
     $address->setLabel('Full address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $town_city = new Zend_Form_Element_Text('town_city');
     $town_city->setLabel('Town or city: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a county', 'Valid counties' => $counties_options))->addValidator('InArray', false, array(array_keys($counties_options)))->setDecorators($decorators);
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(true)->setValue('GB')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a country', 'Valid countries' => $countries_options))->addValidator('InArray', false, array(array_keys($countries_options)))->setDecorators($decorators);
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 10))->addValidator('ValidPostCode')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('Please enter a valid postcode')->setAttrib('size', 10)->setDecorators($decorators);
     $contactperson = new Zend_Form_Element_Text('contact');
     $contactperson->setLabel('Organisation\'s lead contact: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setAttrib('size', 50)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators);
     $contactpersonID = new Zend_Form_Element_Hidden('contactpersonID');
     $contactpersonID->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label');
     $submit = $this->addElement('submit', 'submit', array('label' => 'Login...'));
     $submit = $this->getElement('submit');
     $submit->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'large');
     $this->addElements(array($name, $website, $address1, $address2, $address3, $address, $town_city, $county, $country, $postcode, $contactperson, $contactpersonID));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElement($hash);
     $this->addDisplayGroup(array('name', 'website', 'address1', 'address2', 'address3', 'address', 'town_city', 'county', 'country', 'postcode', 'contact', 'contactpersonID'), 'details');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->setLegend('Organisation details: ');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Exemple #4
0
 public function isValid($value, $context = null)
 {
     if (!empty($value)) {
         $this->vat = $value;
         $countryid = intval($context['country_id']);
         if ($countryid == 0) {
             $this->_error(self::ISNOTCOUNTRYID);
             return false;
         }
         $country = Countries::find($context['country_id']);
         if (!empty($country->code)) {
             $this->countryCode = $country->code;
         } else {
             return false;
         }
         if (Countries::isITbyId($countryid)) {
             if (!is_numeric($value) || strlen($value) != 11) {
                 $this->_error(self::INVALIDVAT);
                 return false;
             }
         } elseif (Countries::isUEbyId($countryid)) {
             return $this->eu_check();
         }
     }
     return true;
 }
 public static function getTrack($country)
 {
     $country = Countries::getEnglishName($country);
     $encodedJSON = file_get_contents("https://api.spotify.com/v1/search?type=track&q=" . urlencode($country));
     $tracks = json_decode($encodedJSON)->tracks;
     return $tracks->items[0]->preview_url;
 }
 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');
 }
Exemple #7
0
 /**
  * get img for team
  * @param object ranking row
  * @param int type = 1 for club small logo, 2 for country
  * @return html string
  */
 public static function getLogo($item, $type = 1)
 {
     if ($type == 1) {
         if (!empty($item->logo_small)) {
             return JHtml::image($item->logo_small, $item->short_name, 'class="teamlogo"');
         }
     } else {
         if ($type == 2 && !empty($item->country)) {
             return Countries::getCountryFlag($item->country, 'class="teamcountry"');
         } else {
             if ($type == 3) {
                 if (!empty($item->team_picture)) {
                     return JHtml::image($item->team_picture, $item->short_name, 'class="teamlogo"');
                 }
             } else {
                 if ($type == 4) {
                     if (!empty($item->projectteam_picture)) {
                         return JHtml::image($item->projecteam_picture, $item->short_name, 'class="teamlogo"');
                     }
                 }
             }
         }
     }
     return '';
 }
 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');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Empty the countries table
     DB::table('countries')->delete();
     if (DB::table('countries')->count() == 0) {
         //Get all of the countries
         $countries = Countries::getList();
         foreach ($countries as $countryId => $country) {
             DB::table('countries')->insert(array('id' => $countryId, 'capital' => isset($country['capital']) ? $country['capital'] : null, 'citizenship' => isset($country['citizenship']) ? $country['citizenship'] : null, 'country_code' => $country['country-code'], 'currency' => isset($country['currency']) ? $country['currency'] : null, 'currency_code' => isset($country['currency_code']) ? $country['currency_code'] : null, 'currency_sub_unit' => isset($country['currency_sub_unit']) ? $country['currency_sub_unit'] : null, 'full_name' => isset($country['full_name']) ? $country['full_name'] : null, 'iso_3166_2' => $country['iso_3166_2'], 'iso_3166_3' => $country['iso_3166_3'], 'name' => $country['name'], 'region_code' => $country['region-code'], 'sub_region_code' => $country['sub-region-code'], 'eea' => (bool) $country['eea']));
         }
     }
     // Source: http://www.bitboost.com/ref/international-address-formats.html
     // Source: https://en.wikipedia.org/wiki/Linguistic_issues_concerning_the_euro
     $countries = ['AR' => ['swap_postal_code' => true], 'AT' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'BE' => ['swap_postal_code' => true], 'BG' => ['swap_currency_symbol' => true], 'CH' => ['swap_postal_code' => true], 'CZ' => ['swap_currency_symbol' => true], 'DE' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'DK' => ['swap_postal_code' => true], 'EE' => ['swap_currency_symbol' => true], 'ES' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'FI' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'FR' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'GR' => ['swap_currency_symbol' => true], 'HR' => ['swap_currency_symbol' => true], 'HU' => ['swap_currency_symbol' => true], 'GL' => ['swap_postal_code' => true], 'IE' => ['thousand_separator' => ',', 'decimal_separator' => '.'], 'IL' => ['swap_postal_code' => true], 'IS' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'IT' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'JP' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'LT' => ['swap_currency_symbol' => true], 'LU' => ['swap_postal_code' => true], 'MY' => ['swap_postal_code' => true], 'MX' => ['swap_postal_code' => true], 'NL' => ['swap_postal_code' => true], 'PL' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'PT' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'RO' => ['swap_currency_symbol' => true], 'SE' => ['swap_postal_code' => true, 'swap_currency_symbol' => true], 'SI' => ['swap_currency_symbol' => true], 'SK' => ['swap_currency_symbol' => true], 'UY' => ['swap_postal_code' => true]];
     foreach ($countries as $code => $data) {
         $country = Country::where('iso_3166_2', '=', $code)->first();
         if (isset($data['swap_postal_code'])) {
             $country->swap_postal_code = true;
         }
         if (isset($data['swap_currency_symbol'])) {
             $country->swap_currency_symbol = true;
         }
         if (isset($data['thousand_separator'])) {
             $country->thousand_separator = $data['thousand_separator'];
         }
         if (isset($data['decimal_separator'])) {
             $country->decimal_separator = $data['decimal_separator'];
         }
         $country->save();
     }
 }
Exemple #10
0
 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');
 }
Exemple #11
0
 public function __construct($options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new Counties();
     $county_options = $counties->getCountyName2();
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('coroner');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Come on it\'s not that hard, enter a firstname!')->setDecorators($decorators);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false)->setDecorators($decorators);
     $address_1 = new Zend_Form_Element_Text('address_1');
     $address_1->SetLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('NotEmpty'))->addMultiOptions(array(NULL => 'Choose county', 'Valid county' => $county_options))->setDecorators($decorators);
     $region_name = new Zend_Form_Element_Text('region_name');
     $region_name->SetLabel('Administrative region: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode')->setDecorators($decorators);
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions($countries_options)->setValue('GB')->setDecorators($decorators);
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large');
     $this->addElements(array($firstname, $lastname, $email, $address_1, $address_2, $town, $postcode, $county, $country, $telephone, $fax, $region_name, $submit));
     $this->addDisplayGroup(array('firstname', 'lastname', 'region_name', 'email', 'address_1', 'address_2', 'town', 'postcode', 'county', 'country', 'telephone', 'fax'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
     $this->details->setLegend('Submit Coroner\'s details ');
 }
 public function loadModel($id)
 {
     $model = Countries::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #13
0
 /**
  * Get country code
  *
  * @param string $country
  * @return string
  */
 protected static function countryCode($country)
 {
     $country = (string) $country;
     if (strlen($country) != 2) {
         $country = Countries::getCode($country);
     }
     return $country;
 }
Exemple #14
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = Countries::getCountryOptions();
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemple #15
0
 protected function ShowForm()
 {
     $this->set('extrafields', RegistrationData::GetCustomFields());
     $this->set('allairlines', OperationsData::GetAllAirlines(true));
     $this->set('allhubs', OperationsData::GetAllHubs());
     $this->set('countries', Countries::getAllCountries());
     $this->render('registration_mainform.tpl');
 }
Exemple #16
0
 public function getCountry($id)
 {
     $country = Countries::where('region_id', '=', $id)->get();
     $html = '<option></option>';
     foreach ($country as $c) {
         $html .= "<option value='" . $c->id . "'>" . $c->name . "</option>";
     }
     echo $html;
 }
Exemple #17
0
 public function getDisplayCountry()
 {
     $flagname = strtolower($this->array["country"]);
     $flagpath = "images/flags/" . $flagname . ".png";
     if (!file_exists($flagpath)) {
         $flagpath = "images/flags/unknown.png";
     }
     return $country = '<img src="' . $flagpath . '"> ' . Countries::short2long($this->array['country']);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('country')->delete();
     Countries::create(array('id' => 1, 'name' => 'Ukraine', 'description' => 'Ukraina is a country in Eastern Europe', 'user_id' => 1));
     Countries::create(array('id' => 2, 'name' => 'USA', 'description' => 'The United States of America, is a federal republic composed of 50 states', 'user_id' => 1));
     Countries::create(array('id' => 3, 'name' => 'China', 'description' => 'China, is a sovereign state in East Asia. It is the worlds most populous country, with a population of over 1.35 billion.', 'user_id' => 1));
     $this->command->info('Countries table seeded!');
 }
 /**
  * Get the countries from the JSON file, if it hasn't already been loaded.
  *
  * @return array
  */
 public static function getCountries()
 {
     //Get the countries from the JSON file
     if (sizeof(Countries::$countries) == 0) {
         Countries::$countries = json_decode(file_get_contents(__DIR__ . '/countries.json'), true);
     }
     //Return the countries
     return Countries::$countries;
 }
 public function getIndex($id)
 {
     $countries = Countries::getList('en', 'json', 'cldr');
     $roles = $this->roleRepo->findByAppId($id);
     $this->layout->content = View::make('notifications.index')->with('roles', dropdownFormat($roles))->with('appId', $id)->with('countries', json_decode($countries));
     $app = $this->appRepo->findById($id);
     $this->layout->sidebarLeft = View::make('sidebars.app')->with('app', $app);
     return $this->layout;
 }
Exemple #21
0
 public function display($tpl = null)
 {
     if ($this->getLayout() == 'assignplayers') {
         $this->_displayAssignPlayers($tpl);
         return;
     }
     JHtml::_('behavior.calendar');
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $option = $jinput->getCmd('option');
     $params = JComponentHelper::getParams($option);
     $model = $this->getModel();
     $filter_state = $app->getUserStateFromRequest($this->get('context') . '.filter_state', 'filter_state', '', 'word');
     $filter_order = $app->getUserStateFromRequest($this->get('context') . '.filter_order', 'filter_order', 'pl.ordering', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest($this->get('context') . '.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $app->getUserStateFromRequest($this->get('context') . '.search', 'search', '', 'string');
     $search_mode = $app->getUserStateFromRequest($this->get('context') . '.search_mode', 'search_mode', '', 'string');
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $app->setUserState($option . 'task', '');
     // state filter
     $lists['state'] = JHtml::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $lists['search_mode'] = $search_mode;
     //build the html select list for positions
     $positionsList[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_POSITION'));
     $positions = JModelLegacy::getInstance('person', 'joomleaguemodel')->getPositions();
     if ($positions) {
         $positions = array_merge($positionsList, $positions);
     }
     $lists['positions'] = $positions;
     unset($positionsList);
     //build the html options for nation
     $nation[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_NATION'));
     if ($res = Countries::getCountryOptions()) {
         $nation = array_merge($nation, $res);
     }
     $lists['nation'] = $nation;
     unset($nation);
     $this->user = JFactory::getUser();
     $this->config = JFactory::getConfig();
     $this->lists = $lists;
     $this->items = $items;
     $this->pagination = $pagination;
     $this->request_url = JFactory::getURI()->toString();
     $this->component_params = $params;
     $sideMenu = JoomleagueHelper::sideMenu();
     $this->sidebar = $sideMenu;
     $this->addToolbar();
     parent::display($tpl);
 }
Exemple #22
0
 public function getIndex()
 {
     $hotel = Hotel::find(1);
     $regions = Regions::all();
     $country = Countries::where('region_id', '=', $hotel->city->province->country->region->id)->get();
     $province = Provinces::where('country_id', '=', $hotel->city->province->country->id)->get();
     $city = Cities::where('province_id', '=', $hotel->city->province->id)->get();
     $options = array('hotel' => $hotel, 'regions' => $regions, 'country' => $country, 'province' => $province, 'city' => $city);
     return View::make('home/dashboard', array())->nest('content', 'hotel/profile', $options);
 }
 /**
  * Run the database seeds.
  *
  * @return  void
  */
 public function run()
 {
     //Empty the countries table
     DB::table(\Config::get('countries.table_name'))->delete();
     //Get all of the countries
     $countries = Countries::getList();
     foreach ($countries as $countryId => $country) {
         DB::table(\Config::get('countries.table_name'))->insert(array('id' => $countryId, 'capital' => isset($country['capital']) ? $country['capital'] : null, 'citizenship' => isset($country['citizenship']) ? $country['citizenship'] : null, 'country_code' => $country['country-code'], 'currency' => isset($country['currency']) ? $country['currency'] : null, 'currency_code' => isset($country['currency_code']) ? $country['currency_code'] : null, 'currency_sub_unit' => isset($country['currency_sub_unit']) ? $country['currency_sub_unit'] : null, 'full_name' => isset($country['full_name']) ? $country['full_name'] : null, 'iso_3166_2' => $country['iso_3166_2'], 'iso_3166_3' => $country['iso_3166_3'], 'name' => $country['name'], 'region_code' => $country['region-code'], 'sub_region_code' => $country['sub-region-code'], 'eea' => (bool) $country['eea'], 'calling_code' => $country['calling_code']));
     }
 }
/**
 * Return country name based on country code
 *
 * @param string $code
 * @return string
 */
function get_country_name($code)
{
    static $instance;
    if (!instance_of($instance, 'Countries')) {
        require_once ANGIE_PATH . '/classes/resources/Countries.class.php';
        $instance =& Countries::instance();
    }
    // if
    return $instance->getCountryName($code);
}
 public function indexAction()
 {
     $searchWords = '';
     $business = array();
     if (isset($_GET["page"])) {
         $currentPage = (int) $_GET["page"];
     } else {
         $currentPage = 1;
     }
     if ($this->request->isPost()) {
         $businessName = $this->request->getPost('name');
         $businessAddress = $this->request->getPost('address');
         $businessCategoryId = $this->request->getPost('business_category_id');
         $businessCategory = BusinessCategories::findFirst($businessCategoryId);
         $country = Countries::findFirst(array('columns' => '*', 'conditions' => 'country LIKE :country:', 'bind' => array('country' => $businessAddress)));
         $countryId = '';
         if ($country) {
             $countryId = $country->id;
         }
         $conditions = '';
         $bind = array();
         if (!empty($businessName)) {
             $conditions .= ' OR name LIKE :name:';
             $bind['name'] = '%' . $businessName . '%';
             $searchWords .= ', ' . $businessName;
         }
         if (!empty($businessAddress)) {
             $conditions .= ' OR street LIKE :street:';
             $bind['street'] = '%' . $businessAddress . '%';
             $conditions .= ' OR city LIKE :city:';
             $bind['city'] = '%' . $businessAddress . '%';
             $searchWords .= ', ' . $businessAddress;
         }
         if (!empty($countryId)) {
             $conditions .= ' OR country_id LIKE :country_id:';
             $bind['country_id'] = $countryId;
             $searchWords .= ', ' . $country->country;
         }
         if (!empty($businessCategoryId)) {
             $conditions .= ' OR business_category_id = :business_category_id:';
             $bind['business_category_id'] = $businessCategoryId;
             $searchWords .= ', ' . $businessCategory->name;
         }
         $business = Business::find(array('columns' => '*', 'conditions' => substr($conditions, 3), 'bind' => $bind));
     } else {
         $business = Business::find();
     }
     // Create a Model paginator, show 10 rows by page starting from $currentPage
     $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $business, "limit" => 10, "page" => $currentPage));
     $page = $paginator->getPaginate();
     $this->view->setVar('searchWords', $searchWords);
     $this->view->setVar('business', $page);
     $businessCategories = BusinessCategories::find();
     $this->view->setVar('businessCategories', $businessCategories);
 }
 public function countryInfoAction()
 {
     $this->view->disable();
     $country = Countries::findFirst("countryCode='" . $_POST["id"] . "'");
     $list = $this->jquery->semantic()->htmlList("");
     $list->addHeader(3, "")->asImage("https://lipis.github.io/flag-icon-css/flags/4x3/" . strtolower($_POST["id"]) . ".svg", $country->getCountryName(), $country->getContinentName());
     $list->addItem("Population : " . number_format($country->getPopulation()))->addIcon("users");
     $list->addItem("Currency code : " . $country->getCurrencyCode())->addIcon("payment");
     $list->addItem("Capital : " . $country->getCapital())->addIcon("diamond");
     echo $list->setDivided();
 }
 public function actionEnabled($id)
 {
     $model = Countries::model()->findByPk($id);
     if ($model->status == 1) {
         $model->status = 0;
     } else {
         $model->status = 1;
     }
     $model->save();
     $this->redirect(array("index"));
 }
 public function run()
 {
     $countries = Countries::getList('es', 'php', 'cldr');
     $rows = [];
     foreach ($countries as $key => $value) {
         $rows[] = ['abbreviation' => $key, 'name' => $value, 'created_at' => new DateTime(), 'updated_at' => new DateTime()];
     }
     DB::statement('SET foreign_key_checks = 0');
     DB::table('countries')->truncate();
     DB::table('countries')->insert($rows);
     DB::statement('SET foreign_key_checks = 0');
 }
Exemple #29
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new OsCounties();
     $county_options = $counties->getCountyNames();
     parent::__construct($options);
     $this->setName('coroner');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Enter a firstname!');
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false);
     $address_1 = new Zend_Form_Element_Text('address_1');
     $address_1->SetLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidators(array('NotEmpty'))->addMultiOptions(array(null => 'Choose county', 'Valid county' => $county_options));
     $region_name = new Zend_Form_Element_Text('region_name');
     $region_name->SetLabel('Administrative region: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions($countries_options)->setValue('GB');
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($firstname, $lastname, $email, $address_1, $address_2, $town, $postcode, $county, $country, $telephone, $fax, $region_name, $submit));
     $this->addDisplayGroup(array('firstname', 'lastname', 'region_name', 'email', 'address_1', 'address_2', 'town', 'postcode', 'county', 'country', 'telephone', 'fax'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->details->setLegend('Submit Coroner\'s details ');
     parent::init();
 }
 /**
  * get img for team
  * @param object ranking row
  * @param int type = 1 for club small logo, 2 for country
  * @return html string
  */
 function getLogo($item, $type = 1)
 {
     if ($type == 1) {
         if (!empty($item->logo_small)) {
             return JHTML::image(JURI::root() . $item->logo_small, $item->short_name, 'class="teamlogo"');
         }
     } else {
         if ($type == 2 && !empty($item->country)) {
             return Countries::getCountryFlag($item->country, 'class="teamcountry"');
         }
     }
     return '';
 }