You are here

function theme_gauth_account_list in Google Auth 7

Same name and namespace in other branches
  1. 7.2 gauth.admin.inc \theme_gauth_account_list()

Returns HTML for the page containing the list of accounts.

Parameters

array $variables: An associative array containing:

See also

gauth_account_load()

1 theme call to theme_gauth_account_list()
gauth_account_list in ./gauth.admin.inc
Menu callback; Listing of all current Api accounts.

File

./gauth.admin.inc, line 31
Administration pages for Google OAuth settings.

Code

function theme_gauth_account_list($variables) {
  $accounts = $variables['accounts'];
  $header = array(
    t('Name'),
    t('Api key'),
    t('Client Id'),
    t('Client Secret'),
    t('User'),
    t('Services'),
    t('Access Type'),
    t('Redirect Url'),
    array(
      'data' => t('Operations'),
      'colspan' => 3,
    ),
  );
  $rows = array();
  foreach ($accounts as $account) {
    $account_user = user_load($account->uid);
    $row = array();
    $row[] = $account->name;
    $row[] = $account->developer_key;
    $row[] = $account->client_id;
    $row[] = $account->client_secret;
    $row[] = l($account_user->name, "user/{$account->uid}");
    $row[] = implode(", ", gauth_google_services_names($account->services));
    $row[] = $account->access_type;
    $row[] = '<pre>' . gauth_callback_url() . '</pre>';
    $row[] = l(t('edit'), 'admin/config/services/gauth_account/edit/' . $account->id);
    $row[] = l(t('delete'), 'admin/config/services/gauth_account/delete/' . $account->id);
    $row[] = $account->is_authenticated ? l(t('Revoke'), 'gauth/revoke_token/' . $account->id) : l(t('Authenticate'), 'gauth/response_handler/' . $account->id);
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'colspan' => 5,
        'data' => t('There are currently no Api Accounts. <a href="!url">Add a new one</a>.', array(
          '!url' => url('admin/config/services/gauth_account/add'),
        )),
      ),
    );
  }
  $build['pager_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  $build['pager_pager'] = array(
    '#theme' => 'pager',
  );
  return $build;
}