You are here

function services_client_error_admin_repair in Services Client 7.2

Same name and namespace in other branches
  1. 7 services_client_error/services_client_error.admin.inc \services_client_error_admin_repair()

Resend data to connection that produced error

1 string reference to 'services_client_error_admin_repair'
services_client_error_menu in services_client_error/services_client_error.module
Implements hook_menu().

File

services_client_error/services_client_error.admin.inc, line 180
Administration callbacks for error handling.

Code

function services_client_error_admin_repair($form, &$form_state, $error) {
  $form['error'] = array(
    '#type' => 'value',
    '#value' => $error,
  );
  $entities = entity_load($error['entity_type'], array(
    $error['entity_id'],
  ));
  $entity = reset($entities);
  $rows = array();
  $rows[] = array(
    t('Created'),
    format_date($error['created'], 'short'),
  );
  $rows[] = array(
    t('Entity type'),
    check_plain($error['entity_type']),
  );

  // If entity exists on local system, show link to entity.
  if (!empty($entity)) {
    $uri = entity_uri($error['entity_type'], $entity);
    $rows[] = array(
      t('Entity ID'),
      l($error['entity_id'], $uri['path'], $uri['options']),
    );
  }
  else {
    $rows[] = array(
      t('Entity ID'),
      check_plain($error['entity_id']),
    );
  }
  $event = services_client_get_event($error['event']);
  $rows[] = array(
    t('Event'),
    l($error['event'], $event
      ->getUrl()),
  );
  $rows[] = array(
    t('Retries'),
    check_plain($error['retries']),
  );
  $rows[] = array(
    t('Result'),
    services_client_error_status_title($error['status']),
  );
  $form['info'] = array(
    '#theme' => 'table',
    '#header' => array(
      array(
        'data' => t('Info'),
        'colspan' => 2,
      ),
    ),
    '#rows' => $rows,
  );
  $history = services_client_error_admin_log_list($error);
  if (!empty($history['table']['#rows'])) {
    $form['history'] = $history['table'];
  }
  if (empty($history) && !empty($_REQUEST['destination'])) {
    $form['back'] = array(
      '#markup' => '<p>' . l(t('Back'), $_REQUEST['destination']) . '</p>',
    );
  }
  $form['actions'] = array();
  if (empty($error['completed'])) {
    $form['actions']['sync'] = array(
      '#type' => 'submit',
      '#value' => t('Synchronize'),
      '#submit' => array(
        'services_client_error_admin_repair_synchronize',
      ),
    );
    $form['actions']['mark'] = array(
      '#type' => 'submit',
      '#value' => t('Mark as completed (synchronized).'),
      '#submit' => array(
        'services_client_error_admin_repair_mark',
      ),
    );
  }
  $form['actions']['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete error'),
    '#submit' => array(
      'services_client_error_admin_repair_delete',
    ),
  );
  return $form;
}