You are here

function services_admin_keys_list in Services 6

Same name and namespace in other branches
  1. 5 services_admin_keys.inc \services_admin_keys_list()

@author Services Dev Team @file Generate security keys.

1 string reference to 'services_admin_keys_list'
services_menu in ./services.module
Implementation of hook_menu().

File

./services_admin_keys.inc, line 8
@author Services Dev Team

Code

function services_admin_keys_list() {
  $keys = services_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) {
      $operation['class'] = $class;
      $row[] = $operation;
    }
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No API keys created.'),
        'colspan' => '5',
        'class' => 'message',
      ),
    );
  }
  return theme('table', $header, $rows);
}