You are here

function _timefield_weekly_summary_week_time_offset in Timefield 7

Same name and namespace in other branches
  1. 1.0.x 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 1447
Defines a Field API field for time

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