You are here

function opigno_statistics_app_user_filter_form in Opigno Statistics App 7

Implements hook_form().

1 string reference to 'opigno_statistics_app_user_filter_form'
total_number_of_page_view.tpl.php in templates/user/widgets/total_number_of_page_view/total_number_of_page_view.tpl.php
Opigno statistics app - User - Total number of page view template file

File

includes/user/filter_form.inc, line 6

Code

function opigno_statistics_app_user_filter_form(array $form, array &$form_state) {
  $form['#attributes'] = array(
    'class' => 'clearfix',
  );
  $years = range(opigno_statistics_app_install_year(), opigno_statistics_app_current_year());
  $default_value = variable_get('opigno_statistics_app_user_filter_form_values');
  $year = opigno_statistics_app_current_year();
  if (isset($default_value[request_uri()]['year'])) {
    $year = $default_value[request_uri()]['year'];
  }
  $month = NULL;
  if (isset($default_value[request_uri()]['month'])) {
    $month = $default_value[request_uri()]['month'];
  }
  $form['year'] = array(
    '#title' => t('Year'),
    '#type' => 'select',
    '#options' => array_combine($years, $years),
    '#ajax' => array(
      'callback' => 'opigno_statistics_app_user_filter_form_ajax_submit',
      'wrapper' => 'opigno-statistics-app-user',
      'method' => 'append',
    ),
    '#default_value' => $year,
  );
  $months = date_month_names();
  $form['month'] = array(
    '#title' => t('Month'),
    '#type' => 'select',
    '#options' => $months,
    '#ajax' => array(
      'callback' => 'opigno_statistics_app_user_filter_form_ajax_submit',
      'wrapper' => 'opigno-statistics-app-user',
      'method' => 'append',
    ),
    '#default_value' => $month,
  );
  return $form;
}