function uc_coupon_reports_form in Ubercart Discount Coupons 7.2
Same name and namespace in other branches
- 5 uc_coupon.module \uc_coupon_reports_form()
- 6 uc_coupon.reports.inc \uc_coupon_reports_form()
- 7.3 uc_coupon.reports.inc \uc_coupon_reports_form()
Coupon report options form.
1 string reference to 'uc_coupon_reports_form'
- uc_coupon_reports in ./
uc_coupon.reports.inc - Output coupon report.
File
- ./
uc_coupon.reports.inc, line 9 - Discount Coupons reports pages.
Code
function uc_coupon_reports_form($form, &$form_state, $start = NULL, $end = NULL, $statuses = NULL) {
module_load_include('inc', 'uc_coupon', 'uc_coupon.admin');
if (is_null($start)) {
$start = REQUEST_TIME;
}
if (is_null($end)) {
$end = REQUEST_TIME;
}
if (is_null($statuses)) {
$statuses = variable_get('uc_reports_reported_statuses', array(
'completed',
));
}
$options = array();
foreach (uc_order_status_list() as $status) {
$options[$status['id']] = $status['title'];
}
$form['start'] = array(
'#type' => 'date',
'#title' => t('Start date'),
'#default_value' => array(
'year' => format_date($start, 'custom', 'Y'),
'month' => format_date($start, 'custom', 'n'),
'day' => format_date($start, 'custom', 'j'),
),
'#after_build' => array(
'_uc_coupon_date_range',
),
);
$form['end'] = array(
'#type' => 'date',
'#title' => t('End date'),
'#default_value' => array(
'year' => format_date($end, 'custom', 'Y'),
'month' => format_date($end, 'custom', 'n'),
'day' => format_date($end, 'custom', 'j'),
),
'#after_build' => array(
'_uc_coupon_date_range',
),
);
$form['status'] = array(
'#type' => 'select',
'#title' => t('Order statuses'),
'#description' => t('Only orders with selected statuses will be included in the report.') . '<br />' . t('Hold Ctrl + click to select multiple statuses.'),
'#options' => $options,
'#default_value' => $statuses,
'#multiple' => TRUE,
'#size' => 5,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Display report'),
);
return $form;
}