You are here

function forena_data_block_form_submit in Forena Reports 7.2

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

The Preview submit handler for forena_add_block_form Renders datablock into a report

_state

Parameters

$form:

Return value

unknown_type

1 string reference to 'forena_data_block_form_submit'
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 2081

Code

function forena_data_block_form_submit($form, &$form_state) {
  $xml = '';
  $block_info = '';
  $values = $form_state['values'];
  $name = $values['report_name'];
  $r = forena_get_report_editor($name);
  if ($values['blocks']) {
    $r
      ->get_attributes_by_id();
    $data = array();
    foreach ($values['blocks'] as $block) {
      if (!$block['delete']) {
        $attrs = $block;
        unset($attrs['delete']);
        unset($attrs['delete_submit']);
        unset($attrs['id']);
        $data[$block['id']] = $attrs;
      }
    }
    if ($r) {
      $r
        ->save_attributes_by_id($data);
    }
  }
  if (forena_save_report($name, $r
    ->asXML(), TRUE) == 1) {
    drupal_set_message(t('Your report %s been saved', array(
      '%s' => $name,
    )));
  }
}