function oauth_common_list_context in OAuth 1.0 7.3
Same name and namespace in other branches
- 6.3 oauth_common.admin.inc \oauth_common_list_context()
- 7.4 oauth_common.admin.inc \oauth_common_list_context()
Output a list of contexts.
1 string reference to 'oauth_common_list_context'
- oauth_common_providerui_menu in ./
oauth_common_providerui.module - Implements hook_menu().
File
- ./
oauth_common.admin.inc, line 47 - Administration pages for OAuth module.
Code
function oauth_common_list_context($js = NULL) {
$header = array(
array(
'data' => t('Title'),
'class' => array(
'oauth-common-contexts-title',
),
),
array(
'data' => t('Storage'),
'class' => array(
'oauth-common-contexts-storage',
),
),
array(
'data' => t('Operations'),
'class' => array(
'oauth-common-contexts-operations',
),
),
);
$contexts = oauth_common_context_load_all();
$rows = array();
if (!$contexts) {
$contexts = array();
}
foreach ($contexts as $context) {
$operations = array();
if (empty($context->disabled)) {
$operations[] = array(
'title' => t('Edit'),
'href' => 'admin/config/services/oauth/' . $context->name . '/edit',
);
$operations[] = array(
'title' => t('Export'),
'href' => 'admin/config/services/oauth/' . $context->name . '/export',
);
}
if ($context->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
$operations[] = array(
'title' => t('Revert'),
'href' => 'admin/config/services/oauth/' . $context->name . '/delete',
);
}
elseif ($context->export_type != EXPORT_IN_CODE) {
$operations[] = array(
'title' => t('Delete'),
'href' => 'admin/config/services/oauth/' . $context->name . '/delete',
);
}
elseif (empty($context->disabled)) {
$operations[] = array(
'title' => t('Disable'),
'href' => 'admin/config/services/oauth/' . $context->name . '/disable',
'query' => drupal_get_destination(),
);
}
else {
$operations[] = array(
'title' => t('Enable'),
'href' => 'admin/config/services/oauth/' . $context->name . '/enable',
'query' => drupal_get_destination(),
);
}
$rows[$context->name] = array(
'data' => array(
'title' => array(
'data' => check_plain($context->title),
'class' => array(
'oauth-common-contexts-title',
),
),
'storage' => array(
'data' => $context->export_type == EXPORT_IN_CODE ? t('In code') : t('In database'),
'class' => array(
'oauth-common-contexts-storage',
),
),
'operations' => array(
'data' => theme('links', array(
'links' => $operations,
)),
'class' => array(
'oauth-common-contexts-operations',
),
),
),
'class' => array(
'oauth-common-contexts-' . $context->name,
),
);
if (!empty($context->disabled)) {
$rows[$context->name]['class'][] = 'oauth-common-contexts-disabled';
}
}
$table = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'oauth-common-list-contexts',
),
));
return $table;
}