function clients_connections_list in Web Service Clients 7
Same name and namespace in other branches
- 6.2 clients.connection.admin.inc \clients_connections_list()
- 6 clients.module \clients_connections_list()
- 7.2 clients.connection.admin.inc \clients_connections_list()
Page callback: list connections.
1 string reference to 'clients_connections_list'
- clients_menu in ./
clients.module - Implementation of hook_menu()
File
- ./
clients.connection.admin.inc, line 10 - clients.connection.admin.inc Page callbacks relating to client connection admin.
Code
function clients_connections_list() {
$output = '';
$connection_types = clients_get_connection_types();
$connections = array();
// TODO: clients_get_connections and clients_connection_load make the same queries!!!
foreach (array_keys(clients_get_connections()) as $cid) {
$connection = clients_connection_load($cid);
$connections[] = array(
'name' => l($connection->name, 'admin/settings/clients/connections/view/' . $cid),
'type' => $connection->type,
'endpoint' => $connection->endpoint,
'edit' => l('edit', 'admin/settings/clients/connections/edit/' . $cid),
'test' => l('test', 'admin/settings/clients/connections/test/' . $cid),
'delete' => l('delete', 'admin/settings/clients/connections/delete/' . $cid),
);
}
// Ensure the table has a row if there are no connections at all.
if (!count($connections)) {
$connections[] = array(
array(
'data' => t('No connections defined yet.'),
'colspan' => '5',
),
);
}
$headers = array(
'Name',
'Type',
'Endpoint',
array(
'data' => 'Operations',
'colspan' => 3,
),
);
$output .= theme_table($headers, $connections);
// Add a list of connection types that can be created.
foreach ($connection_types as $type => $type_data) {
//dsm($type_data);
$items[] = l(t('Add @type connection', array(
'@type' => $type_data['label'],
)), 'admin/settings/clients/connections/add/' . $type);
}
$output .= theme('item_list', $items);
return $output;
}