You are here

function date_repeat_days_ordered in Date 8

Same name and namespace in other branches
  1. 5.2 date_repeat/date_repeat.module \date_repeat_days_ordered()
  2. 6.2 date_repeat/date_repeat.module \date_repeat_days_ordered()
  3. 6 date_repeat/date_repeat.module \date_repeat_days_ordered()
  4. 7.3 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 for a specific week start day.

1 call to date_repeat_days_ordered()
DateRRuleCalc::get_byday_results in date_repeat/lib/Drupal/date_repeat/DateRRuleCalc.php
Processing for BYDAY values.

File

date_repeat/date_repeat.module, line 175
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;
}