You are here

function date_repeat_days_ordered in Date 7

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.3 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 for a specific week start day.

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 140
This module creates a form element that allows users to select repeat rules for a date, and reworks the result into an iCal RRULE string that can be stored in the database.

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;
}