You are here

function forena_select_block_list in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 forena.report.inc \forena_select_block_list()
  2. 7.4 forena.report.inc \forena_select_block_list()
1 string reference to 'forena_select_block_list'
forena_menu in ./forena.module
Implementation of hook_menu.

File

./forena.report.inc, line 826

Code

function forena_select_block_list($report_name, $action = 'add-data', $id = '') {
  $header = array(
    t('Block'),
    t('Access'),
    t('Keywords'),
  );
  $blocks = Frx::DataFile()
    ->userBlocks();
  $data = array();
  foreach ($blocks as $block_name => $block) {
    $blck = str_replace('/', '.', $block_name);
    $path = "reports/{$report_name}/edit/preview-data/{$action}/{$blck}";

    // Build the table.
    if ($id) {
      $path .= "/{$id}";
    }
    $data[] = array(
      l($block_name, $path),
      @$block->cache['access'],
      @$block->cache['keywords'],
    );
  }

  // Theme the table
  $content['data_blocks'] = array(
    '#markup' => theme('forena_data_table', array(
      'header' => $header,
      'rows' => $data,
    )),
  );
  return $content;
}