function oauthconnector_list_provider in OAuth Connector 6
Same name and namespace in other branches
- 7 oauthconnector.admin.inc \oauthconnector_list_provider()
Output a list of providers.
1 string reference to 'oauthconnector_list_provider'
- oauthconnector_menu in ./
oauthconnector.module - Implementation of hook_menu().
File
- ./
oauthconnector.admin.inc, line 13 - Administrative functions for the OAuth Connector module.
Code
function oauthconnector_list_provider($js = NULL) {
$header = array(
array(
'data' => t('Title'),
'class' => 'oauthconnector-provider-title',
),
array(
'data' => t('URL'),
'class' => 'oauthconnector-provider-url',
),
array(
'data' => t('Callback URL'),
'class' => 'oauthconnector-provider-callback-url',
),
array(
'data' => t('Storage'),
'class' => 'oauthconnector-provider-storage',
),
array(
'data' => t('Operations'),
'class' => 'oauthconnector-provider-operations',
),
);
$providers = oauthconnector_provider_load_all();
$rows = array();
foreach ($providers as $provider) {
$operations = array();
if (empty($provider->disabled)) {
$operations[] = array(
'title' => t('Edit'),
'href' => 'admin/build/oauthconnector/' . $provider->name . '/edit',
);
$operations[] = array(
'title' => t('Export'),
'href' => 'admin/build/oauthconnector/' . $provider->name . '/export',
);
}
if ($provider->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
$operations[] = array(
'title' => t('Revert'),
'href' => 'admin/build/oauthconnector/' . $provider->name . '/delete',
);
}
elseif ($provider->export_type != EXPORT_IN_CODE) {
$operations[] = array(
'title' => t('Delete'),
'href' => 'admin/build/oauthconnector/' . $provider->name . '/delete',
);
}
elseif (empty($provider->disabled)) {
$operations[] = array(
'title' => t('Disable'),
'href' => 'admin/build/oauthconnector/' . $provider->name . '/disable',
'query' => drupal_get_destination(),
);
}
else {
$operations[] = array(
'title' => t('Enable'),
'href' => 'admin/build/oauthconnector/' . $provider->name . '/enable',
'query' => drupal_get_destination(),
);
}
$rows[$provider->name] = array(
'data' => array(
'title' => check_plain($provider->title),
'url' => l($provider->url, $provider->url),
'callback_url' => empty($provider->csid) ? '' : l('oauth/authorized/' . $provider->csid, 'oauth/authorized/' . $provider->csid),
'storage' => $provider->type,
'operations' => theme('links', $operations),
),
'class' => !empty($provider->disabled) ? ' oauthconnector-provider-disabled' : '',
);
if (empty($rows[$provider->name]['data']['callback_url'])) {
$rows[$provider->name]['data']['callback_url'] = array(
'data' => t('Missing consumer key') . (empty($provider->disabled) ? ' (' . l(t('Add'), 'admin/build/oauthconnector/' . $provider->name . '/edit') . ')' : ''),
'class' => 'oauthconnector-provider-warning',
);
}
}
$table = theme('table', $header, $rows, array(
'id' => 'oauthconnector-list-provider',
));
drupal_add_css(drupal_get_path('module', 'oauthconnector') . '/oauthconnector.admin.css');
return $table;
}