You are here

protected function statspro::get_week_from_reference in Statistics Pro 6

Same name and namespace in other branches
  1. 6.2 statspro.inc \StatsPro::get_week_from_reference()

Returns a SQL WHERE for the selected week.

Weeks starts at mondays and ends at sundays.

For date('w') we get 0 (for Sunday) through 6 (for Saturday).

Parameters

<int> $reference Defines the selected week.:

Return value

<string> SQL min and max WHERE for week.

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

File

./statspro.inc, line 209
statspro class for statistics pro module.

Class

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

Code

protected function get_week_from_reference($reference) {
  $min = $this
    ->get_first_day_of_week_from_reference($reference);
  $day_of_week = date('w', $reference);
  $max = $day_of_week == 0 ? 'today' : 'next sunday';
  $max = date('Ymd', strtotime($max, $reference));
  return $this
    ->get_min_max_period($min, $max);
}