You are here

function _timefield_weekly_summary_week_time_offset in Timefield 1.0.x

Same name and namespace in other branches
  1. 7 timefield.module \_timefield_weekly_summary_week_time_offset()

Calculate offset from beginning of week.

1 call to _timefield_weekly_summary_week_time_offset()
_timefield_weekly_summary_time_sort in ./timefield.module
Uasort callback function

File

./timefield.module, line 499
Contains timefield.module.

Code

function _timefield_weekly_summary_week_time_offset($elem) {
  $multiplier = 60 * 60 * 24;
  if ($elem['mon']) {
    $mult = 0;
  }
  if ($elem['tue']) {
    $mult = 1;
  }
  if ($elem['wed']) {
    $mult = 2;
  }
  if ($elem['thu']) {
    $mult = 3;
  }
  if ($elem['fri']) {
    $mult = 4;
  }
  if ($elem['sat']) {
    $mult = 5;
  }
  if ($elem['sun']) {
    $mult = 6;
  }
  return $multiplier * $mult + $elem['value'];
}