function autoassignrole_list_pages in Auto Assign Role 7.2
Same name and namespace in other branches
- 7 autoassignrole.admin.inc \autoassignrole_list_pages()
Function to display list of role-specific pages.
Return value
array Returns a build array.
1 string reference to 'autoassignrole_list_pages'
- autoassignrole_menu in ./
autoassignrole.module - Implements hook_menu().
File
- ./
autoassignrole.admin.inc, line 412 - Administrative functionality for auto assign role.
Code
function autoassignrole_list_pages() {
$header = array(
t('Name'),
t('Title'),
t('Roles'),
t('Path'),
t('Storage'),
t('Operations'),
);
$storage = array(
'Normal' => t('Database'),
'Default' => t('Code'),
'Overridden' => t('Code. Overridden in database'),
);
$rows = array();
ctools_include('export');
foreach (ctools_export_crud_load_all('autoassignrole_page') as $page) {
$roles = implode(', ', $page->roles);
$operations = array(
array(
'title' => t('Edit'),
'href' => 'admin/config/people/autoassignrole/pages/edit/' . $page->name,
),
);
if (empty($page->in_code_only) && $page->type == 'Normal') {
$operations[] = array(
'title' => t('Delete'),
'href' => 'admin/config/people/autoassignrole/pages/delete/' . $page->name,
);
}
if ($page->type == 'Overridden') {
$operations[] = array(
'title' => t('Revert'),
'href' => 'admin/config/people/autoassignrole/pages/revert/' . $page->name,
);
}
$rows[] = array(
$page->name,
$page->title,
$roles,
$page->path,
$storage[$page->type],
theme(count($operations) == 1 ? 'links' : 'links__ctools_dropbutton', array(
'links' => $operations,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
)),
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
'sticky' => TRUE,
'empty' => t('No Auto Assign pages yet.'),
));
}