You are here

function services_keyauth_admin_keys_list in Services 7

Same name and namespace in other branches
  1. 6.2 auth/services_keyauth/services_keyauth.admin.inc \services_keyauth_admin_keys_list()

@file Generate security keys.

1 string reference to 'services_keyauth_admin_keys_list'
services_keyauth_menu in auth/services_keyauth/services_keyauth.module
Implements hook_menu().

File

auth/services_keyauth/services_keyauth.admin.inc, line 8
Generate security keys.

Code

function services_keyauth_admin_keys_list() {
  $keys = services_keyauth_get_keys();
  $header = array(
    t('Key'),
    t('Title'),
    t('Domain'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $rows = array();
  foreach ($keys as $kid => $key) {
    $row = array();
    $row[] = $kid;
    $row[] = $key->title;
    $row[] = $key->domain;

    // Populate the operations field.
    $operations = array();

    // Set the edit column.
    $operations[] = array(
      'data' => l(t('edit'), 'admin/build/services/keys/' . $kid),
    );

    // Set the delete column.
    $operations[] = array(
      'data' => l(t('delete'), 'admin/build/services/keys/' . $kid . '/delete'),
    );
    foreach ($operations as $operation) {
      $row[] = $operation;
    }
    $rows[] = $row;
  }
  if (!count($rows)) {
    $rows[] = array(
      array(
        'data' => t('No API keys created.'),
        'colspan' => '5',
        'class' => 'message',
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}