You are here

function set_default_session_values in Statistics Pro 6.2

Helper function to set initial values for session variables related to per report period definitions.

Session variable names get the provided suffix to differentiated them from similar variables for other reports.

Parameters

<string> $suffix:

<string> $period:

<int> $number_of_days :

2 calls to set_default_session_values()
statspro_overview_settings_form in ./statspro_overview.inc
statspro_path_aggregated_report_form in ./statspro_path_aggregated.inc
statspro_path_aggregated_report_form() definition.

File

./statspro_settings.inc, line 24

Code

function set_default_session_values($suffix, $period = '', $number_of_days = NULL) {
  $index = 'statspro_period' . $suffix;
  if (array_key_exists($period, statspro_get_period_items())) {
    $_SESSION[$index] = $period;
  }
  elseif (!isset($_SESSION[$index])) {
    $_SESSION[$index] = variable_get('statspro_period', 'today');
  }
  $index = 'statspro_custom_number_days' . $suffix;
  if (is_numeric($number_of_days)) {
    $_SESSION[$index] = (int) $number_of_days;
  }
  elseif (!isset($_SESSION[$index])) {
    $_SESSION[$index] = variable_get('statspro_custom_number_days', 30);
  }
}