function forena_display_blocks in Forena Reports 7.5
Same name and namespace in other branches
- 8 forena_ui/forena.data.inc \forena_display_blocks()
- 7.4 forena.data.inc \forena_display_blocks()
1 string reference to 'forena_display_blocks'
- forena_menu in ./
forena.module - Implementation of hook_menu.
File
- ./
forena.data.inc, line 7
Code
function forena_display_blocks() {
$header = array(
t('Block'),
t('Access'),
t('Keywords'),
t('Actions'),
);
Frx::BlockEditor()
->revertDBBLocks();
$blocks = Frx::DataFile()
->userBlocks();
if (module_exists('forena_query') && user_access('build forena sql blocks')) {
$links[] = array(
'href' => 'admin/structure/forena/data/add',
'title' => 'Create New SQL Query',
);
$content['add']['#markup'] = theme('links', array(
'links' => $links,
'attributes' => array(
'class' => 'action-links',
),
));
}
$data = array();
foreach ($blocks as $block_name => $block) {
$blck = str_replace('/', '.', $block_name);
$actions = '';
if ($block->cache['type'] == 'sql' && module_exists('forena_query')) {
if ($block->include) {
$actions = l(t('Override'), 'admin/structure/forena/data/' . $blck . '/edit');
}
else {
$actions = l(t('Edit'), 'admin/structure/forena/data/' . $blck . '/edit');
}
$clone = l(t('Clone'), 'admin/structure/forena/data/clone/' . $blck);
// Determine the nature of the report delete link.
if ($block->override && !$block->include) {
$actions .= ' ' . l(t('Revert'), 'admin/structure/forena/data/' . $blck . '/delete', array(
'query' => array(
'destination' => 'admin/structure/forena/data',
),
));
}
else {
if (!$block->include) {
$actions .= ' ' . l(t('Delete'), 'admin/structure/forena/data/' . $blck . '/delete', array(
'query' => array(
'destination' => 'admin/structure/forena/data',
),
));
}
}
}
// Build the table.
$data[] = array(
l($block_name, "forena/data/{$blck}"),
@$block->cache['access'],
@$block->cache['keywords'],
$actions,
);
}
// Theme the table
$output = "<div id='forena-data-block-list'>\n";
$output .= theme('forena_data_table', array(
'header' => $header,
'rows' => $data,
));
$output .= "</div>\n";
$content['data_blocks'] = array(
'#markup' => $output,
);
return $content;
}