You are here

function forena_select_block_list in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 forena.report.inc \forena_select_block_list()
  2. 7.4 forena.report.inc \forena_select_block_list()

File

./forena.report.inc, line 832

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}";
    }

    // @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
    // $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;
}