You are here

function constant_contact_view_activity in Constant Contact 7.3

Same name and namespace in other branches
  1. 6.3 admin.activities.inc \constant_contact_view_activity()

Displays the view activity page.

1 string reference to 'constant_contact_view_activity'
constant_contact_menu in ./constant_contact.module
Implements hook_menu().

File

./admin.activities.inc, line 52
Activities administration functions.

Code

function constant_contact_view_activity($id) {
  $cc = constant_contact_create_object();
  if (!is_object($cc)) {
    return '';
  }
  $activity = $cc
    ->get_activity($id);
  $html = '';
  $html .= '<table cellspacing="3" cellpadding="3" border="0">';
  $dateformat = 'jS F Y \\- H:i:s';
  $html .= '<tr><td>ID</td><td>' . $activity['id'] . '</td></tr>';
  $html .= '<tr><td>Type</td><td>' . $activity['Type'] . '</td></tr>';
  $html .= '<tr><td>Status</td><td>' . $activity['Status'] . '</td></tr>';
  $html .= '<tr><td>Errors</td><td>' . (isset($activity['Errors']) ? $activity['Errors'] : 'None') . '</td></tr>';
  $html .= '<tr><td>Transactions</td><td>' . (isset($activity['TransactionCount']) ? $activity['TransactionCount'] : 'None') . '</td></tr>';
  $html .= '<tr><td>Created</td><td>' . date($dateformat, $cc
    ->convert_timestamp($activity['InsertTime'])) . '</td></tr>';
  if (isset($activity['RunStartTime'], $activity['RunFinishTime'])) {
    $html .= '<tr><td>Started</td><td>' . date($dateformat, $cc
      ->convert_timestamp($activity['RunStartTime'])) . '</td></tr>';
    $html .= '<tr><td>Finished</td><td>' . date($dateformat, $cc
      ->convert_timestamp($activity['RunFinishTime'])) . '</td></tr>';
    $runtime = $activity['RunFinishTime'] - $activity['RunStartTime'];
    $html .= '<tr><td>Runtime</td><td>' . (!$runtime ? 'Less than 1 second' : "{$runtime} seconds") . '</td></tr>';
  }
  if (isset($activity['FileName'])) {
    $html .= '<tr><td colspan="2"><a href="' . url('admin/config/services/constant_contact/activities/download/') . $activity['FileName'] . '">Download File</a></td></tr>';
  }
  $html .= '</table>';
  return $html;
}