You are here

public function StatsPro::get_qt_days_per_period in Statistics Pro 6.2

File

./statspro.inc, line 924
statspro class for Statistics Pro module.

Class

StatsPro
Manages the data saving and retrieval according to the user defined parameters.

Code

public function get_qt_days_per_period($period) {
  if (is_numeric($period)) {
    return $period;
  }
  else {
    switch ($period) {
      case 'today':
      case 'yesterday':
        return 1;
        break;
      case 'week_current':
      case 'week_last':
      case 'week_last2':
        return 7;
        break;
      case 'month_current':
      case 'month_last':
        return 30;
        break;
      case 'month_last3':
        return 90;
        break;
      case 'month_last6':
        return 180;
        break;
      case 'quarter_current':
      case 'quarter_last':
        return 90;
        break;
      case 'year_current':
      case 'year_last':
        return 365;
        break;
      default:
        watchdog('statspro', "Unknown period '@period'.", array(
          '@period' => $period,
        ), WATCHDOG_ERROR);
        return FALSE;
        break;
    }
  }
}