oc-content/themes/veronika/functions.php
// GET LOCATION FULL NAME BASED ON COUNTRY, REGION & CITY
GET LOCATION FULL NAME BASED ON COUNTRY, REGION & CITY
GET LOCATION FULL NAME BASED ON COUNTRY REGION & CITY
function veronika_get_full_loc($country = '', $region = '', $city = ''){
  if( $city <> '' && is_numeric($city) ) {
    $city_info = City::newInstance()->findByPrimaryKey( $city );
    $region_info = Region::newInstance()->findByPrimaryKey( $city_info['fk_i_region_id'] );
    $country_info = Country::newInstance()->findByCode( $city_info['fk_c_country_code'] );
    return $city_info['s_name'] . ', ' . $region_info['s_name'] . ', ' . $country_info['s_name'];
  }
  if( $region <> '' && is_numeric($region) ) {
    $region_info = Region::newInstance()->findByPrimaryKey( $region );
    $country_info = Country::newInstance()->findByCode( $region_info['fk_c_country_code'] );
    return $region_info['s_name'] . ', ' . $country_info['s_name'];
  }
  if( $country <> '' && strlen($country) == 2 ) {
    $country_info = Country::newInstance()->findByCode( $country );
    return $country_info['s_name'];
  }
  return '';
}
function veronika_get_full_loc ( $ country = '' , $ region = '' , $ city = '' ) { if ( $ city <> '' && is_numeric ( $ city ) ) { $ city_info = City :: newInstance ( ) -> findByPrimaryKey ( $ city ) ; $ region_info = Region :: newInstance ( ) -> findByPrimaryKey ( $ city_info [ 'fk_i_region_id' ] ) ; $ country_info = Country :: newInstance ( ) -> findByCode ( $ city_info [ 'fk_c_country_code' ] ) ; return $ city_info [ 's_name' ] . ', ' . $ region_info [ 's_name' ] . ', ' . $ country_info [ 's_name' ] ; } if ( $ region <> '' && is_numeric ( $ region ) ) { $ region_info = Region :: newInstance ( ) -> findByPrimaryKey ( $ region ) ; $ country_info = Country :: newInstance ( ) -> findByCode ( $ region_info [ 'fk_c_country_code' ] ) ; return $ region_info [ 's_name' ] . ', ' . $ country_info [ 's_name' ] ; } if ( $ country <> '' && strlen ( $ country ) == 2 ) { $ country_info = Country :: newInstance ( ) -> findByCode ( $ country ) ; return $ country_info [ 's_name' ] ; } return '' ; }
GET LOCATION FULL NAME BASED ON COUNTRY, REGION & CITY
GET LOCATION FULL NAME BASED ON COUNTRY REGION & CITY