You are here

function date_repeat_days_ordered in Date 7.3

Same name and namespace in other branches
  1. 8 date_repeat/date_repeat.module \date_repeat_days_ordered()
  2. 5.2 date_repeat/date_repeat.module \date_repeat_days_ordered()
  3. 6.2 date_repeat/date_repeat.module \date_repeat_days_ordered()
  4. 6 date_repeat/date_repeat.module \date_repeat_days_ordered()
  5. 7 date_repeat/date_repeat.module \date_repeat_days_ordered()
  6. 7.2 date_repeat/date_repeat.module \date_repeat_days_ordered()

Shift the array of iCal day names into the right order.

@todo Document this more thoroughly.

1 call to date_repeat_days_ordered()
_date_repeat_calc in date_repeat/date_repeat_calc.inc
Private implementation of date_repeat_calc().

File

date_repeat/date_repeat.module, line 201
Primary hook implementations for the Date Repeat module.

Code

function date_repeat_days_ordered($week_start_day) {
  $days = array_flip(array_keys(date_repeat_dow_day_options(FALSE)));
  $start_position = $days[$week_start_day];
  $keys = array_flip($days);
  if ($start_position > 0) {
    for ($i = 1; $i <= $start_position; $i++) {
      $last = array_shift($keys);
      array_push($keys, $last);
    }
  }
  return $keys;
}