function ctools_access_admin_render_table in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/context-access-admin.inc \ctools_access_admin_render_table()
Render the table. This is used both to render it initially and to rerender it upon ajax response.
4 calls to ctools_access_admin_render_table()
- ctools_access_admin_form in includes/
context-access-admin.inc - Administrative form for access control.
- ctools_access_ajax_add in includes/
context-access-admin.inc - AJAX callback to add a new access test to the list.
- ctools_access_ajax_delete in includes/
context-access-admin.inc - AJAX command to remove an access control item.
- ctools_access_ajax_edit in includes/
context-access-admin.inc - AJAX callback to edit an access test in the list.
File
- includes/
context-access-admin.inc, line 185 - Contains administrative screens for the access control plugins.
Code
function ctools_access_admin_render_table($access, $fragment, $contexts) {
ctools_include('ajax');
ctools_include('modal');
$rows = array();
if (empty($access['plugins'])) {
$access['plugins'] = array();
}
foreach ($access['plugins'] as $id => $test) {
$row = array();
$plugin = ctools_get_access_plugin($test['name']);
$title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array(
'%plugin' => $test['name'],
));
$row[] = array(
'data' => $title,
'class' => array(
'ctools-access-title',
),
);
$description = ctools_access_summary($plugin, $contexts, $test);
$row[] = array(
'data' => $description,
'class' => array(
'ctools-access-description',
),
);
$operations = ctools_modal_image_button(ctools_image_path('icon-configure.png'), "ctools/context/ajax/access/configure/{$fragment}/{$id}", t('Configure settings for this item.'));
$operations .= ctools_ajax_image_button(ctools_image_path('icon-delete.png'), "ctools/context/ajax/access/delete/{$fragment}/{$id}", t('Remove this item.'));
$row[] = array(
'data' => $operations,
'class' => array(
'ctools-access-operations',
),
'align' => 'right',
);
$rows[] = $row;
}
$header = array(
array(
'data' => t('Title'),
'class' => array(
'ctools-access-title',
),
),
array(
'data' => t('Description'),
'class' => array(
'ctools-access-description',
),
),
array(
'data' => '',
'class' => array(
'ctools-access-operations',
),
'align' => 'right',
),
);
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No criteria selected, this test will pass.'),
'colspan' => count($header),
),
);
}
ctools_modal_add_js();
return theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'ctools-access-table',
),
));
}