You are here

function forena_data_block_delete in Forena Reports 6

Same name and namespace in other branches
  1. 6.2 forena.admin.inc \forena_data_block_delete()
  2. 7 forena.admin.inc \forena_data_block_delete()
  3. 7.2 forena.admin.inc \forena_data_block_delete()
  4. 7.3 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 1082

Code

function forena_data_block_delete($form, &$form_state) {
  $values = $form_state['values'];
  $delete_blocks = array_filter($values['delete_blocks']);
  $report_name = $values['report_name'];
  $r = forena_get_report($report_name);

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