You are here

protected function StatsPro::get_month_from_reference in Statistics Pro 6.2

Same name and namespace in other branches
  1. 6 statspro.inc \statspro::get_month_from_reference()

Returns a SQL WHERE for the selected month.

Parameters

<int> $reference Defines the selected month.:

Return value

<string> SQL min and max WHERE for month.

1 call to StatsPro::get_month_from_reference()
StatsPro::get_period in ./statspro.inc
Generate SQL fragment for period query.

File

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

Class

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

Code

protected function get_month_from_reference($reference, $field, $use_timestamp) {
  $min = $this
    ->get_first_day_of_month_from_reference($reference, $use_timestamp);
  $max = $this
    ->get_last_day_of_month_from_reference($reference, $use_timestamp);
  if (!$use_timestamp) {
    return sprintf('(%s >= \'%s\' AND %1$s <= \'%s\')', $field, $min, $max);
  }
  return $this
    ->get_min_max_period($field, $min, $max);
}