function quant_time_form in Quant 7
Same name and namespace in other branches
- 6 includes/forms.inc \quant_time_form()
Provide a simple form to change time periods
1 string reference to 'quant_time_form'
- quant_page in ./
quant.pages.inc - The analytics page callback
File
- ./
quant.pages.inc, line 97 - Page callbacks
Code
function quant_time_form($form, &$form_state) {
$period_options = array(
'1_week' => t('1 week'),
'2_weeks' => t('2 weeks'),
'1_month' => t('1 month'),
'3_months' => t('3 months'),
'6_months' => t('6 months'),
'1_year' => t('1 year'),
'2_years' => t('2 years'),
);
$period = isset($_GET['period']) ? filter_xss($_GET['period']) : NULL;
if (!$period || !array_key_exists($period, $period_options)) {
$period = '1_month';
// Default value
}
$form['message'] = array(
'#type' => 'item',
'#value' => t('Select a timeframe and click Update to see what\'s happening on your site during that time, as well as a total for all the activity during that timeframe.'),
);
$form['option'] = array(
'#type' => 'radios',
'#options' => array(
'period' => '',
'custom' => '',
),
'#default_value' => isset($_GET['option']) ? filter_xss($_GET['option']) : 'period',
);
$form['period'] = array(
'#type' => 'select',
'#options' => $period_options,
'#default_value' => $period,
);
$form['custom_from'] = array(
'#type' => 'textfield',
'#size' => 10,
'#default_value' => isset($_GET['from']) ? filter_xss($_GET['from']) : '',
);
$form['custom_to'] = array(
'#type' => 'textfield',
'#size' => 10,
'#default_value' => isset($_GET['to']) ? filter_xss($_GET['to']) : '',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
$form['#attached'] = array(
'library' => array(
array(
'system',
'ui.datepicker',
),
),
'js' => array(
drupal_get_path('module', 'quant') . '/js/quant-form.js',
),
);
return $form;
}