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