function forena_layout_form in Forena Reports 7.2
Same name and namespace in other branches
- 6.2 forena.admin.inc \forena_layout_form()
- 6 forena.admin.inc \forena_layout_form()
- 7 forena.admin.inc \forena_layout_form()
- 7.3 forena.admin.inc \forena_layout_form()
Form function for the edit report form
Parameters
$form_state:
Return value
the form
1 string reference to 'forena_layout_form'
- forena_menu in ./
forena.module - Implementation of hook_menu.
File
- ./
forena.admin.inc, line 608
Code
function forena_layout_form($form, $form_state, $report_name) {
$name_in = $report_name;
$desc = forena_report_desc($report_name);
$name = $desc['name'];
global $language;
//determine if this is an add new report request
$filename = $desc['filename'];
$format = @$desc['format'];
if ($name) {
if (isset($desc['exists']) && $desc['exists']) {
$save_name = $name;
//set the name to empty string for new reports
$r = forena_get_report_editor($name);
$title = (string) $r->title;
if (module_exists('locale')) {
@(list($tlang, $tsave_name) = explode('/', $name, 2));
// FInd out if the starting name of the report is an installed language.
if (array_key_exists($tlang, language_list())) {
$lang = $tlang;
$save_name = $tsave_name;
}
else {
$lang = 'en';
}
}
drupal_set_title(filter_xss($r->title));
// Need to get all option attributes
$frx_options = $r
->getOptions();
$hidden = @$frx_options['hidden'] == '1' ? 1 : 0;
$report_form = @$frx_options['form'];
$attributes = $r
->get_attributes_by_id();
$category = $r
->getCategory();
$body = $r->simplexml->body
->asXML();
$form = array();
//array of xml attributes that are required to have a value
$required = array(
'id' => TRUE,
'label' => TRUE,
);
//list of supported document formats
$supported = FrxReportGenerator::instance()
->supported_doctypes();
$doclist = variable_get('forena_doc_formats', array());
$form['report_name'] = array(
'#type' => 'value',
'#value' => $name,
);
$form['name_in'] = array(
'#type' => 'value',
'#value' => $name_in,
);
$form['attributes'] = array(
'#type' => 'value',
'#value' => $attributes,
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $title,
);
$form['body'] = array(
'#type' => 'text_format',
'#title' => t('Body'),
'#default_value' => $body,
'#rows' => 25,
'#format' => variable_get('forena_input_format', filter_default_format()),
);
$form['visibility'] = array(
'#type' => 'fieldset',
'#title' => 'Visibility',
);
$form['visibility']['category'] = array(
'#type' => 'textfield',
'#title' => t('Category'),
'#default_value' => $category,
'#autocomplete_path' => 'forena/categories/autocomplete',
'#description' => t('The heading your report will be grouped under on the report list.'),
);
$form['visibility']['hidden'] = array(
'#type' => 'checkbox',
'#title' => t('Hidden'),
'#default_value' => $hidden,
'#description' => t('Hide your report from showing up on the report list.'),
);
$form['buttons']['save'] = array(
'#type' => 'submit',
'#value' => 'Save',
'#submit' => array(
'forena_layout_form_submit',
),
);
if (user_access('delete report')) {
$form['buttons']['delete'] = array(
'#type' => 'submit',
'#value' => 'Delete',
'#submit' => array(
'forena_edit_delete_submit',
),
);
}
return $form;
}
else {
drupal_not_found();
exit;
}
}
else {
drupal_not_found();
exit;
}
}