You are here

function theme_ip_tracker_ip_records in IP address manager 7

Same name and namespace in other branches
  1. 6 ip.module \theme_ip_tracker_ip_records()

Theme the IP tracker records for an IP.

1 theme call to theme_ip_tracker_ip_records()
ip_manage in ./ip.module
Page callback for IP address management.

File

./ip.module, line 263
IP address manager module.

Code

function theme_ip_tracker_ip_records($variables) {
  $ip =& $variables['ip'];
  if (!empty($ip)) {

    // Set the page title.
    drupal_set_title(t('Manage IP address @ip', array(
      '@ip' => $ip,
    )));

    // Get the record data.
    $records = ip_tracker_ip_records($ip);

    // Create a table header.
    $header = array(
      t('User'),
      t('Visits'),
      t('First visit'),
      t('Last visit'),
    );
    $rows = array();
    foreach ($records as $record) {
      $account = user_load($record->uid);

      // Check that account is loaded.
      if ($account) {

        // Build a table row.
        $rows[] = array(
          format_username($account),
          $record->visits,
          format_date($record->first_visit),
          format_date($record->last_visit),
        );
      }
    }
    $out = theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  return $out;
}