Ejemplo n.º 1
0
 /**
  * Returns a list of weeks (May 2 - May 8, May 9 - May 15).
  *
  * @access public
  * @param   integer $weeks_past The number of weeks in the past to include.
  * @param   integer $weeks_future The number of weeks in the future to include.
  * @return  array An array of weeks.
  */
 function getWeekOptions($weeks_past, $weeks_future)
 {
     $options = array();
     // get current week details
     $current_start = date("U") - DAY * (date("w") - 1);
     // previous weeks
     for ($week = $weeks_past; $week > 0; $week--) {
         $option = Date_API::formatWeekOption($current_start - $week * WEEK);
         $options[$option[0]] = $option[1];
     }
     $option = Date_API::formatWeekOption($current_start);
     $options[$option[0]] = $option[1];
     // future weeks
     for ($week = 1; $week <= $weeks_future; $week++) {
         $option = Date_API::formatWeekOption($current_start + $week * WEEK);
         $options[$option[0]] = $option[1];
     }
     return $options;
 }