function analytics_dashboard_form

cis7 analytics_dashboard.forms.inc analytics_dashboard_form()

Provide a simple form to change time periods

2 string references to 'analytics_dashboard_form'
analytics_dashboard_page in sites/all/modules/local_contrib/google_chart_tools/analytics_dashboard/analytics_dashboard.module
Page callback for report page.
analytics_dashboard_theme in sites/all/modules/local_contrib/google_chart_tools/analytics_dashboard/analytics_dashboard.module
Implements hook_theme().

File

sites/all/modules/local_contrib/google_chart_tools/analytics_dashboard/analytics_dashboard.forms.inc, line 10
Provides the filtering form on the analytics dashboard page.

Code

function analytics_dashboard_form() {
  $form = array();

  // Load some javascript for datepicker
  drupal_add_library('system', 'ui.datepicker');
  drupal_add_js('jQuery(document).ready(function(){jQuery( ".pickadate" ).datepicker({
      dateFormat: "dd.mm.yy",
      autoSize: true
    });});', 'inline');

  $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['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,
    '#attributes' => array('class' => array('pickadate')),
    '#default_value' => isset($_GET['from']) ? filter_xss($_GET['from']) : '',
  );

  $form['custom_to'] = array(
    '#type' => 'textfield',
    '#size' => 10,
    '#attributes' => array('class' => array('pickadate')),
    '#default_value' => isset($_GET['to']) ? filter_xss($_GET['to']) : '',
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );

  return $form;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.