You are here

function uc_reports_products_custom_form in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_reports/uc_reports.module \uc_reports_products_custom_form()
  2. 6.2 uc_reports/uc_reports.admin.inc \uc_reports_products_custom_form()

Form builder for the custom product report.

See also

uc_reports_products_custom_form_validate()

uc_reports_products_custom_form_submit()

1 string reference to 'uc_reports_products_custom_form'
uc_reports_products_custom in uc_reports/uc_reports.admin.inc
Displays the custom product report.

File

uc_reports/uc_reports.admin.inc, line 502
Reports administration menu items.

Code

function uc_reports_products_custom_form($form, &$form_state, $values) {
  $form['search'] = array(
    '#type' => 'fieldset',
    '#title' => t('Customize product report parameters'),
    '#description' => t('Adjust these values and update the report to build your custom product report. Once submitted, the report may be bookmarked for easy reference in the future.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['search']['start_date'] = array(
    '#type' => 'date',
    '#title' => t('Start date'),
    '#default_value' => array(
      'month' => format_date($values['start_date'], 'custom', 'n'),
      'day' => format_date($values['start_date'], 'custom', 'j'),
      'year' => format_date($values['start_date'], 'custom', 'Y'),
    ),
  );
  $form['search']['end_date'] = array(
    '#type' => 'date',
    '#title' => t('End date'),
    '#default_value' => array(
      'month' => format_date($values['end_date'], 'custom', 'n'),
      'day' => format_date($values['end_date'], 'custom', 'j'),
      'year' => format_date($values['end_date'], 'custom', 'Y'),
    ),
  );
  $options = array();
  foreach (uc_order_status_list() as $status) {
    $options[$status['id']] = $status['title'];
  }
  $form['search']['status'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Order statuses'),
    '#description' => t('Only orders with selected statuses will be included in the report.'),
    '#options' => $options,
    '#default_value' => $values['status'],
  );
  $form['search']['actions'] = array(
    '#type' => 'actions',
  );
  $form['search']['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update report'),
  );
  return $form;
}