You are here

function sf_queue_admin_view in Salesforce Suite 7.2

Same name and namespace in other branches
  1. 6.2 sf_queue/sf_queue.admin.inc \sf_queue_admin_view()

@todo Please document this function.

See also

http://drupal.org/node/1354

1 string reference to 'sf_queue_admin_view'
sf_queue_menu in sf_queue/sf_queue.module
@file sf_queue.module Implements export queue and administrativa for Salesforce API

File

sf_queue/sf_queue.admin.inc, line 63
Admin interface for the Salesforce Export Queue module.

Code

function sf_queue_admin_view($qid) {
  if (strlen($qid) == 0 || !is_numeric($qid)) {
    drupal_goto("admin/reports/sf_queue/");
  }

  // TODO Please convert this statement to the D7 database API syntax.
  $sf_queue_item = db_query("SELECT * FROM {salesforce_export_queue} WHERE id=" . $qid)
    ->fetchObject();
  $header = array(
    t('Field name'),
    t('Value'),
  );
  $rows = array();
  foreach ($sf_queue_item as $key => $value) {
    if ($key == "sf_data") {
      $sf_data = unserialize($value);
      foreach ($sf_data as $key_sf => $value_sf) {
        $rows[] = array(
          'data' => array(
            "sf_data - " . $key_sf,
            $value_sf,
          ),
        );
      }
    }
    else {
      $rows[] = array(
        'data' => array(
          $key,
          $value,
        ),
      );
    }
  }
  if (count($rows) == 0) {
    drupal_goto("admin/reports/sf_queue/");
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= l(t('Delete this queue item'), "admin/reports/sf_queue/delete/" . $qid) . "<br />";
  $output .= l(t('Return to queue list'), "admin/reports/sf_queue");
  return $output;
}