You are here

function forena_data_block_delete in Forena Reports 7.3

Same name and namespace in other branches
  1. 6.2 forena.admin.inc \forena_data_block_delete()
  2. 6 forena.admin.inc \forena_data_block_delete()
  3. 7 forena.admin.inc \forena_data_block_delete()
  4. 7.2 forena.admin.inc \forena_data_block_delete()

Delete submit handler to delete report blocks

_state

Parameters

$form:

Return value

unknown_type

1 string reference to 'forena_data_block_delete'
forena_data_block_form in ./forena.admin.inc
A form to preview and add data blocks to an existing report

File

./forena.admin.inc, line 1977

Code

function forena_data_block_delete($form, &$form_state) {
  $values = $form_state['values'];
  $report_name = $values['report_name'];
  $r = FrxReportGenerator::instance()
    ->get_report($report_name);

  //find the datablocks in the existing report
  if ($r) {
    $r
      ->get_attributes_by_id();
  }
  $body = $r->body;
  foreach ($values['blocks'] as $block) {
    if ($block['delete']) {
      if ($r) {
        $r
          ->deleteNode($block['id']);
      }
    }
  }
  if (forena_save_report($report_name, $r->rpt_xml, TRUE) == 1) {
    drupal_set_message(t('Your report has been saved.'));
  }
}