You are here

function smart_ip_views_bridge_handler_field_coordinates::render in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 modules/smart_ip_views_bridge/views/smart_ip_views_bridge_handler_field_coordinates.inc \smart_ip_views_bridge_handler_field_coordinates::render()
  2. 6 modules/smart_ip_views_bridge/views/smart_ip_views_bridge_handler_field_coordinates.inc \smart_ip_views_bridge_handler_field_coordinates::render()

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

2 methods override smart_ip_views_bridge_handler_field_coordinates::render()
smart_ip_views_bridge_handler_field_latitude::render in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_handler_field_latitude.inc
Render the field.
smart_ip_views_bridge_handler_field_longitude::render in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_handler_field_longitude.inc
Render the field.

File

modules/smart_ip_views_bridge/views/smart_ip_views_bridge_handler_field_coordinates.inc, line 38
Contains the 'smart_ip_views_bridge_handler_field_coordinates' field handler.

Class

smart_ip_views_bridge_handler_field_coordinates
Field handler to display visitor's coordinates.

Code

function render($values) {
  $smart_ip_session = smart_ip_session_get('smart_ip');
  $latitude = '';
  $longitude = '';
  if (!empty($smart_ip_session['location']['latitude']) && !empty($smart_ip_session['location']['longitude'])) {
    $latitude = $smart_ip_session['location']['latitude'];
    $longitude = $smart_ip_session['location']['longitude'];
  }
  if ($this->options['style'] == 'dd') {
    return "{$latitude}, {$longitude}";
  }
  else {
    return theme('smart_ip_longitude_dms', array(
      'view' => $latitude,
    )) . ', ' . theme('smart_ip_longitude_dms', array(
      'view' => $longitude,
    ));
  }
}